How to install Python package installer PIP on Ubuntu 20.04 Focal Fossa Linux

PIP is a package management system used for installing and managing software packages that were developed with Python. The objective of this tutorial is to show the reader how to install PIP on Ubuntu 20.04 Focal Fossa Linux.

In this tutorial you will learn:

  • How to install Python package installer PIP
  • How to install Python 3 package installer PIP3
  • Basic PIP command usage

PIP and PiP3 on Ubuntu 20.04 Focal Fossa Linux

PIP and PiP3 on Ubuntu 20.04 Focal Fossa Linux

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Installed Ubuntu 20.04 or upgraded Ubuntu 20.04 Focal Fossa
Software N/A
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Install Python package installer PIP on Ubuntu 20.04 step by step instructions

Is the Universe repository enabled?
Before you proceed make sure that you have the Ubuntu Universe repository enabled as otherwise the below python-pip installation commands will throw the following error: E: Unable to locate package python-pip
  1. Depending on your needs you may install both Python and Python 3 PIP versions using the following commands:
    PYTHON 2:
    $ sudo apt install python-pip
    PYTHON 3:
    $ sudo apt install python3-pip
    


  2. Confirm the successful installation by checking for the pip and pip3 version:
    $ pip --version
    pip 18.1 from /usr/lib/python2.7/dist-packages/pip (python 2.7)
    $ pip3 --version
    pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7)
    
  3. Use the PIP command to installed python libraries. Here is a basic usage:
    The following lines will illustrate a basic usage and syntax of PIP command. To search packages index execute:

    $ pip search KEYWORD

    Once you obtain the package name use pip to install it:

    $ pip install PACKAGE_NAME

    Lastly, to remove package enter:

    $ pip uninstall PACKAGE_NAME