28
votes

I am use AWS with REL 7. the default EC2 mico instance has already install python.

but it encounter below error when i try to install pip by yum.

sudo yum install pip

Loaded plugins: amazon-id, rhui-lb, search-disabled-repos No package pip available. Error: Nothing to do

Anyone advise on how to install pip with yum?

9
the OS of EC2 is RHEL-7.3_HVMBaodi Di

9 Answers

31
votes

The following worked for me on Amazon Linux AMI 2:

sudo yum -y install python-pip

30
votes

To install pip3.6 in Amazon Linux., there is no python36-pip. If you install python34-pip, it will also install python34 and point to it.

The best option that worked for me is the following:

#Download get-pip to current directory. It won't install anything, as of now
curl -O https://bootstrap.pypa.io/get-pip.py

#Use python3.6 to install pip
python3 get-pip.py
#this will install pip3 and pip3.6   

Based on your preference, if you like to install them for all users, you may choose to run it as 'sudo'

16
votes

You can see what is available by executing

yum search pip

In my case I see

...
python2-pip.noarch : A tool for installing and managing Python 2 packages
python3-pip.noarch : A tool for installing and managing Python3 packages

So, you can install the version that you need. Since the default instance seems to have Python 2 installed, you probably want python2-pip. Thus:

sudo yum install python2-pip

and away you go.

8
votes

if you have already installed python you might want to install pip by: sudo yum install python("version")-pip for example:

sudo yum install python34-pip
2
votes

Install python and then install pip

sudo yum install python34-pip
2
votes

I ran into this problem as well. I am using the AWS RHEL 7.5 image.

$ cat /etc/system-release
Red Hat Enterprise Linux Server release 7.5 (Maipo)

I enabled the extras and optional repos:

sudo yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional

But sudo yum search pip still did not show any relevant packages.

I downloaded the pip bootstrap installer and installed from there (see Installing with get-pip.py):

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

Note that many pip packages will require additional yum packages as well, e.g.:

  • gcc
  • python-devel
1
votes

There are different ways but this seems to be promising for me.

sudo yum install python3-pip

I prefer searching any package name first and then enter full name which I want to install.

yum search pip

this will give you results if any package with name pip.

Check if your installation is valid by pip3 --version which should print latest installed version on your system.

0
votes

The above answers seem to apply to python3 not python2 I'm running an instance where the default Python is 2.7

python --version
Python 2.7.14

I just tried to python-pip but it gave me pip for 2.6

To install pip for python 2.7 I installed the package pyton27-pip

sudo yum -y install python27-pip

That seemed to work for me.

0
votes

In my case is using docker with AmazonLinux2 image and python 2.7, I have to enable epel first : https://aws.amazon.com/premiumsupport/knowledge-center/ec2-enable-epel/

Then install by using yum install python-pip (because I'm using root user).