How to Install Pip on Ubuntu – Package Manager for Python

The package manager simply the package management job. Using a single utility you can install, uninstall, update packages e.g APT for Ubuntu, NPM for Node js and there are many. Here, packages are software, programs, tools, and Libraries.

Similarly, pip is for Python.

pip – Python package manager

PIP is a package manager for Python which helps you to install/uninstall/update packages from the Python package index. It does support other indexes as well. 

Why you need a package manager for Python?

Python is so popular that there are many programs, scripts, and other tools made with the language. PIP provides a quick and easy way to get them. 

So let’s see how to install pip on Ubuntu and also cover basic usage.

Install Pip on Ubuntu

Pip is available in the Ubuntu official distribution repositories. So you can use the apt command(steps are given below) to easily install it.

Note:- Below instructions should work on Ubuntu 18.04 and Ubuntu 20.04.

Open a terminal and run the following command to install pip on Ubuntu.

1. Refresh package index using the command.

sudo apt update

2. Install pip using the below command.

For Python 2,

sudo apt install python-pip

For Python 3,

sudo apt install python3-pip

And this way Pip will be installed.

3. Check the installed version with the following command:

pip3 – version

Output:

pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)

Now, let’s see how to use it.

Basic use of Pip on Ubuntu

Usually, the version of a program that is in the official Ubuntu repositories is not the most recent one. This also applies to Pip. Therefore, one of the first things we can do is update Pip.

To do this, in a terminal, we can use the same Pip to update it. Run:

pip3 install -U pip

This way, we can have the latest stable version of Pip.

As I said before, the operation of Pip is very similar to a package manager. So to install some program or utility, just follow this syntax:

pip3 install [package]

This command will install it locally, in case you want to do it globally, use this syntax:

sudo -H pip3 install [package]

If you want to uninstall any package, just follow this syntax:

pip3 uninstall [package]

Also, you can look for a specific package.

pip3 search [package]

This way, you can use Pip on Ubuntu.

Conclusion

Python Pip is the most convenient way to install many packages and utilities that have been made with Python. Its similar operation to a package manager makes it have a rather low learning curve.

Now you know how to install Python and Pip you can do many wonders with them. 

For other Linux distros refer to this page.