Baodi Di
Baodi Di

Reputation: 600

how to install pip with yum on EC2

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?

Upvotes: 33

Views: 104169

Answers (9)

darth vader
darth vader

Reputation: 578

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.

Upvotes: 4

craigpastro
craigpastro

Reputation: 860

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.

Upvotes: 18

namnh
namnh

Reputation: 533

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).

Upvotes: 0

Jonathan
Jonathan

Reputation: 15452

The following worked for me on Amazon Linux AMI 2:

sudo yum -y install python-pip

Upvotes: 56

jorfus
jorfus

Reputation: 3088

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.

Upvotes: 0

Sairam Krish
Sairam Krish

Reputation: 11731

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'

Upvotes: 33

cherdt
cherdt

Reputation: 303

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

Upvotes: 2

Suneel Kumar
Suneel Kumar

Reputation: 1664

Install python and then install pip

sudo yum install python34-pip

Upvotes: 2

user8231578
user8231578

Reputation:

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

Upvotes: 8

Related Questions