Linux Commands

How to Install Python PIP on Rocky Linux 9

PIP is mainly used to install new Python packages/libraries/modules from the official Python PyPi package repository on your computer.

In this article, we will show you how to install PIP on the Rocky Linux 9 operating system. We will also show you how to upgrade PIP to the latest version of Rocky Linux 9.

Topic of Contents:

  1. Updating the Rocky Linux 9 Package Repository Cache
  2. Installing PIP on Rocky Linux 9
  3. Checking If PIP is Working on Rocky Linux 9
  4. How to Upgrade PIP to the Latest Version in Rocky Linux 9
  5. How to Use PIP to Manage the Python Packages/Modules
  6. Conclusion

Updating the Rocky Linux 9 Package Repository Cache

First, update the package repository cache of Rocky Linux 9 with the following command:

$ sudo dnf makecache

The package repository cache of Rocky Linux 9 should be updated.

Installing PIP on Rocky Linux 9

Python PIP is available in the official package repository of Rocky Linux 9. So, it is easy to install.

To install Python PIP on Rocky Linux 9, run the following command:

$ sudo dnf install python3-pip

To confirm the installation, press Y and then press <Enter>.

Python PIP is being downloaded from the official package repository of Rocky Linux 9. It takes a few seconds to complete.

If you see the following prompt, press Y and then press <Enter> to accept the GPG key of the Rocky Linux 9 package repository.

Python PIP should be installed.

Checking If PIP is Working on Rocky Linux 9

To check whether you can access PIP and if PIP is working on Rocky Linux 9, run the following command:

$ pip --version

If PIP is accessible and it’s working, the installed version number of PIP should be printed. At the time of this writing, Rocky Linux 9 has PIP 21.2.3 in its package repository.  Newer versions of PIP may be available. So, you might want to upgrade it to the latest version. We will show you how to do that in the next section of this article.

How to Upgrade PIP to the Latest Version in Rocky Linux 9

To check whether a newer version of PIP is available and upgrade PIP to the latest version in Rocky Linux 9, run the following command:

$ pip install --upgrade pip

PIP should be upgraded to the latest version if newer versions of PIP is available in the PyPi package repository.

To check the version number of PIP after the upgrade, run the following command. As you can see, PIP was upgraded to 23.1.2 from 21.2.3. By the time you read this article, you may get a newer version of PIP than 23.1.2.

$ pip --version

How to Use PIP to Manage the Python Packages/Modules

If you want to know more about PIP and how to use it, we recommend you to read the article on How to Manage the Python Packages with PIP. In this article, we showed you how to install the new Python packages, list the installed Python packages, uninstall the Python packages with PIP, and so on.

Conclusion

We showed you how to install Python PIP on Rocky Linux 9. We also showed you how to upgrade PIP to the latest version in Rocky Linux 9.

About the author

Shahriar Shovon

Freelancer & Linux System Administrator. Also loves Web API development with Node.js and JavaScript. I was born in Bangladesh. I am currently studying Electronics and Communication Engineering at Khulna University of Engineering & Technology (KUET), one of the demanding public engineering universities of Bangladesh.