[pip] How to install pip in CentOS 7?

CentOS 7 EPEL now includes Python 3.4: yum install python34

However, when I try that, even though Python 3.4 installs successfully, it doesn't appear to install pip. Which is weird, because pip should be included by default with Python 3.4. which pip3 doesn't find anything, nor does which pip.

How do I access pip from the Python 3.4 package in CentOS 7 EPEL release?

This question is related to pip python-3.4 centos7

The answer is


Figure out what version of python3 you have installed:

yum search pip

and then install the best match. Use reqoquery to find name of resulting pip3.e.g

repoquery -l python36u-pip

tells me to use pip3.6 instead of pip3


Below are the steps I followed to install python34 and pip

yum update -y
yum -y install yum-utils
yum -y groupinstall development
yum -y install https://centos7.iuscommunity.org/ius-release.rpm
yum makecache
yum -y install python34u  python34u-pip
python3.6 -v
echo "alias python=/usr/bin/python3.4" >> ~/.bash_profile
source ~/.bash_profile
pip3 install --upgrade pip

# if yum install python34u-pip doesnt work, try 

curl https://bootstrap.pypa.io/get-pip.py | python

yum install python34-pip

pip3.4 install foo

You will likely need the EPEL repositories installed:

yum install -y epel-release


Update: The python34 bug mentioned below has finally been fixed. It is a perfectly fine choice now.

Rather than using broken EPEL python34 packages, you can enable the IUS repo and have it work properly.

  • pip inside virtual environments

The main python34u and python35u IUS packages include the pyvenv tool (/usr/bin/pyvenv-3.4 or /usr/bin/pyvenv-3.5) that includes bundled wheels of pip and setuptools for bootstrapping virtual environments.

  • global pip

The python34u-pip and python35u-pip IUS packages include /usr/bin/pip3.4 and /usr/bin/pip3.5 respectively. These work just fine to install packages to the system site-packages directory.


On CentOS 7, the pip version is pip3.4 and is located here:

/usr/local/bin/pip3.4

The CentOS 7 yum package for python34 does include the ensurepip module, but for some reason is missing the setuptools and pip files that should be a part of that module. To fix, download the latest wheels from PyPI into the module's _bundled directory (/lib64/python3.4/ensurepip/_bundled/):

setuptools-18.4-py2.py3-none-any.whl
pip-7.1.2-py2.py3-none-any.whl

then edit __init__.py to match the downloaded versions:

_SETUPTOOLS_VERSION = "18.4"
_PIP_VERSION = "7.1.2"

after which python3.4 -m ensurepip works as intended. Ensurepip is invoked automatically every time you create a virtual environment, for example:

pyvenv-3.4 py3
source py3/bin/activate

Hopefully RH will fix the broken Python3.4 yum package so that manual patching isn't needed.


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

Or if you don't have curl for some reason:

wget https://bootstrap.pypa.io/get-pip.py
python3.4 get-pip.py

After this you should be able to run

$ pip3

There is a easy way of doing this by just using easy_install (A Setuptools to package python librarie).

  • Assumption. Before doing this check whether you have python installed into your Centos machine (at least 2.x).

  • Steps to install pip.

    1. So lets do install easy_install,

      sudo yum install python-setuptools python-setuptools-devel

    2. Now lets do pip with easy_install,

      sudo easy_install pip

That's Great. Now you have pip :)


Update 2019

I tried easy_install at first but it doesn't install packages in a clean and intuitive way. Also when it comes time to remove packages it left a lot of artifacts that needed to be cleaned up.

sudo yum install epel-release
sudo yum install python34-pip
pip install package

Was the solution that worked for me, it installs "pip3" as pip on the system. It also uses standard rpm structure so it clean in its removal. I am not sure what process you would need to take if you want both python2 and python3 package manager on your system.


Examples related to pip

How to fix error "ERROR: Command errored out with exit status 1: python." when trying to install django-heroku using pip "E: Unable to locate package python-pip" on Ubuntu 18.04 How to Install pip for python 3.7 on Ubuntu 18? What is the meaning of "Failed building wheel for X" in pip install? Could not install packages due to an EnvironmentError: [Errno 13] How do I install Python packages in Google's Colab? Conda version pip install -r requirements.txt --target ./lib pip: no module named _internal AttributeError: Module Pip has no attribute 'main' Error after upgrading pip: cannot import name 'main'

Examples related to python-3.4

No module named 'openpyxl' - Python 3.4 - Ubuntu How to install pip in CentOS 7? Python3 project remove __pycache__ folders and .pyc files Python3: ImportError: No module named '_ctypes' when using Value from module multiprocessing OSError: [WinError 193] %1 is not a valid Win32 application enum - getting value of enum on string conversion Pandas - Plotting a stacked Bar Chart Python 3.4.0 with MySQL database How could I use requests in asyncio?

Examples related to centos7

How to uninstall an older PHP version from centOS7 How to redirect output of systemd service to a file Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details How to Install gcc 5.3 with yum on CentOS 7.2? PHP Warning: Module already loaded in Unknown on line 0 How to install pip in CentOS 7? "psql: could not connect to server: Connection refused" Error when connecting to remote database CentOS 7 and Puppet unable to install nc How to get ip address of a server on Centos 7 in bash resize2fs: Bad magic number in super-block while trying to open