Cyberithub

How to Install PIP3 utility on Linux(RHEL/CentOS 7/8){Easy Steps}

In this article, I will take you through the steps to install pip3 utility on Linux. PIP is the Python Package Installer. Using pip tool one install python modules on Linux/Windows based Servers. Most of the Python Programmers and Developers prefers using pip to manage python packages. It provides the feature of issuing command through CLI interface to manage the python modules. More on PIP Official Documentation. In most of the cases, python now comes with pip packages but in some cases you might need to install it manually. Here I will explain you the steps in detail required to Install PIP3 utility on Linux(RHEL/CentOS 7/8).

How to Install PIP3 tool on Linux(RHEL/CentOS 7/8)

How to Install PIP3 utility on Linux(RHEL/CentOS 7/8)

Also Read: Solved: ModuleNotFoundError: No module named requests in Python 3

Step 1: Prerequisites

a) You need to have a running RHEL/CentOS 7/8 System.

b) You should have yum tool installed in your Server. You can check Top 22 YUM command examples in RedHat/CentOS 7 to know more about yum command.

c) You need to have root or sudo access to run privileged commands. Please Check How to Add User to Sudoers to know more about providing sudo access to the User.

Step 2: Update Your Server

Before you go through the steps to install pip3 utility on RHEL/CentOS Based Servers, it is always recommended to first update your server using yum update -y command as shown below. This will install all the latest available updates from yum repository.

[root@localhost ~]# yum update -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
epel/x86_64/metalink | 6.2 kB 00:00:00
* base: centos.mirrors.estointernet.in
* epel: mirror.telkomuniversity.ac.id
* extras: centos.mirrors.estointernet.in
* updates: centos.mirrors.estointernet.in
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
mysql-connectors-community | 2.6 kB 00:00:00
mysql-tools-community | 2.6 kB 00:00:00
mysql56-community | 2.6 kB 00:00:00
updates | 2.9 kB 00:00:00
Resolving Dependencies
--> Running transaction check
---> Package ansible.noarch 0:2.9.10-1.el7 will be updated
---> Package ansible.noarch 0:2.9.14-1.el7 will be an update
---> Package ca-certificates.noarch 0:2019.2.32-76.el7_7 will be updated
---> Package ca-certificates.noarch 0:2020.2.41-70.0.el7_8 will be an update
---> Package curl.x86_64 0:7.29.0-57.el7 will be updated
---> Package curl.x86_64 0:7.29.0-57.el7_8.1 will be an update
---> Package dbus.x86_64 1:1.10.24-13.el7_6 will be updated
---> Package dbus.x86_64 1:1.10.24-14.el7_8 will be an update
---> Package dbus-libs.x86_64 1:1.10.24-13.el7_6 will be updated
---> Package dbus-libs.x86_64 1:1.10.24-14.el7_8 will be an update
---> Package grub2.x86_64 1:2.02-0.81.el7.centos will be updated
---> Package grub2.x86_64 1:2.02-0.86.el7.centos will be an update
---> Package grub2-common.noarch 1:2.02-0.81.el7.centos will be updated
---> Package grub2-common.noarch 1:2.02-0.86.el7.centos will be an update
---> Package grub2-pc.x86_64 1:2.02-0.81.el7.centos will be updated
---> Package grub2-pc.x86_64 1:2.02-0.86.el7.centos will be an update
---> Package grub2-pc-modules.noarch 1:2.02-0.81.el7.centos will be updated
---> Package grub2-pc-modules.noarch 1:2.02-0.86.el7.centos will be an update
---> Package grub2-tools.x86_64 1:2.02-0.81.el7.centos will be updated
---> Package grub2-tools.x86_64 1:2.02-0.86.el7.centos will be an update
---> Package grub2-tools-extra.x86_64 1:2.02-0.81.el7.centos will be updated
---> Package grub2-tools-extra.x86_64 1:2.02-0.86.el7.centos will be an update
---> Package grub2-tools-minimal.x86_64 1:2.02-0.81.el7.centos will be updated
---> Package grub2-tools-minimal.x86_64 1:2.02-0.86.el7.centos will be an update
---> Package java-1.8.0-openjdk.x86_64 1:1.8.0.252.b09-2.el7_8 will be updated
---> Package java-1.8.0-openjdk.x86_64 1:1.8.0.262.b10-0.el7_8 will be an update
---> Package java-1.8.0-openjdk-accessibility.x86_64 1:1.8.0.252.b09-2.el7_8 will be updated
---> Package java-1.8.0-openjdk-accessibility.x86_64 1:1.8.0.262.b10-0.el7_8 will be an update
---> Package java-1.8.0-openjdk-demo.x86_64 1:1.8.0.252.b09-2.el7_8 will be updated
---> Package java-1.8.0-openjdk-demo.x86_64 1:1.8.0.262.b10-0.el7_8 will be an update
---> Package java-1.8.0-openjdk-devel.x86_64 1:1.8.0.252.b09-2.el7_8 will be updated
---> Package java-1.8.0-openjdk-devel.x86_64 1:1.8.0.262.b10-0.el7_8 will be an update
---> Package java-1.8.0-openjdk-headless.x86_64 1:1.8.0.252.b09-2.el7_8 will be updated
---> Package java-1.8.0-openjdk-headless.x86_64 1:1.8.0.262.b10-0.el7_8 will be an update
---> Package java-1.8.0-openjdk-javadoc.noarch 1:1.8.0.252.b09-2.el7_8 will be updated
---> Package java-1.8.0-openjdk-javadoc.noarch 1:1.8.0.262.b10-0.el7_8 will be an update
---> Package java-1.8.0-openjdk-javadoc-zip.noarch 1:1.8.0.252.b09-2.el7_8 will be updated
---> Package java-1.8.0-openjdk-javadoc-zip.noarch 1:1.8.0.262.b10-0.el7_8 will be an update
---> Package java-1.8.0-openjdk-src.x86_64 1:1.8.0.252.b09-2.el7_8 will be updated

