How to Install Pip on Ubuntu 20.04

Install Pip on Ubuntu 20.04

In this article, we will have explained the necessary steps to install and configure Pip on Ubuntu 20.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Pip stands for Pip Installs Packages, a package management system similar that allows you to install and manage software packages written in Python. Pip installs packages listed in the PyPI (Python Package Index).

Install Pip on Ubuntu

Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.

sudo apt update
sudo apt upgrade

Step 2. Install PIP on Ubuntu system.

  • Install PiP for Python 3

The commands below install PiP to be used with Python version 3:

sudo apt update
sudo apt install python3-pip

Use the command below to verify it:

pip3 --version
  • Install PiP for Python 2

PiP doesn’t come installed with Ubuntu, so you will have to run the commands below to install it:

sudo add-apt-repository universe
sudo apt update
sudo apt install python-pip

After enabling the repository and install it:

curl https://bootstrap.pypa.io/get-pip.py --output get-pip.py
sudo python2 get-pip.py

Check version and confirm installation by entering following:

pip --version

Step 3. Basic usage of PIP.

  • Basic usage of PIP for python 3

To list all the commands in PIP enter following:

pip3 --help

Get information of specific command enter following:

pip3 install --help

To search package with PIP enter following:

pip3 search PACKAGE_NAME

Install package with PIP enter following in terminal:

pip3 install PACKAGE_NAME

To install package from requirements file:

pip3 install -r requirements.txt

Upgrade package with PIP:

pip3 install --upgrade PACKAGE_NAME

Uninstall package with PIP:

pip3 uninstall PACKAGE_NAME
  • Basic usage of PIP for python 2

To list all the commands in PIP enter following:

pip --help

Get information of specific command enter following:

pip install --help

To search package with PIP enter following:

pip search PACKAGE_NAME

Install package with PIP enter following in terminal:

pip install PACKAGE_NAME

To install package from requirements file:

pip install -r requirements.txt

Upgrade package with PIP:

pip install --upgrade PACKAGE_NAME

Uninstall package with PIP

pip uninstall PACKAGE

That’s all you need to do to install Pip on Ubuntu 20.04 Focal Fossa. I hope you find this quick tip helpful. Don’t forget to share your valuable queries/suggestions in the below comment box & also drop your worthwhile feedback.