29

I am trying to install python-pip in a centos7 docker container, but I think I may be missing some package or something.

[root@aasdfasdfa /]# yum -y install python-pip
Loaded plugins: fastestmirror, ovl
base                                                                                                                                                                          | 3.6 kB  00:00:00     
extras                                                                                                                                                                        | 3.4 kB  00:00:00     
updates                                                                                                                                                                       | 3.4 kB  00:00:00     
updates/7/x86_64/primary_db                                                                                                                                                   | 8.4 MB  00:00:31     
Loading mirror speeds from cached hostfile
 * base: repos.lax.quadranet.com
 * extras: mirrors.unifiedlayer.com
 * updates: mirrors.usc.edu
No package python-pip available.
Error: Nothing to do

What do I need to run before yum -y install python-pip so that it will install correctly. Note that easy_install is also broken so thats not an option.

Ƭᴇcʜιᴇ007
  • 111,883
  • 19
  • 201
  • 268
Alex Cohen
  • 393
  • 1
  • 3
  • 8

6 Answers6

48

You have to enable the EPEL repo, use:

yum --enablerepo=extras install epel-release

This command will install the correct EPEL repository for the CentOS version you are running.

After this you will be able to install python-pip.

Zina
  • 2,247
  • 2
  • 14
  • 12
  • 1
    In my case, after installing epel-release I still have to tell yum to use the epel repo when I want to install something. Something like: yum --disablerepo="*" --enablerepo="epel" install PACKAGE. – rph Mar 15 '18 at 02:33
11

I was going crazy about the same issue. The reason why yum couldn't find python-pip was that it is not called python-pip anymore. Starting with EPEL Version 7 it is renamed to identify the python version. On my centOS machine i can find now the following python*-pip packages.

[root@asdasdasdasdsa ~]# yum info python*-pip
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.rz.uni-frankfurt.de
 * epel: mirrors.mit.edu
 * extras: mirror.23media.de
 * updates: ftp.plusline.de
Available Packages
Name        : python2-pip
Arch        : noarch
Version     : 8.1.2
Release     : 5.el7
Size        : 1.7 M
Repo        : epel/x86_64
Summary     : A tool for installing and managing Python 2 packages
URL         : http://www.pip-installer.org
License     : MIT
Description : Pip is a replacement for `easy_install
            : <http://peak.telecommunity.com/DevCenter/EasyInstall>`_.  It uses mostly the
            : same techniques for finding packages, so packages that were made
            : easy_installable should be pip-installable as well.

Name        : python34-pip
Arch        : noarch
Version     : 8.1.2
Release     : 5.el7
Size        : 1.7 M
Repo        : epel/x86_64
Summary     : A tool for installing and managing Python3 packages
URL         : http://www.pip-installer.org
License     : MIT
Description : Pip is a replacement for `easy_install
            : <http://peak.telecommunity.com/DevCenter/EasyInstall>`_.  It uses mostly the
            : same techniques for finding packages, so packages that were made
            : easy_installable should be pip-installable as well.
Michael Aicher
  • 211
  • 2
  • 5
  • `yum install python-pip` works the same on RHEL/CentOS v7, because `python2-pip` provides `python-pip` (you can check using `yum provides python-pip`). So I guess you had another issue. – Franklin Piat Jul 24 '18 at 21:40
6

The CentOS Docker image doesn't include the EPEL repository by default, as a regular CentOS installation does. You should yum install epel-release first -- after that, yum install python-pip should work.

jjlin
  • 15,462
  • 4
  • 51
  • 51
3

For CentOS 8 you need to run these commands:

dnf install python2-pip # For Python 2
dnf install python3-pip # For Python 3

Then you can use pip3 or pip2

DerSkythe
  • 131
  • 2
1

If you get the same error even after installing the epel repo, try:

sudo yum install -y --enablerepo="epel" python-pip
falsePockets
  • 134
  • 1
  • 8
1

Follow these commands step by step:

yum install python36
yum install python36-devel
yum install python36-setuptools
easy_install-3.6 pip

Once done check the python version

python3.6 -V