Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Install pip on Debian

Install the Python package manager with APT, or with the get-pip.py script in a virtual environment.

VPS and Cloud Servers1 min read10 screenshots

Method 1: APT

Step 1: Update the package index

sudo apt update
Updating the package index

Step 2: Install pip for Python 3

sudo apt install python3-pip -y
Installing python3-pip

Step 3: Check it

pip3 --version
The pip version

On Debian 12 and newer, pip refuses to install packages for the whole system (the error says externally-managed-environment). Use a virtual environment (see below) or pipx.

Method 2: The get-pip.py script

Use this when you need a newer pip than the one in APT.

Step 1: Install the prerequisites

python3 --version && curl --version
sudo apt install python3 curl

Step 2: Install the venv module

sudo apt install python3-venv
Installing python3-venv

Step 3: Create a virtual environment

mkdir myproject && cd myproject
Creating the project folder
python3 -m venv venv
Creating the virtual environment
source venv/bin/activate
Activating the environment

Step 4: Download and run get-pip.py

curl -O https://bootstrap.pypa.io/get-pip.py
Downloading get-pip.py
python get-pip.py
Installing pip

Step 5: Check it

pip3 --version
The pip version

Use pip

pip install package_name
pip list
pip uninstall package_name

Leave the virtual environment with deactivate.

Quick recap

  • sudo apt install python3-pip installs pip.
  • Use a virtual environment for your projects.
  • get-pip.py is the way to get a newer pip.