How to Install Pip on Ubuntu 22.04


PIP is the short form of Python Package Installer. It is a useful tool for package management including installing, upgrading, and removing Python packages from your operating systems. PIP is an open-cross platform that can be installed on Linux distributions, including Ubuntu and Windows Operating Systems.

In this article, we will provide you practical method demonstrating the installation of PIP on Ubuntu 22.04.2.

How to Install PIP (Python Package Installer) on Ubuntu 22.04.2?

Following the steps given below will help you to install the PIP, a Python package installer, on Ubuntu 22.04.2 LTS.

Step 1: Install PIP via “apt”

The “apt” package manager is equipped with the latest packages such as PIP. The command provided in the following will install the PIP package on your Ubuntu machine:

sudo apt install python3-pip -y

Step 2: PIP Current Version

After installing the PIP package, running the command “pip3 –version” will display the currently installed version of PIP in your output:

pip3 --version

The current version of the PIP can be shown in the above output.

Step 3: Upgrade the PIP

You can use the command written below to upgrade the PIP to the latest version of the PIP package installer:

pip3 install pip -U

The above-mentioned command, successfully upgraded the PIP to the latest version 23.1.2

Step 4: Confirmation of PIP Updated Version

Run the “pip3 –version” command to display whether the PIP is upgraded to the latest version or not:

pip3 --version

Step 5: Update System Files

Run the “update” command from your Ubuntu terminal to save and apply the changes with the new package files and libraries:

sudo apt update

According to the above-mentioned output message, all the packages are up to date.

How to Install Python Package on Ubuntu 22.04.2 Using PIP Installer?

The following procedural instructions will guide you through the installation of a Python-based package.

Step 1: Install Package Using PIP Installer

Once you have installed and upgraded the PIP package installer, install packages from the Python repository. For example, the “Pandas” can be installed using the following command:

pip3 install pandas

In the above output result, you can see that the command successfully installed the “Pandas” and some other relevant packages.

Step 2: List the PIP Packages

Execute the following command will return a list of all available packages that can be installed using PIP:

pip3 list

How to Uninstall Package From Ubuntu 22.04.2 Using PIP Installer?

The steps given below will uninstall the Python Packages from Ubuntu 22.04.2.

Step 1: Uninstall Package Using PIP

The PIP also allows you to uninstall the package from your Ubuntu machine. The following command is here for your reference:

pip3 uninstall pandas==2.0.3

You can use the same command without mentioning the version to uninstall the package:

pip3 uninstall pandas

It can be observed from the above “pip3 uninstall” commands that both worked properly while removing the package from your Ubuntu machine.

Bonus Tip

If you want to learn more about the PIP package installer, run the “–help” command from the Ubuntu terminal:

pip3 --help

Finally, we have completed the installation of the PIP package installer and illustrated its usage through practical examples.

Conclusion

The PIP can be installed in Ubuntu to manage Python packages. Executing the “sudo apt install python3-pip” will install the PIP package on your Ubuntu 22.04.2 LTS. Additionally, you can upgrade the PIP package using “pip3 install pip -U”. The main objective of this article was to provide you with the knowledge and skills to install and manage Python-based packages.

Print Friendly, PDF & Email
Categories