Debian

Install PIP on Debian 11


This tutorial explains how to install PIP for Python 3 and Python 2 on Debian 11 and other Debian-based Linux distributions, such as Ubuntu.

PIP (Pip Installs Packages) is a Python written packages manager used to install software from repositories. If you don’t know PIP, you can think of it as a similar tool to the Debian apt command. Basically, the syntax to install packages using the PIP packages manager is pip install <package>.

This tutorial covers PIP installation, both for Python 3 and Python 2, despite Python 2 isn’t supported on default by Debian repositories. This article also explains how to get both PIP versions with just a command. Additionally, I added instructions to keep PIP up-to-date and to use it to install the software.

Installing PIP3 on Debian 11

To begin, update your package repositories by running the apt command, followed by the update option as shown below:

sudo apt update

You can install Python (3) also using the apt command followed by the install option as shown below:

To check your Python 3 version, you can run the command below:

python3 --version

Then, install PIP3 by running the following command:

sudo apt install python3-pip

To check your PIP version, run the following command:

pip --version

As you can see, PIP for Python 3 is installed.

Installing PIP2 on Debian 11

As discussed, while Python 2 is still available for Debian 11, it doesn’t support PIP2 in the packages manager. However, you can get it installed by following the steps explained below:

Use the apt command to install the python2 package as shown below:

sudo apt install python2

Once Python 2 is installed, download and execute the pip installer for Python 2 by running the following command:

wget https://bootstrap.pypa.io/pip/2.7/get-pip.py python2 get-pip.py

You can check your Python 2 version by executing the command below:

python2 --version

To check both Python 2 and pip versions run the following command:

python2 -m pip --version

As you can see, PIP for Python 2 is installed.

Keep PIP Updated

 You can use the command shown in the following screenshot to keep PIP up-to-date:

python3 -m pip install --upgrade pip setuptools wheel

Now, PIP and its components are up to date.

Using PIP to Install Software

As mentioned previously, PIP is a packages manager used to install the Python written software. The syntax to install packages is pretty simple. Just execute PIP followed by the install option and the package’s name. The syntax to install a package is the same as with the apt command.

pip install <package>

For example:

pip install translator

As you can see, the package was properly installed.

You can find available projects to download at https://pypi.org.

To upgrade packages using PIP, run the following command:

python3 -m pip install --upgrade

In this case, the software was already up-to-date.

Uninstalling Packages Using PIP

To remove packages using PIP, use the following syntax. When asked for confirmation, press Y.

pip uninstall <Package>

To remove the translator package, run the following command. When asked for confirmation, press Y.

pip uninstall translator

And as you can see in the screenshot below, the package was properly removed:

Conclusion

Thank you for reading this tutorial explaining how to install PIP on Debian 11 Bullseye. As you can see, installing both PIP for Python 3 and Python 2 is pretty easy. Any Linux-level user can get it done by following a few steps explained in this article.

Despite this tutorial showing PIP for Python 2 installation, it isn’t recommended. Instead, use Python 3. Also, remember to keep PIP and its components up-to-date using the commands explained for that purpose.

Thank you again for learning from Linux Hint. Keep following us for additional tips and tutorials.

About the author

David Adams

David Adams is a System Admin and writer that is focused on open source technologies, security software, and computer systems.