How To Install PIP to Manage Python Packages in Linux

Pip (recursive acronym for “Pip Installs Packages” or “Pip Installs Python“) is a cross-platform package manager for installing and managing Python packages (which can be found in the Python Package Index (PyPI)) that comes with Python 2 or Python 3 binaries.

The Pip management tool is particularly useful for programmers who want to utilize existing code or libraries to develop their Python applications without having to write everything from scratch.

In this article, we will explain how to install PIP on mainstream Linux distributions.

Note: We will run all commands as the root user, if you are managing your system as a regular user, then use the sudo command to get root privileges or you can as well configure your system to run sudo command without entering a password, it’s possible.

Install PIP in Linux Systems

To install pip in Linux, run the appropriate command for your distribution as follows:

Install PIP On Debian/Ubuntu

To install pip on Debian-based distributions such as Ubuntu and Linux Mint, you can use the apt package manager.

$ sudo apt install python-pip	#python 2
$ sudo apt install python3-pip	#python 3

Install PIP On CentOS and RHEL

Unluckily, pip is not packaged in official software repositories of RHEL-based distributions such as CentOS Stream, Rocky and AlmaLinux.

So you need to enable the EPEL repository and then install pip using the yum package manager.

# yum install epel-release 
# yum install python-pip	#python 2
# yum install python3-pip	#python 3

Install PIP on Fedora

To install pip on Fedora, you can use the dnf package manager.

# dnf install python-pip	#Python 2
# dnf install python3-pip	#Python 3

Install PIP on Arch Linux

# pacman -S python2-pip	        #Python 2
# pacman -S python-pip	        #Python 3

Install PIP on openSUSE

# zypper install python-pip	#Python 2
# zypper install python3-pip	#Python 3

How to Use PIP in Linux Systems

To install, uninstall or search new Python packages, use these commands.

Search a Python Package

To search for packages available on PyPI, you can use the search command:

# pip search requests

Install a Python Package

To install a requests package, open a terminal and use the following command:

# pip install requests

Upgrade a Python Package

To upgrade an already installed package to the latest version, you can use the following command:

# pip install --upgrade requests

Uninstall a Python Package

To uninstall a requests package, use the following command:

# pip uninstall requests

List Installed Python Packages

You can list all the packages that are currently installed using the command:

# pip list

Pip Help and Usage

To see a list of all commands type:

# pip help

Sample Output:

Usage:   
  pip <command> [options]

Commands:
  install                     Install packages.
  download                    Download packages.
  uninstall                   Uninstall packages.
  freeze                      Output installed packages in requirements format.
  list                        List installed packages.
  show                        Show information about installed packages.
  check                       Verify installed packages have compatible dependencies.
  search                      Search PyPI for packages.
  wheel                       Build wheels from your requirements.
  hash                        Compute hashes of package archives.
  completion                  A helper command used for command completion.
  help                        Show help for commands.

You may also like to read the following related articles about Python.

In this article, we showed you how to install PIP on mainstream Linux distributions. To ask any questions relating to this topic, please take advantage of the feedback form below.

Aaron Kili
Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

21 thoughts on “How To Install PIP to Manage Python Packages in Linux”

  1. Hi, I’m currently running centos8 and trying to install ansible but when I run the install, the command line prompts that I need to update to the latest PIP, how would I go about doing this?

    Reply
  2. I have seen this same issue with many others online (/usr/bin/python: No module named pip) after following install instructions and many others maybe’s still no success.

    Please HELP!

    Reply
  3. Does a normal Linux user need sudo access to install packages using pip3? If so, what would the entry be in the sudoers file?

    Reply
  4. Thanks for the tutorial.

    I had trouble running ‘pip‘ command after the python3-pip was successfully installed. I kept getting the ‘Command ‘pip’ not found, but can be installed with: sudo apt install python-pip‘ error. Until I figured out the pip for python3 installed as ‘pip3‘ not just pip. :D.

    Reply
  5. Thanks a bunch! I’m a Kubuntu user and I modified your code for installing on Debian/Linux slightly (to what I’m used to using for downloading via the terminal) and used the following:

    $ sudo apt-get install python3-pip
    

    Download worked smoothly for me: not a single error message!

    As a side note, I already had a version of python 3 (3.4.3) installed on my machine.

    Thanks again!

    Reply
  6. Hello,

    I am using RedHat Linux and trying to install CV2 and PIP for comparing pixel by pixel of two image in Python 2.7. But still getting below issues.

    Error:
    1> 
    OSError: Cython needs to be installed
    Traceback (most recent call last):
    File "setup.py", line 410, in 
    setup_package()
    File "setup.py", line 393, in setup_package
    generate_cython()
    File "setup.py", line 214, in generate_cython
    raise RuntimeError("Running cythonize failed!")
    RuntimeError: Running cythonize failed!
    $
    2> 
    /usr/local/lib/python2.7/site-packages/cStringIO.so: undefined symbol: PyCapsule_New
    

    Please let me know it is possible to install in redhat Linux or will skip it to other module.

    Reply

Leave a Reply to Joseph McCarron Cancel reply

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.