How to Install Pip in Ubuntu

Linux is absolutely rife with package managers. Not only does Ubuntu have apt, but many programming languages come with their own package managers as well. Node.js has npm, Ruby has gem, and Python has pip.

Pip stands for Python Installs Packages and lets you easily install packages from the Python Package Index (PyPI). You can use it to install from other indexes as well, but much of what you’ll generally need is available on PyPI. In order to use pip to install packages, you’ll need to install it on your system first.

Which Version of Pip Do You Need?

If you’re at all familiar with Python, you likely know that Python 3 has been out for a long time. Even so, because of major changes between Python 2 and Python 3, many Linux distributions include both versions by default. Because of this, there are also two versions of pip.

Newer versions of Ubuntu only come with Python 3 installed by default. If you need pip for Python 2, you’ll need to install Python 2 as well.

Which version you need likely depends on the package you need to install. Either way, the process is relatively easy, but we’ll show you how to install both versions so you know exactly what to do.

How to Install Pip for Python 3

The first thing to do before you get started is to make sure that your package list is up to date. Do this by running apt:

sudo apt update

This process will take a little time. Once it is complete, you can move on to actually installing pip. To do this, run the following command:

sudo apt install python3-pip

Confirm that you want to install the packages, and wait for the process to complete. Once this is finished, confirm that the package installed correctly by checking the version:

pip3 --version

How to Install Pip for Python 2

As mentioned above, if you need pip for Python 2, you need to install Python 2 as well. This is easy, though, as Python 2 will be installed as a dependency for pip.

First, make sure your package list is up to date:

sudo apt update

Once this is complete, you can install pip with the following command:

sudo apt install python-pip

Confirm that you want to install pip and its dependencies, then wait for the installation to complete. Once this is finished, make sure everything installed properly by checking the version:

pip --version

Should You Use Pip or Apt?

In some cases you’ll find that packages are available in both the Python Package Index and via Apt. If you have to choose, you’re better off sticking with installing via Apt, as these versions have been tested to work on Ubuntu. In most cases you’ll only want to use pip if a package isn’t available via Apt or if you need a specific version.


It’s worth noting that you may need to install pip for both Python 2 and Python 3. Some packages are only available for certain python versions, and other software may rely on one or both. Neovim, for example, lets users create add-ons in both Python 2 and Python 3 and relies on having its own package installed in both versions of pip.

Chances are good that you’re installing pip because you’re a developer. If this is the case, be sure to check out our list of the best Python IDEs.

Kris Wouk
Kris Wouk

Kris Wouk is a writer, musician, and whatever it's called when someone makes videos for the web.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox