How to install Python Pip On Ubuntu 18.04


Pip is a reliable package management application designed to help users install and manage packages compiled in Python. By default, this package management system is not installed on Ubuntu 18.04, however, this should not worry you; its installation is simple.

This tutorial will show you how to install the latest version of Pip on your Ubuntu 18.04 system using apt. We’ll install Pip for Python 3.6.5 but the installation is flexible enough to allow you to install any other version (new or old) by changing the version number in the commands.


  • Ubuntu 18.04 server
  • User with sudo privileges

Step 1 Installing Pip

Let’s first install the latest version of Pip (Pip3) for Python 3. Ubuntu 18.04 comes with Python 3 pre-installed as a default installation for Python.

The first step when installing Pip for Python 3 is to update your package index.

$ sudo apt update

Next, execute the command below to install Pip and all the dependencies needed for designing Python modules.

$ sudo apt install python3-pip

The package will not take long to install. Once it's ready, execute the command below to verify the installation.

$ pip3 --version

The command above, will print the version of Pip installed. The version number may vary, but the output will be similar to the one below;

pip 9.0.1from/usr/lib/python3/dist-packages (python 3.6)

If you want to install Pip for older version of Python such as Python 2 on Ubuntu 18.04, follow the step below.

Execute the command below to update package index:

$ sudo apt update

Next, run the command below to install Pip. The command will install Pip for Python 2 as well as all the required dependencies required for designing Python modules.

$ sudo apt install python-pip

Now, execute the command below to verify your installation:

$ pip --version

This will give you an output similar to the one below

pip 9.0.1from/usr/lib/python2.7/dist-packages (python 2.7)

Step 2 Using Pip Help Option

Once you install Pip, the next thing is to grasp the basics for ease of use. It's advisable that you use Pip within the Python virtual environments. The virtual environments permits you to install and manage Python packages in an isolated and secure place designed specifically for each project. This eliminates the worry about affecting other projects on Python.

This section is compiled to help you learn the basics and use Pip with ease. Whether you are installing packages from version control, PyPI, or local projects, the following commands will streamline you installations.

If you want to view all Pip options and commands, run the command below:

$ pip3 --help

This will give you an output with a comprehensive list of Pip commands. Each command option comes with a short description of its function. If you want to learn more about a command in the list, you can use the command pip <command> --help.

For instance, to get more details about pip install command execute the command below:

$ pip <install> --help

Step 3 Installing A Package Using Pip

In this section, we’ll attempt to install the most recent version of the package “package_name”. Run the command below to install this package:

$ pip3 install package_name

In case you want a specific version of this packages, run the command below:

$ pip3 install package_name==2.3

Note: The commands above help you install “package_name” on Python 3. If you are using Python 2, change pip3 to pip to complete the installation.

Step 4 Installing Packages From The Requirement Files Using Pip

A requirement file is a helpful file that contains all the packages that can be installed using Python Pip. This file is often referenced as requirements.txt.

Run the command below to install the requirements contained in a file:

$ pip3 install -r requirements.txt

Step 5 Upgrading A Package Using Pip

Run the command below to upgrade all installed packages to the most recent version:

$ pip3 install--upgrade package_name

Step 6 Uninstalling A Package

If for any reason you want to uninstall an already installed package, run the command below:

$ pip3 uninstall package_name


That’s it! You have learned how to install Pip for Python 2 and Python 3 on your Ubuntu 18.04 system. You have also learned how to perform a few basic tasks on Ubuntu 18.04 using Pip. you can now, explore more Pip options and master its usage to streamline the management of your Python packages.

Check out these top 3 VPS services:

Was this article helpful?