Python provides the pip3 package in order to search, install, update, and remove Python packages. It is named Python3-pip
and installed in the current Ubuntu distribution. Especially for the old versions of Ubuntu, we can get the “E: Unable to locate package python3-pip” error. In this tutorial, we examine this error and how to solve it for different Ubuntu versions like Ubuntu 18.04, 20.04, etc.
Enable Ubuntu Universe Repositories
The python3-pip package is provided via the universe repositories especially the old Ubuntu versions like 18.04 and 20.04. We should enable the universe repository with the following add-apt-repository
command like below.
$ sudo add-apt-repository universe
Then in order to get new packages and updates we should update the repository and package information like below.
$ sudo apt-get update
Now we can install the python3-pip package like below.
$ sudo apt-get install python3-pip
Install python3-setuptools
In some cases, the above solution may not work for you. There is an alternative solution that can be accomplished by installing the python3-setuptools
. First, we install the python3-setuptools
package with the following command.
$ sudo apt-get install python3-setuptools
The python3-setuptools provide the easy_install3
command which can be used to install pip or pip3 for Python3.
$ sudo easy_install3 pip