Debian

How to Install and Remove Pip on Debian Bookworm ?

install pip

Pip is the package manager of Python. It allows us to install, update, and delete Python packages. To import packages from the Python Package Index, we need to install pip. When we download and install Python, it comes with built-in packages. A list of these packages can be seen at this link. Other than these built-in packages do not come with Python. These packages are available in the repository of the Python Package Index (PyPI).

This article will describe how to install pip3 in Debian 12 (Bookworm) systems.

How to Install Pip on Debian 12?

By using pip (Python Install Packages), install and use packages by importing them into our code using pip. To install pip3 for Python 3, we will execute the following steps:

Step 1: Launch Terminal

The first step is to launch Terminal. It can be launched either by using the shortcut Ctrl+Alt+T or by using an Application launcher.

All applications, system components, and files installed on the system are placed in the Application Launcher. The terminal can be launched by the application launcher by pressing the Activities button in the left corner of the screen. Then by typing “Terminal” in the search bar and selecting the Terminal icon:

The following screenshot shows how the Terminal looks like on Debian:

Step 2: Update apt Sources/Packages

It is highly recommended to make sure that all existing packages are up to date before installing any software. This is to avoid dependency issues. We can do that by running the following command as root or user with sudo privileges:

$ sudo apt update

Step 3: Install pip for Python 3

We will install pip3 and all of its dependencies for Python 3 by running the following command:

$ sudo apt install python3-pip

Press Y at the prompt to continue with the installation process:

After pressing Y, the installation will be completed. We can see from the above screenshot that the installation is completed.

Step 3: Verifying Installation

We can verify the installation by checking the version of pip3 by running the following command:

$ pip3 --version

How to Manage Python Packages Using pip3?

In this section, we will discuss a few pip3 commands to manage Python packages using pip3.

List

List command “list” installed Python packages in the pip repository. We can list the installed packages using the following command:

$ pip3 list

Install

If we need to install a pip3 package, which is not on the list, we can install that package. If we want to use “NumPy”, we can first check if it is installed in our pip3 repository by “pip3 list”:

We can see that Numpy is not installed. So, install Python packages/modules with all their dependencies by using the following command:

$ sudo apt install python3-numpy

From the above screenshot, it can be seen that the “numpy” package is installed. We can verify it by again checking the pip3 list:

We can see that the “numpy” package is now installed.

Show

If we need to display information about installed packages, we can use the ”show” command as follows:

$ pip3 show beautifulsoup4

How to Uninstall Pip3 on Debian 12?

In case, we need to completely uninstall pip3 and all its dependencies from our system, we can use the following command:

$ sudo apt purge python3-pip

Press Y to continue with the uninstallation. From the screenshot, we can see that pip3 is uninstalled. We can verify the uninstallation of pip3 by the following command:

From the above screenshot, it can be seen that pip3 is uninstalled successfully.

Conclusion

To install pip3 on Debian 12, use the “sudo apt install python3-pip” command. We can verify the installation by checking the version of pip3 by running the “pip3 –version” command. This article discussed the installation of pip3 on the Debian 12 (Bookworm) system using the default “apt” repository.

Similar Posts