How to install python-pip in CentOS7 Docker Container
Using this in the Dockerfile allowed me to install pip:
RUN yum -y install epel-release && yum clean all
RUN yum -y install python-pip && yum clean all
That seems much cleaner than using an rpm or curl.
If that still fails, try:
RUN yum -y install --enablerepo="epel" python-pip && yum clean all
Related videos on Youtube
Be Kind To New Users
Updated on September 18, 2022Comments
-
Be Kind To New Users over 1 year
I am trying to build a docker container that includes pip.
I am on CentOS 7.
Here is the fragment from running the docker build command:
Step 3 : RUN yum -y install python-pip ---> Running in 25d1ba46e6dc Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirror.vcu.edu * extras: mirror.clarkson.edu * updates: mirrors.unifiedlayer.com No package python-pip available. Error: Nothing to do 2015/02/13 19:23:48 The command [/bin/sh -c yum -y install python-pip] returned a non-zero code: 1
I would post my Dockerfile, but it seems that python-pip is not available from the standard CentOS distribution, because this fails too:
sudo yum -y install python-pip [sudo] password for theuser: Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirror.thelinuxfix.com * extras: mirrors.xmission.com * updates: mirrors.tripadvisor.com No package python-pip available. Error: Nothing to do
There is this link on solving the install problem for the host system: http://www.liquidweb.com/kb/how-to-install-pip-on-centos-7/ That involves using rpm or curl. I think that is a bit messy for Docker.
Also, if CentOS removed pip from the standard distribution, maybe they have good reason and I should not use brute force to install it.
This does not seem to be an issue in Ubuntu or other distributions. Just CentOS 7.
My concise question is: What is the preferred way to install pip (or an alternative) in CentOS 7?
-
poe123 over 7 yearsI changed it from ; to && so that if command fails it doesnt proceed.
-
Ciasto piekarz about 6 yearsHow do you get the latest pip version.
RUN yum -y install python-pip
but I want to directly install lastest version 10 of pip instead of 8 get installed