How to Install the Pip Package Manager on AlmaLinux

Posted on by Freddy Reese
Reading Time: 4 minutes

This article looks into what Pip for Python is, and how to install it on the AlmaLinux operating system along with best practices in regard to its usage.

What is Python?

Python is an open-source, high-level general programming language first released in 1991. It is one of the most popular and powerful programming languages of today. It is heavily used for scientific, computer vision, machine learning, data science, scripting, cloud automation, and many other purposes. 

A large community develops many powerful Python libraries such as NumPY, Matplotlib, PyTorch, Keras, TensorFlow, and many more. In recent years, it has seen massive adoption by the scientific and data community due to its simple syntax and powerful libraries, making it an amazing programming language to have in your toolset.

What is Pip?

Pip is the main package manager to install additional packages to extend Python's capability. It is an essential Python tool, and newer versions started shipping it by default. The main repository Pip gets its information from is called Python Package Index, but it is possible to fetch packages from supplementary sources. 

How to Install Pip on AlmaLinux?

If you have Python 3 versions installed, it should already come with Pip manager. Here are the steps on how to check for that AlmaLinux and install it if it’s needed.


First, ensure AlmaLinux is updated. The sudo dnf check-update command checks if there are any available updates for the system. This command requires root privileges, hence the need to invoke sudo before it.

[freese@vm ~]$ sudo dnf check-update
Last metadata expiration check: 0:42:11 ago on Mon 23 Jan 2023 08:07:05 PM EST.

Then, it will list out any outdated packages, if any exist. You can then use the sudo dnf update command to update them all at once. In this case, the system is already up to date and ready for the next part.

[freese@vm ~]$ sudo dnf update
Last metadata expiration check: 0:44:49 ago on Mon 23 Jan 2023 08:07:05 PM EST.
Dependencies resolved.
Nothing to do.
Complete!

There is a good chance that the Python and Pip manager will already be installed on your system. Python and Pip use the python3 --version and pip --version commands to confirm the installation status and current versions.

[freese@vm ~]$ python3 --version
Python 3.6.8

[freese@vm ~]$ python3 -m pip --version
pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)

The output confirms this AlmaLinux image server has Python installed and is ready to go. Since Python 3.6 has reached the end-of-life, you can use the following command to see which versions are available for your system.

sudo dnf -q module list python*

Here is how the output looks.

[freese@vm ~]$ dnf -q module list python*
AlmaLinux 8 - AppStream
Name                	Stream         	Profiles              	Summary
python27            	2.7 [d][e]     	common [d]            	Python programming language, version 2.7
python36            	3.6 [d][e]     	build, common [d]     	Python programming language, version 3.6
python38            	3.8 [d]        	build, common [d]     	Python programming language, version 3.8
python39            	3.9 [d]        	build, common [d]     	Python programming language, version 3.9

Alma Linux 8 - PowerTools
Name                	Stream         	Profiles              	Summary
python38-devel      	3.8            	build, common         	Python programming language, version 3.8
python39-devel      	3.9            	build, common         	Python programming language, version 3.9

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

To install Python 3.9, run the following command.

sudo dnf install python39 -y

Once you receive the completed install message, check the Python and Pip versions with the following commands.

[freese@vm ~]$ python3.9 --version
Python 3.9.13

[freese@vm ~]$ python3.9 -m pip --version
pip 20.2.4 from /usr/lib/python3.9/site-packages/pip (python 3.9)

Since Python 3.4, Pip comes with most Python install binaries, and the output above shows it pulled the pip install package also. In case you are missing this, you can install Pip using the following command for Python 3.9.

[freese@vm ~]$ sudo dnf install python39-pip
Last metadata expiration check: 1:35:39 ago on Tue 24 Jan 2023 04:41:44 AM EST.
Package python39-pip-20.2.4-7.module_el8.6.0+2780+a40f65e1.noarch is already installed.
Dependencies resolved.
Nothing to do.
Complete!

Tips For Using Pip More Effectively on AlmaLinux

Three important things to note about Pip:

  1. You should always use it with the -m flag, such as python3 -m pip list or python3.9 -m pip list, so that you install a Pip package for the specified interpreter, as recommended by their official documentation
  2. Do not try to update Pip with commands such as pip install --upgrade pip or pip install -U pip since your distribution package manager handles the updates. More information about this and some other useful tips are in various GitHub issue threads.
  3. Check out the manual (man) pages with man pip, which has very in-depth information to master Pip. The python3 -m pip --help command prints some of the most important and immediate commands you will need when using Pip on your terminal.
[freese@vm ~]$ python3 -m pip --help

Usage:
  /usr/bin/python3 -m pip <command> [options]

Commands:
  install                 	Install packages.
  download                	Download packages.
  uninstall               	Uninstall packages.
  freeze                  	Output installed packages in requirements format.
  list                    	List installed packages.
  show                    	Show information about installed packages.
  check                   	Verify installed packages have compatible dependencies.
  config                  	Manage local and global configuration.
  search                  	Search PyPI for packages.
  cache                   	Inspect and manage pip's wheel cache.
  wheel                   	Build wheels from your requirements.
  hash                    	Compute hashes of package archives.
  completion              	A helper command used for command completion.
  debug                   	Show information useful for debugging.
  help                    	Show help for commands.

Conclusion

This guide showed what Python and its most popular package manager Pip is, and how to configure them properly on AlmaLinux. It also shows some useful commands and best practices that you should follow when working with this simple but powerful programming language.

If you need an AlmaLinux server for your next Python project using Pip, look no further than Liquid Web’s VPS Hosting, Cloud Dedicated Servers, or Dedicated Servers. The teams are available 24/7/365 to assist with sales and support. Contact our sales team to get your server today.

FAQs About Pip and AlmaLinux

Do I already have Pip installed?

Do I need to use Pip?

What is AlmaLinux?

Avatar for Freddy Reese

About the Author: Freddy Reese

Freddy works in the Liquid Web Managed Hosting Support team with a strong passion for all things related to Linux administration, cybersecurity, and aviation. In his free time, he likes to keep up with the latest news on topics ranging from fusion to space technologies. His hobbies include automating all kinds of stuff using Arduino/Raspberry Pi, learning and flying around in flight simulators, playing with his dog Chupko, swimming at nearby beaches, and staying physically and mentally healthy by going to the gym.

Latest Articles

Blocking IP or whitelisting IP addresses with UFW

Read Article

CentOS Linux 7 end of life migrations

Read Article

Use ChatGPT to diagnose and resolve server issues

Read Article

What is SDDC VMware?

Read Article

Best authentication practices for email senders

Read Article