Step 3: Install PIP3 tool on Linux

After successful update you can now go ahead and install pip3 tool using yum install python3-pip -y command as shown below.

[root@localhost ~]# yum install python3-pip -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.mirrors.estointernet.in
* epel: download.nus.edu.sg
* extras: centos.mirrors.estointernet.in
* updates: centos.mirrors.estointernet.in
Resolving Dependencies
--> Running transaction check
---> Package python3-pip.noarch 0:9.0.3-7.el7_7 will be installed
--> Processing Dependency: python(abi) = 3.6 for package: python3-pip-9.0.3-7.el7_7.noarch
--> Processing Dependency: python3-setuptools for package: python3-pip-9.0.3-7.el7_7.noarch
--> Processing Dependency: /usr/bin/python3 for package: python3-pip-9.0.3-7.el7_7.noarch
--> Running transaction check
---> Package python3.x86_64 0:3.6.8-13.el7 will be installed
--> Processing Dependency: python3-libs(x86-64) = 3.6.8-13.el7 for package: python3-3.6.8-13.el7.x86_64
--> Processing Dependency: libpython3.6m.so.1.0()(64bit) for package: python3-3.6.8-13.el7.x86_64
---> Package python3-setuptools.noarch 0:39.2.0-10.el7 will be installed
--> Running transaction check
---> Package python3-libs.x86_64 0:3.6.8-13.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================
Package Arch Version Repository Size
========================================================================================================================================================================
Installing:
python3-pip noarch 9.0.3-7.el7_7 updates 1.8 M
Installing for dependencies:
python3 x86_64 3.6.8-13.el7 base 69 k
python3-libs x86_64 3.6.8-13.el7 base 7.0 M
python3-setuptools noarch 39.2.0-10.el7 base 629 k

Transaction Summary
========================================================================================================================================================================
Install 1 Package (+3 Dependent packages)

Total download size: 9.4 M
Installed size: 48 M
Downloading packages:
(1/4): python3-3.6.8-13.el7.x86_64.rpm | 69 kB 00:00:00
(2/4): python3-setuptools-39.2.0-10.el7.noarch.rpm | 629 kB 00:00:00
(3/4): python3-pip-9.0.3-7.el7_7.noarch.rpm | 1.8 MB 00:00:01
(4/4): python3-libs-3.6.8-13.el7.x86_64.rpm | 7.0 MB 00:00:03
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 3.1 MB/s | 9.4 MB 00:00:03
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : python3-setuptools-39.2.0-10.el7.noarch 1/4
Installing : python3-libs-3.6.8-13.el7.x86_64 2/4
Installing : python3-3.6.8-13.el7.x86_64 3/4
Installing : python3-pip-9.0.3-7.el7_7.noarch 4/4
Verifying : python3-pip-9.0.3-7.el7_7.noarch 1/4
Verifying : python3-3.6.8-13.el7.x86_64 2/4
Verifying : python3-setuptools-39.2.0-10.el7.noarch 3/4
Verifying : python3-libs-3.6.8-13.el7.x86_64 4/4

Installed:
python3-pip.noarch 0:9.0.3-7.el7_7

Dependency Installed:
python3.x86_64 0:3.6.8-13.el7 python3-libs.x86_64 0:3.6.8-13.el7 python3-setuptools.noarch 0:39.2.0-10.el7

