Install Pip in Ubuntu 20.04

Python Pip is used to manage i.e. install or remove Python modules. In this article, we would discuss how to install Pip in Ubuntu 20.04 LTS release. Pip was first released on April 04, 2011. And, at the time of writing the article, the latest stable release of Pip is 20.0.2.

If you have installed Python version (i.e. 3.4 or later & 2.7.9 or later) through a binary installer then, you may not need to install pip. The pip package already comes bundled with binary installers.

But, in case you chose to install Python through apt in Ubuntu 20.04 LTS release then you would have to install the package separately.

We would first discuss installation steps required to get Pip. Then, with the help of an example we would discuss how to use the package to install Python modules.

Note: Following operations may require you to have superuser privileges. In case you don’t have one, then contact your System Administrator for assistance.

Install Pip in Ubuntu 20.04 LTS release

We can either install Pip/Pip2 or Pip3 package. The Pip package which we would want to install would depend on the Python package we prefer to use. So, in case you prefer to use Python3 then, go with PIP3 or else PIP/PIP2.

As the package is already available in standard Ubuntu repository. Therefore, we would have to first update the repository. So, issue the following in terminal –

sudo apt update

Now, to install PIP/PIP2

sudo apt install python-pip

Or, if you prefer to use Python v3 then go with PIP3

sudo apt install python3-pip

To confirm whether installation process has been completed as expected, check for the version of PIP/PIP2

pip -V

for PIP3

pip3 -V

This would get the relevant version of installed package. Otherwise, it would ask us to install the relevant package.

Manage (i.e. Install or Remove) Python Modules using PIP

We can install or remove Python modules using PIP/PIP2/PIP3.

For instance, if we want to install Numpy module. Then –

using PIP/PIP2 –

pip install numpy

with PIP3 –

pip3 install numpy

To remove numpy module (it would prompt for Y/N?) –

using PIP/PIP2 –

pip uninstall numpy

with PIP3 –

pip3 uninstall numpy

There are two more alternative methods (i.e. easy_install & manual action) through which we can manage Python modules. We would discuss each of these in coming articles.

In conclusion, we have discussed how to install Pip in Ubuntu 20.04 LTS release. Thereafter, how we can manage Python modules through PIP/PIP2/PIP3 was also discussed.