PIP is an essential package manager for Python that simplifies the installation and management of Python libraries and packages. Whether you’re a beginner or an experienced developer, PIP streamlines the process of adding new packages to your Python environment. Installing PIP on Ubuntu ensures you have the necessary tools to handle Python packages with ease, allowing you to focus on your projects.

This guide will show you how to install PIP on Ubuntu in five simple steps, so you can start managing Python packages right away.
Pre-requisites
- Ubuntu 24.04 or newer installed
- A user with sudo privileges
- Python 3 installed
- System updated
Install Python3
on Ubuntu Before Installing PIP
Before installing PIP on your Ubuntu server, you need to ensure that Python is installed. Python is available in the default APT repositories for Ubuntu, but it may not always be the latest version. If you want to install the latest or a specific version, you can use the deadsnakes PPA. This method allows you to install custom Python versions on your system.
Follow these steps to install Python using the PPA before installing PIP:
- Check if Python is already installed
python3 --version
If Python is installed, it will display the version number. If it’s not installed, follow the steps below to install Python.
- Add the
deadsnakes
PPA to your server sources
sudo add-apt-repository ppa:deadsnakes/ppa
- Update the server package index.
sudo apt update
- Install the latest version of Python
sudo apt install -y python3
- Install a specific Python version (Optional)
sudo apt install -y python3.8
- Verify the Python installation
python3 --version
Output:
Python 3.10.12
Check Out | Installing Docker on Ubuntu
Install PIP on Ubuntu
Once Python is installed on your Ubuntu server, you can proceed to install PIP, the package manager for Python. PIP is available in the default APT repositories for Ubuntu, but to install the latest version or manage Python packages effectively, follow these steps.
To install PIP on Ubuntu for Python 3, use the following command:
- Update the server package index
sudo apt update
- Install PIP for Python 3
sudo apt install python3-pip -y
- Verify PIP Installation
pip3 --version
Output:
pip 21.1.2 from /usr/lib/python3/dist-packages/pip (python 3.8)
You should see the installed PIP version and its path. If you get an error, make sure Python 3 is installed and your system packages are updated. If the problem continues, try reinstalling PIP.
Installing PIP in Virtual Environments
A virtual environment in Python is an isolated workspace that allows you to install specific packages without affecting your system-wide Python installation. It’s a useful tool for managing dependencies in different projects, especially when different projects require different versions of libraries. When you create a virtual environment, PIP is automatically installed, but sometimes you may need to manually install or upgrade it.
Here’s how you can install PIP in a virtual environment:
- Install
virtualenv
(if not already installed):
sudo apt install python3-venv
- Create a Virtual Environment:
python3 -m venv myenv
Note: Replace myenv
with your desired name for the virtual environment. This command will create a directory called myenv
, the isolated Python environment.
Activate the Virtual Environment:
source myenv/bin/activate
- Ensure PIP is Installed in the Virtual Environment:
pip --version
If PIP is not installed, you can manually install it within the virtual environment by running:
python -m ensurepip --upgrade
- Install Python Packages Using PIP in the Virtual Environment:
pip install requests
- Deactivate the Virtual Environment:
deactivate
Conclusion
You’ve successfully installed PIP on your Ubuntu system, enabling you to manage Python packages efficiently. This article covered the entire process, starting with verifying and installing Python, including using the deadsnakes PPA for custom Python versions. We then walked through updating your system and installing PIP for Python 3. With PIP now installed, you can easily manage your Python libraries and streamline your development process. Don’t forget to keep both Python and PIP up to date for the latest features and improvements.