PIP is the alternate python package installer. pip is famous for easily managing the python based packages. As well as, with the help of pip you can also install the package of particular version. Most importantly pip has a feature to manage full lists of packages and corresponding version numbers, possible through a “requirements” file.
It performs the same basic job as easy_install, but with some extra features. It can work with version control repositories (currently only Git, Mercurial, and Bazaar repositories), logs output extensively, and prevents partial installs by downloading all requirements before starting installation.
It has some disadvantages when compared to easy_install. It does not use egg files, although it does preserve egg metadata. Some setuptools features are not yet supported, and some custom setup.py features won´t work.
Install pip on CentOS / RHEL
For RHEL 8.x and CentOS 8.x
In CentOS 8 and RHEL 8, it is user choice to install the python version. As we know the Python 2.x has end of life in 2020.
Basically we need pip for managing the python packages. In CentOS 8/RHEL when you install the Python 3.x by dnf
command , it also install pip 3 as a dependency.
So this command is for installing Python 3.x and pip3 as well.
sudo dnf install -y python3
If you do not have pip 3.x in your CentOS 8 / RHEL 8 system then only use the given below command.
sudo dnf install -y python3-pip
.
After installing pip 3 on CentOS 8 / RHEL 8, use pip3
command to manage the python packages. To check the help for pip3 command, use the given below command.
pip3 --help
For RHEL 7.x and CentOS 7.x (x86_64)
First install the EPEL repo as per your Operating system version and architecture.
For detail study, you can read our previous post on EPEL.
We have already written post on “Install EPEL repo on CentOS 7 / RHEL 7” with more details. Below given command will install EPEL repo on CentOS 7 / RHEL 7.
yum install epel-release
For RHEL 6.x and CentOS 6.x (x86_64)
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
For RHEL 6.x and CentOS 6.x (i386)
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
Installing pip with yum command
Now install pip with yum command
yum install -y python-pip
The pip rpm will be installed. You can confirm it by using following command.
See below given reference :
[root@localhost ~]# which pip /usr/bin/pip [root@localhost ~]# [root@localhost ~]# rpm -qa|grep pip python-pip-1.3.1-4.el6.noarch [root@localhost ~]#
Install pip on Debian / Ubuntu
Install pip in Ubuntu 20.04 LTS
As we know, the python 2.x is on sunset. In Ubuntu 20.04 LTS, it is shipped with Python 3.6. Hence, we will install the pip3 version.
Install the pip 3 by using apt-get command
sudo apt-get -y update sudo apt install python3-pip
To manage the python 3.x packages, use the pip3
command.
You check its help.
pip3 --help
Install pip on Ubuntu 1604 LTS and 180.04 LTS
In Ubuntu 16.04 LTS and 18.04 LTS install the pip by using apt command.
sudo apt update sudo apt install python-pip
To confirm the package installation.Given below is the reference from my system
sharad@ubuntu:~$ sudo dpkg -l|grep pip [sudo] password for sharad: ii libpipeline1:amd64 1.3.0-1 amd64 pipeline manipulation library ii python-pip 1.5.4-1 all alternative Python package installer sharad@ubuntu:~$ sharad@ubuntu:~$ which pip /usr/bin/pip sharad@ubuntu:~$
How to use pip command
After installing python-pip package, the pip command will be available on system.
There are multiple options available with pip command.
Most commonly used are install and uninstall of python package.
For installing package with pip command
Use below given syntax :
sudo pip install python-package-name
For uninstalling package with pip command
Use below given syntax
sudo pip uninstall python-package-name
Use –help switch along with pip command, to get more options. Read the below options, it is quite easy to use.
sharad@ubuntu:~$ pip --help Usage: pip[options] Commands: install Install packages. uninstall Uninstall packages. freeze Output installed packages in requirements format. list List installed packages. show Show information about installed packages. search Search PyPI for packages. wheel Build wheels from your requirements. zip DEPRECATED. Zip individual packages. unzip DEPRECATED. Unzip individual packages. bundle DEPRECATED. Create pybundles. help Show help for commands. General Options: -h, --help Show help. -v, --verbose Give more output. Option is additive, and can be used up to 3 times. -V, --version Show version and exit. -q, --quiet Give less output. --log-file Path to a verbose non-appending log, that only logs failures. This log is active by default at /home/sharad/.pip/pip.log. --log Path to a verbose appending log. This log is inactive by default. --proxy Specify a proxy in the form [user:passwd@]proxy.server:port. --timeout Set the socket timeout (default 15 seconds). --exists-action Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup. --cert Path to alternate CA bundle. sharad@ubuntu:~$
hi guys !thinks!
Hi,
Regards, this was usefull in my openstackclient installation. Thanks!
So how do you install for 3.5. I have installed 3.5 but pip only works for 2.7
Hello Ryan,
You can try with versioned python command. Let me know the output, it helps to troubleshoot.
This one is to know absolute path
For installing package by pip
Regards
Sharad
Excellent post. It really helped me. Thanks a lot.
Thank you Pavan,
Regards
Sharad
Doesn’t work in 5.4
yum install -y python-pip
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: cosmos.cites.illinois.edu
* base: mirror.hmc.edu
* extras: mirror.tocici.com
* updates: mirrors.syringanetworks.net
Setting up Install Process
No package python-pip available.
Nothing to do
Excelent post. It worked perfectly on CentOS 7.
But… on CentOS 5 (64-bits) there is no “python-pip” package. 🙁
Thankyou Alexandre,
Installing from pip source package will work in all supportive OS. 🙂
Regards
Sharad