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

Install and Upgrade pip to the Latest Version

pip is the package manager of Python. Install it, upgrade it, and use it to manage packages.

How-To Guides2 min read

What pip is

Python is a popular programming language. pip is the tool that installs and manages Python packages (libraries) such as NumPy or Flask.

Install pip

On Debian and Ubuntu:

sudo apt update
sudo apt install python3 python3-pip

Check the installation:

pip3 --version

or:

pip --version

For help:

pip3 help

Upgrade pip

Run:

python -m pip install --upgrade pip

On Linux you may need python3 -m pip install --upgrade pip. Inside a virtual environment this works without sudo.

Downgrade pip

Install an older version by name, for example 18.0:

python -m pip install pip==18.0

Check the result with pip3 --version.

Manage packages with pip

Install a package

pip3 install numpy

(or pip install numpy)

Update a package

pip3 install --upgrade numpy

Remove a package

pip3 uninstall numpy

List installed packages

pip3 list

Install from a file

pip3 install -r requirements.txt

Tips

  • Use a virtual environment (python3 -m venv venv) for each project.
  • On new Debian and Ubuntu versions, pip may refuse to install system-wide with the message "externally-managed-environment". Use a virtual environment or pipx.
  • Keep pip updated.

Quick recap

  • sudo apt install python3-pip installs pip.
  • python -m pip install --upgrade pip upgrades it.
  • Use virtual environments for projects.