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.
sudo yum -y update
2. Install pip
Then we install the pip library for python3 with the yum command
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.
curl https://bootstrap.pypa.io/get-pip.py | sudo python3
Verify installation
We print the version to verify the pip installation
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.
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.
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
To install the pip package manager, you must first install python
Try this commands;
sudo yum -y install python3
curl: command not found
You need to install curl or you can use wget command instead of curl.
Try this commands;
sudo yum -y install curl
# OR
wget https://bootstrap.pypa.io/get-pip.py -o get-pip.py | sudo python3 get-pip.py
Unable to find a match: python3-pip
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;
sudo yum -y install epel-release
pip: command not found
You may have completed the pip installation or the installation path may not have been added.
Try this commands;
which pip
export PATH=$PATH:/path/to/pip