How to Install Pip on Debian 11

Python is one of the most popular programming languages, and Pip is a package manager written in Python. If you don’t have much idea about Pip, you can think of Apt that we use to download packages but it’s used to download packages for Python-based packages.

We will be covering how you can install Pip in Debian 11/10 but this is also applicable to other Debian-based Linux distros such as Ubuntu, Pop_OS, Linux Mint, and many others. but before that let’s get out basics straight on Pip.

What is Pip? Why it is Used?

Pip stands for Pip Installs Python. Pip is used for installing various modules for the Python programming language. It is a replacement for easy_install which was found in Python setup tools. To make things easier to understand, it shares similar syntax to other package managers such as Apt.

Pip not just only shares the syntax from popular package managers but also avails you of similar functionality such as it handles dependencies automatically and also the option to load modules directly from version control systems such as Git.

Installing Pip on Debian 11

After covering the basics related to Pip, now we can move forward with the installation part of Pip. We are going to cover the installation of Pip3, Python2, and Pip2. So let’s start with the installation of Pip3 on Debian 11.

Installation of Pip3

As Python 3 is pre-installed on Debian 11, we don’t need to install it on our system. To check the installed version of Python 3, use the following command:

 python3 –version 

1. python3 --version

But somehow, you are getting an error, you can download Python 3 by the given command:

 sudo apt install python3 

1.1 sudo apt install python3

To install Pip3, use the following command:

 sudo apt install python3-pip -y 

1.2 sudo apt install python3-pip -y

To check whether we have successfully installed Pip3 on our system, use the following command which will show the version of installation:

 pip –version 

1.3 pip --version

If you get output with the version number and directory of the installation, you have successfully installed Pip3 on your system.

Installation of Pip2 and Python2

As we want to run Pip2, we are required to install Python 2. Debian is not shipped with Python 2 so we are required to install it manually. Use the following command to install Python 2 on your Debian:

 sudo apt install python2 -y 

2. sudo apt install python2 -y

Once we are done with the installation of Python 2, we can easily check its version by the following command to cross-check whether we have installed Python 2 without any errors or not:

 python2 –version 

2.1 python2 --version

After installation of Python 2, let’s download and install the Pip installer by the following command:

 sudo curl https://bootstrap.pypa.io/pip/2.7/get-pip.py –output get-pip.py 

 sudo python2 get-pip.py 

2.2 sudo curl

Let’s check the installed version of Pip2 by the following command:

 pip2 –version 

2.3 pip2 --version

Using Pip for installation and Deletion of Modules

After we are done with the installation part of Pip, we are going to show you how to download modules and also how to delete them. Let’s start with installing modules.

Installing Modules Using Pip

You will find various projects and modules from the Python package index. We are going to download the translator using Pip. Use the following command to install the translator:

 pip3 install “translator” 

3. pip3 install translator

Pip3 is used to download packages with the base of Python 3, if you want to install modules in Python 2, you will have to use pip2 instead of pip3.

Updating Modules Using Pip

As we regularly update our packages on Debian using sudo apt update to update our repositories and download the latest packages. Similarly, we are also required to update packages in Pip.

Use the following command to update modules in Pip:

 python3 -m pip install –upgrade translator 

3.1 python3 -m pip install --upgrade translator

Change the Python version and module name accordingly update packages that are using Python 2.

Uninstalling Modules Using Pip

If you no longer require a particular module, you can easily remove it by the following syntax:

 pip3/2 uninstall “<Package Name>” 

We are going to remove the translator package as we no longer need it on our system by the following command:

 pip3 uninstall “translator” 

3.2 pip3 uninstall translator

It will ask for your permission for deleting the requested module. Enter “y” and hit Enter. It will remove the requested packages.

Uninstalling Pip from Debian

If you no longer require Pip on your system, you can easily remove it from your system by following the given instructions.

Uninstalling Pip3

To uninstall Pip3 from your system, use the following command:

 sudo apt remove –auto-remove python3-pip 

4. sudo apt remove --auto-remove python3-pip

Uninstalling Pip2

To uninstall Pip2, use the following command:

 sudo pip uninstall pip 

4.1 sudo pip uninstall pip

Frequently asked questions related to Pip

Does Debian come with pip?

No, Debian does not come pre-installed with Pip. You have to install Pip manually.

How do I know if pip is installed?

We can easily check by getting the version number. If Pip is installed, it will show the version number. If now, it will through an error. You can check the version number of Pip3 by this command: pip –version

Conclusion

Pip can be a powerful tool especially if your work heavily depends on Python. By following this guide, you can easily configure, use, remove and install pip in Debian 11 and other Debian-based distros. 

Related

How to Uninstall Debian Package

Ubuntu Review

Sagar Sharma
Sagar Sharma

Sagar always uses Linux to its core and loves to write the technical side of system administration! While he's not writing for GeniusGeeks, you can find him writing for core linux blogs like IT'SFOSS.com and LinuxHandBook.com

Articles: 56