How to install boto3 on Ubuntu 18.04?

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


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

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

    apt install python-boto3

Tags:

Ubuntu 18.04