Home » Programming » Python » Install Pip

How to Install Pip/Pip3 for Python [Simple Guide]

This tutorial will teach you how to install pip3, the package manager for Python, on Ubuntu Linux.

Pip is a Python Package Manager. It’s currently at version 3 – hence, Pip3.

Python is useful on its own, but it’s even more useful when you can start leveraging other people’s pre-written code.

The default repository used by Pip is the Python Package Index (PyPI) (https://pypi.org/). PyPI contains a collection of other users’ code for performing a multitude of tasks, from drawing graphs to artificial intelligence.

Checking if Pip is Already Installed

To check if pip is installed, you can check the version installed on your Ubuntu system by running the following in the terminal:

pip3 --version

If it is installed, you’ll see something like:

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

Installing Pip/Pip3

If it is not, you can install it by running the following in your terminal:

sudo apt update
sudo apt install python3-pip

Using Pip

You can list out all of the available functions in Pip from the terminal:

pip3 --help

Listing Installed Pip Packages

To see what Pip Packages are already installed on your system:

pip3 list

Installing Python Packages with Pip

To install a package, you’ll need to know the name of the package. You can search for packages online in the PyPI package database at https://pypi.org :

pip3 install smpl

Above, we installed the smpl graphing package.

Installing a Specific Package Version

Install a specific version of a package (often done for compatibility reasons):

pip3 install smpl==0.0.4.0

Upgrade an Already Installed Package

Update a package you already have installed on your system:

pip3 install --upgrade package-name

Uninstall

Finally, you can completely remove a package from your system using Pip:

pip3 uninstall package-name
SHARE:
Photo of author
Author
I'm Brad, and I'm nearing 20 years of experience with Linux. I've worked in just about every IT role there is before taking the leap into software development. Currently, I'm building desktop and web-based solutions with NodeJS and PHP hosted on Linux infrastructure. Visit my blog or find me on Twitter to see what I'm up to.

4 thoughts on “How to Install Pip/Pip3 for Python [Simple Guide]”

  1. root@gamma:~# apt install python3-pip
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Package python3-pip is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source

    E: Package ‘python3-pip’ has no installation candidate

    root@gamma:~# apt install python3-pip
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Package python3-pip is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source

    E: Package ‘python3-pip’ has no installation candidate

    root@gamma:~# python3 -V
    Python 3.8.5

    root@gamma:~# lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description: Ubuntu 20.04.2 LTS
    Release: 20.04
    Codename: focal

    Reply
    • Odd that you couldn’t install pip3 directly from the Ubuntu repo – you may have needed to run:

      sudo apt update

      …to get the latest package lists before installing. All the same, your solution works too, thanks for posting it!

      Reply

Leave a Comment