Skip to content
Follow
Ubuntu Linux

How to Install Python Pip on Ubuntu Linux

Richard
Written by
Richard
May 5, 2020 Updated Sep 15, 2026 4 min read
How to Enable or Disable Microsoft Defender Cloud Protection
How to Enable or Disable Microsoft Defender Cloud Protection

Python pip on Ubuntu Linux is the standard package manager you use to install, update, and remove Python software libraries. It connects straight to the Python Package Index, an online repository with thousands of ready-to-use code projects.

Advertisement

Ubuntu version 22.04 LTS and other recent releases let you set up pip in just a few minutes using the built-in terminal. Once you finish the setup, adding new tools takes a single command like pip install package-name.

⚡ Quick Answer

Install pip for Python 3 using `sudo apt update` and `sudo apt install python3-pip`. Verify the installation by running `pip3 –version`. Pip is Python’s package manager for installing and managing libraries.

Advertisement

How to install Python Pip on Ubuntu Linux

As described above, Pip is a Python package manager for installing , maintaining, and upgrading Python packages. It searches, downloads, and installs packages from the Python package index and other indexes.

Below is how to install it on Ubuntu Linux.

Install Pip for Python 3

You can install Python Pip Ubuntu for version 3 by opening your terminal and running two quick commands to update your package list and install the installer tool. First, update your software list with sudo apt update, and then run sudo apt install python3-pip to set up Pip so you can add and manage Python packages on your computer.

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

Advertisement
sudo apt update
sudo apt install python3-pip

When you run the commands above, all dependencies required for PiP to function will be installed alongside PiP.

To validate whether PiP is installed, simply run the commands below:

pip3 --version

You should see a similar line below:

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

That's how to get PiP installed for use with Python 3.

Advertisement

Install Pip for Python 2

Python Pip Ubuntu installations for the older Python 2 require enabling the universe software repository before you can download the package manager. You must first add the universe source, update your package lists, and then run the command to install python-pip so you can manage older Python 2 projects on your system.

Pip, the package installer for Python, does not come pre-installed on Ubuntu. You must run the command `sudo apt install python3-pip` to install Pip on your system. Installing Pip allows you to easily add and manage Python software packages.

sudo add-apt-repository universe
sudo apt update
sudo apt install python-pip
⚠️WarningNow that Python 2 is installed, you can install Pip using a get-pip.py script.

After enabling and installing the repository above, simply download and run the script to install Python globally.

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

The script will also install Pip, setup tools, and a wheel.

Advertisement

Installing Packages with PiP

Python Pip Ubuntu package installation is handled by typing pip install followed by the exact name of the tool or library you want to add to your environment. Once you finish installing Pip, you can use this command anytime you need to pull in external code, or check the built-in help menu by typing pip3 --help if you get stuck.

If you don't know how to use PiP, simply run its help command to display helpful command options and how to use them.

pip3 --help
pip install --help

You should see helpful commands and how to use them, as shown below

Usage:   
  pip  [options]

Commands:
  install                     Install packages.
  download                    Download packages.
  uninstall                   Uninstall packages.
  freeze                      Output installed packages in requirements format.
  list                        List installed packages.
  show                        Show information about installed packages.
  check                       Verify installed packages have compatible
📝Good to KnowCreating a virtual environment is always a good idea when working with Python projects.

Generally, the PiP package installer is used within Python virtual environments where each environment is isolated for specific projects.

Advertisement

After each project is done, it can be discarded easily.

You want to create a Pip virtual environment within your home folder or directory for this post. Creating a virtual environment isolates Python packages for a specific project, preventing conflicts between different project requirements on your Ubuntu system.

Simply run the command below to create a Python 3 virtual environment called confidential.

First, install the Python virtual environment module by running the commands below:

Advertisement
sudo apt install python3-venv

Then, create a new environment called confidential

python3 -m venv ~/confidential

Simply activate the environment by running the commands below:

source ~/confidential/bin/activate

Within this specific environment, you can begin installing packages via PiP to use Python 3.

For example, to install a Python package called python-openstackclient, simply run the commands below:

Advertisement

Example:

pip3 install python-openstackclient

That should install the python-OpenStack client package to use with Python 3.

To upgrade packages via PiP, simply run the commands below:

pip3 install --upgrade python-openstackclient

To uninstall packages via PiP, simply run the commands below:

pip3 uninstall python-openstackclient

When you finish the Python project, simply run the deactivate command to return to your standard shell.

deactivate

That's it!

Conclusion:

Installing PiP on Ubuntu 18.04 or Ubuntu 16.04 allows you to install and manage Python packages. PiP is a tool that helps you add and remove Python software. If you encounter any errors during installation, please report them in the comment form below.

Was this guide helpful?

Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

Advertisement

📚 Related Tutorials

How to Install Python on Ubuntu Linux
Ubuntu Linux How to Install Python on Ubuntu Linux
How to Install GNOME Desktop on Ubuntu 24.04
Ubuntu Linux How to Install GNOME Desktop on Ubuntu 24.04
How to Install KDE Desktop on Ubuntu 24.04
Ubuntu Linux How to Install KDE Desktop on Ubuntu 24.04
How to Uninstall Software in Ubuntu Linux
Ubuntu Linux How to Uninstall Software in Ubuntu Linux

2 Comments

Leave a Comment

Your email address will not be published. Required fields are marked *