Complete!

NOTE:

Please make sure that EPEL repository is installed and enabled. EPEL repository provides access to commonly used software packages. In case it is not installed you can use yum install epel-release -y command to install it.

Step 4: Verify PIP3 Package Installation

You can verify the pip3 installation by querying the package details from RPM DB using rpm -qa | grep -i python3-pip command as shown below.

[root@localhost ~]# rpm -qa | grep -i python3-pip
python3-pip-9.0.3-7.el7_7.noarch

Step 5: Check PIP3 Version

You can use pip3 -V command to check the pip3 tool version. As you can see from below output, current pip3 version is 9.0.3.

[root@localhost ~]# pip3 -V
pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)

Step 6: Install Python Module using PIP3

Now that pip3 utility is installed in your server, you can proceed with the python module installation as required. Here we are installing python requests module by using pip3 install requests command as shown below. Similarly you can install other python modules by using pip3 install <module_name> command.

[root@localhost ~]# pip3 install requests
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting requests
Using cached https://files.pythonhosted.org/packages/45/1e/0c169c6a5381e241ba7404532c16a21d86ab872c9bed8bdcd4c423954103/requests-2.24.0-py2.py3-none-any.whl
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.6/site-packages (from requests)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.6/site-packages (from requests)
Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.6/site-packages (from requests)
Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.6/site-packages (from requests)
Installing collected packages: requests
Successfully installed requests-2.24.0

Step 7: Uninstall Python Module using PIP3

Along with the installation you can also use pip3 tool to uninstall the python modules. For example, in our case we can uninstall requests module by using pip3 uninstall requests command as shown below. Similarly to uninstall other python modules you can use pip3 uninstall <module_name> command.

[root@localhost ~]# pip3 uninstall requests
Uninstalling requests-2.24.0:
/usr/local/lib/python3.6/site-packages/requests-2.24.0.dist-info/DESCRIPTION.rst
/usr/local/lib/python3.6/site-packages/requests-2.24.0.dist-info/INSTALLER
/usr/local/lib/python3.6/site-packages/requests-2.24.0.dist-info/LICENSE.txt
/usr/local/lib/python3.6/site-packages/requests-2.24.0.dist-info/METADATA
/usr/local/lib/python3.6/site-packages/requests-2.24.0.dist-info/RECORD
/usr/local/lib/python3.6/site-packages/requests-2.24.0.dist-info/WHEEL
/usr/local/lib/python3.6/site-packages/requests-2.24.0.dist-info/metadata.json
/usr/local/lib/python3.6/site-packages/requests-2.24.0.dist-info/top_level.txt
/usr/local/lib/python3.6/site-packages/requests/__init__.py
/usr/local/lib/python3.6/site-packages/requests/__pycache__/__init__.cpython-36.pyc
/usr/local/lib/python3.6/site-packages/requests/__pycache__/__version__.cpython-36.pyc
/usr/local/lib/python3.6/site-packages/requests/__pycache__/_internal_utils.cpython-36.pyc
/usr/local/lib/python3.6/site-packages/requests/__pycache__/adapters.cpython-36.pyc
/usr/local/lib/python3.6/site-packages/requests/__pycache__/api.cpython-36.pyc
/usr/local/lib/python3.6/site-packages/requests/__pycache__/auth.cpython-36.pyc
/usr/local/lib/python3.6/site-packages/requests/__pycache__/certs.cpython-36.pyc
/usr/local/lib/python3.6/site-packages/requests/__pycache__/compat.cpython-36.pyc
/usr/local/lib/python3.6/site-packages/requests/__pycache__/cookies.cpython-36.pyc
/usr/local/lib/python3.6/site-packages/requests/__pycache__/exceptions.cpython-36.pyc
/usr/local/lib/python3.6/site-packages/requests/__pycache__/help.cpython-36.pyc
/usr/local/lib/python3.6/site-packages/requests/__pycache__/hooks.cpython-36.pyc
/usr/local/lib/python3.6/site-packages/requests/__pycache__/models.cpython-36.pyc
/usr/local/lib/python3.6/site-packages/requests/__pycache__/packages.cpython-36.pyc
/usr/local/lib/python3.6/site-packages/requests/__pycache__/sessions.cpython-36.pyc
/usr/local/lib/python3.6/site-packages/requests/__pycache__/status_codes.cpython-36.pyc
/usr/local/lib/python3.6/site-packages/requests/__pycache__/structures.cpython-36.pyc
/usr/local/lib/python3.6/site-packages/requests/__pycache__/utils.cpython-36.pyc
/usr/local/lib/python3.6/site-packages/requests/__version__.py
/usr/local/lib/python3.6/site-packages/requests/_internal_utils.py
/usr/local/lib/python3.6/site-packages/requests/adapters.py
/usr/local/lib/python3.6/site-packages/requests/api.py
/usr/local/lib/python3.6/site-packages/requests/auth.py
/usr/local/lib/python3.6/site-packages/requests/certs.py
/usr/local/lib/python3.6/site-packages/requests/compat.py
/usr/local/lib/python3.6/site-packages/requests/cookies.py
/usr/local/lib/python3.6/site-packages/requests/exceptions.py
/usr/local/lib/python3.6/site-packages/requests/help.py
/usr/local/lib/python3.6/site-packages/requests/hooks.py
/usr/local/lib/python3.6/site-packages/requests/models.py
/usr/local/lib/python3.6/site-packages/requests/packages.py
/usr/local/lib/python3.6/site-packages/requests/sessions.py
/usr/local/lib/python3.6/site-packages/requests/status_codes.py
/usr/local/lib/python3.6/site-packages/requests/structures.py
/usr/local/lib/python3.6/site-packages/requests/utils.py
Proceed (y/n)? y
Successfully uninstalled requests-2.24.0

Step 8: Uninstall PIP3 From Your Server

If you want to remove pip3 package from your server then you need to use yum remove python3-pip -y command as shown below.

[root@localhost ~]# yum remove python3-pip -y
Loaded plugins: fastestmirror
Resolving Dependencies
--> Running transaction check
---> Package python3-pip.noarch 0:9.0.3-7.el7_7 will be erased
--> Processing Dependency: python3-pip for package: python3-3.6.8-13.el7.x86_64
--> Running transaction check
---> Package python3.x86_64 0:3.6.8-13.el7 will be erased
--> Processing Dependency: python(abi) = 3.6 for package: python3-setuptools-39.2.0-10.el7.noarch
--> Processing Dependency: python(abi) = 3.6 for package: python3-libs-3.6.8-13.el7.x86_64
--> Processing Dependency: python(abi) = 3.6 for package: python3-setuptools-39.2.0-10.el7.noarch
--> Processing Dependency: python(abi) = 3.6 for package: python3-libs-3.6.8-13.el7.x86_64
--> Running transaction check
---> Package python3-libs.x86_64 0:3.6.8-13.el7 will be erased
---> Package python3-setuptools.noarch 0:39.2.0-10.el7 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================
Package Arch Version Repository Size
========================================================================================================================================================================
Removing:
python3-pip noarch 9.0.3-7.el7_7 @updates 9.3 M
Removing for dependencies:
python3 x86_64 3.6.8-13.el7 @base 39 k
python3-libs x86_64 3.6.8-13.el7 @base 35 M
python3-setuptools noarch 39.2.0-10.el7 @base 3.6 M

Transaction Summary
========================================================================================================================================================================
Remove 1 Package (+3 Dependent packages)

Installed size: 48 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Erasing : python3-libs-3.6.8-13.el7.x86_64 1/4
Erasing : python3-3.6.8-13.el7.x86_64 2/4
Erasing : python3-pip-9.0.3-7.el7_7.noarch 3/4
Erasing : python3-setuptools-39.2.0-10.el7.noarch 4/4
Verifying : python3-pip-9.0.3-7.el7_7.noarch 1/4
Verifying : python3-3.6.8-13.el7.x86_64 2/4
Verifying : python3-setuptools-39.2.0-10.el7.noarch 3/4
Verifying : python3-libs-3.6.8-13.el7.x86_64 4/4

Removed:
python3-pip.noarch 0:9.0.3-7.el7_7

Dependency Removed:
python3.x86_64 0:3.6.8-13.el7 python3-libs.x86_64 0:3.6.8-13.el7 python3-setuptools.noarch 0:39.2.0-10.el7

Complete!

 

 

 

Popular Recommendations:-

How to Properly Search PHP Modules Using YUM tool in Linux(RHEL/CentOS 7/8)

Solved: FATAL: Authentication Helper Program /usr/lib/squid/basic_ncsa_auth: (2) No Such File or Directory

How to Install and Configure Squid Proxy Server on RHEL/CentOS 7/8

Primitive Data Types in Java – int, char, byte, short, long, float, double and boolean

5 Best Ways to Become root user or Superuser in Linux (RHEL/CentOS/Ubuntu)

11 Best Python OS Module Examples on Linux

How to Install MariaDB 5.5 Server on RHEL/CentOS 7 Linux with Easy Steps

6 Simple Steps to Change/Reset MariaDB root password on RHEL/CentOS 7/8

Leave a Comment