Alex R
Alex R

Reputation: 11891

How to install boto3 on Ubuntu 18.04?

How do you install boto3 on Ubuntu 18.04?

I tried this:

# pip install boto3

Command 'pip' not found, but can be installed with:

apt install python-pip

# apt install python-pip
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python-pip
#

Upvotes: 11

Views: 41926

Answers (4)

Jonny
Jonny

Reputation: 3955

TL:DR

If trying to install using apt-get, try:

sudo apt-get install python3-boto3

(obviously for Python 3.x only)

In general, to use apt to search for and review packages:

Find packages with boto3 in name using:

apt-cache search boto3

Review any results you're interested in (e.g. python3-boto3) with:

apt-cache show python3-boto3

Upvotes: 0

Italo Gervasio
Italo Gervasio

Reputation: 388

The log you posted informs you that the commands pip and python-pip are not already installed. So, if you still use python 2 (do not recommend), you can install pip or python-pip

sudo apt-get install pip
sudo apt-get install python-pip

and then install boto3: sudo pip install boto3.

Otherwise, if you already use Python 3, you can just install pip3 or python3-pip

sudo apt-get install pip3
sudo apt-get install python3-pip

and then install boto3: sudo pip3 install boto3

Upvotes: 1

it's quite simple, just install it from the terminal

    apt install python-boto3

Upvotes: 3

Alex R
Alex R

Reputation: 11891

Partial answer found at https://askubuntu.com/questions/672808/sudo-apt-get-install-python-pip-is-failing

sudo apt-get install software-properties-common
sudo apt-add-repository universe
sudo apt-get update
sudo apt-get install python3-pip

Do not run pip install --upgrade pip, otherwise the following steps are also needed:

from https://github.com/pypa/pip/issues/5240

vi /usr/bin/pip3

change the broken from pip import main import to

from pip._internal import main

and then finally

pip3 install boto3

Upvotes: 14

Related Questions