How to install PIP on Debian?

Pip is an essential tool for Python developers, to streamline installation and management of Python packages. On Debian systems, you may install Pip via multiple methods. This post shows how to install PIP on Debian.

Table of Contents
  1. What is PIP?
  2. How to Install PIP on Debian?
  3. Using PIP on Debian

What is PIP?

PIP is the default package manager for Python, used to install, upgrade, and manage Python- Packages, libraries, and dependencies. It helps users to easily access and install pre-built Python packages from the Python Package Index (PyPI), making development more efficient.

Features of PIP:

  • Easy Installation: Install Python libraries with a single command.
  • Dependency Management: Automatically installs package dependencies.
  • Version Control: Allows installing specific versions of a package.
  • Requirements Files Support: Install multiple packages at once using requirements.txt.
  • Cross-Platform: Works on Windows, Linux, and macOS.

How to Install PIP on Debian?

There are multiple methods to install PIP on a Debian system, and this guide will walk you through them one-by-one as follows.

Method 1: Installing Pip Using the APT Package Manager

The Advanced Package Tool (APT) is the default package management system for Debian-based systems, offering a straightforward method to install Pip.

1. Update the Package Index:

$> sudo apt update
update package list in debian

2. Install Pip for Python 3:

The latest version of Debian (as of this writing), Debian 12 comes with Python 3 pre-installed, if you are working with any of the older version or don’t have python installed on your system, visit here.

To install Pip for Python 3, use:

$> sudo apt install python3-pip 
Install Pip for python in debian

3. Verify the Installation:

After installation, confirm that Pip is installed correctly, using:

$> pip3 --version 

You should see output indicating the Pip version and its association with Python 3.

pip verifying installation in debian

Method 2: Installing Pip Using the get-pip.py Script

If you prefer or require the latest version of Pip, which is unavailable in the APT repositories, you can use the get-pip.py script.

1. Install Prerequisites:

Ensure you have curl installed:

$> sudo apt install curl
prerequisites, install curl

2. Download the get-pip.py Script:

The get-pip.py Script is a Python Script designed to install PIP on a system that has python installed on it.

Use curl to download the installation script, as follows:

$> curl -O https://bootstrap.pypa.io/get-pip.py
Download get-pip.py script

3. Run the Installation Script:

Execute the script using Python 3, as below:

$> sudo python3 get-pip.py --break-system-packages
run installation script

4. Verify the Installation:

After installation, confirm that Pip is installed correctly, using:

$> pip3 --version
verify installation

Using Pip on Debian:

With Pip installed, you can manage Python packages efficiently.

1. Install a Package, using:

$> pip3 install [PACKAGE NAME]

2. List Installed Packages, using:

$> pip3 list

3. Upgrade a Package, using:

$> pip3 install --upgrade [PACKAGE NAME]

4. Uninstall a Package, using:

$> pip3 uninstall [PACKAGE NAME]

Replace [PACKAGE NAME] with the name of the package.

This post shows How to install PIP on Debian, using straightforward methods, whether you choose the APT package manager or the get-pip.py script.