How to install pip on RHEL

Introduction


The abbreviation of pip is Package Installer Python. Pip is a package management system that hosts Python files. It allows you to install, update and remove libraries belonging to Python

In this tutorial, learn how to install Pip on Centos 7, Centos 8, Centos 9, Fedora, Alma Linux 8, Alma Linux 9, Rocky Linux 8, Rocky Linux 9, Oracle Linux and other RHEL-based Linux servers.

Prerequisites


  • Curl or wget
  • Root user or sudo privileges
  • Terminal access
  • Python3

Installing pip on RHEL-based Linux servers (Centos, Fedora, Alma, Rocky etc.)


Method-1

1) Update Repository

We update all installed packages on the system to the latest version.

Bash
sudo yum -y update

2. Install pip

Then we install the pip library for python3 with the yum command

Bash
sudo yum -y install python3-pip

Method-2

1. Get and run python file

To install the pip package manager, we get the get-pip.py file to our server with the curl command and run it with python3.

Bash
curl https://bootstrap.pypa.io/get-pip.py | sudo python3

Verify installation


We print the version to verify the pip installation

Bash
pip -V
# Sample Output: pip 21.2.3

Upgrading pip


If we want to upgrade the pip version, we can simply run any of the following commands in the terminal.

Bash
sudo python3 -m pip install --upgrade pip
# OR
sudo pip3 install --upgrade pip

Uninstalling pip


If we want to remove the pip package manager, we can simply run any of the following commands in the terminal.

Bash
sudo yum -y remove python3-pip
# OR
sudo python3 -m pip uninstall pip

Troubleshooting


Below are some errors and tips on how to fix them. If you encounter any errors during installation, do not forget to ask for help in the comments.

python3: command not found

curl: command not found

Unable to find a match: python3-pip

pip: command not found

Write a Comment

Leave a Comment

Your email address will not be published. Required fields are marked *