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:
- 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.
- 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.
- 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.
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?
- ChatGPT Integration — How to Create a Plugin for ChatGPT
- Stable Diffusion AI Image Generator (SDXL) — Using the Web UI
- How to Install VMware Tools on Ubuntu: Step-by-Step Guide
- How to Install WordPress on Linux (AlmaLinux)
- What is CentOS? Everything You Need to Know
- Virtual Desktop Environment — Configuring Kasm Workspaces
Our Sales and Support teams are available 24 hours by phone or e-mail to assist.