pip on RHEL

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.

To install the pip package manager, you must first install python

Try this commands;

Bash
sudo yum -y install python3

You need to install curl or you can use wget command instead of curl.

Try this commands;

Bash
sudo yum -y install curl
# OR
wget https://bootstrap.pypa.io/get-pip.py -o get-pip.py | sudo python3 get-pip.py

Make sure you update the repositories as in step 1. If you are sure that you have done this step, you can install EPEL repository and try again. Or you can try Method-2.

Try this commands;

Bash
sudo yum -y install epel-release

You may have completed the pip installation or the installation path may not have been added.

Try this commands;

Bash
which pip
export PATH=$PATH:/path/to/pip
Write a Comment

Leave a Comment

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