Installing pip on CentOS Stream or Red Hat Enterprise Linux makes it possible to install Python packages from PyPI when the required module or tool is not available from the distribution repositories. That is a common next step when bootstrapping developer tooling, creating isolated project environments, or testing Python packages that ship faster than the base operating-system package set.
On current RHEL-family releases, pip is delivered through dnf and RPM packages rather than bootstrapped with get-pip.py. The package name follows the interpreter stream: current CentOS Stream 10 and RHEL 10 use python3-pip for the default Python 3.12 runtime, while current RHEL 9 also provides python3-pip for the default Python 3.9 runtime together with versioned packages such as python3.11-pip and python3.12-pip for newer interpreter streams.
Installing pip does not make system-wide third-party installs the safe default. Red Hat warns that running pip as root for system-wide PyPI installs can override RPM-managed libraries and break supported package content, so routine package installs should go into a virtual environment or a user-local site, and RHEL hosts still need access to the required repositories before the package install can succeed.
Steps to install pip on CentOS Stream or Red Hat Enterprise Linux:
- Install the pip RPM that matches the Python interpreter stream that will own package installs.
$ sudo dnf install --assumeyes python3-pip CentOS Stream 10 - BaseOS 1.8 MB/s | 9.4 MB 00:05 CentOS Stream 10 - AppStream 421 kB/s | 3.5 MB 00:08 CentOS Stream 10 - Extras packages 3.8 kB/s | 10 kB 00:02 Dependencies resolved. ================================================================================ Package Architecture Version Repository Size ================================================================================ Installing: python3-pip noarch 23.3.2-7.el10 appstream 3.2 M Transaction Summary ================================================================================ Install 1 Package Downloading Packages: python3-pip-23.3.2-7.el10.noarch.rpm 690 kB/s | 3.2 MB 00:04 Running transaction Installing : python3-pip-23.3.2-7.el10.noarch 1/1 Installed: python3-pip-23.3.2-7.el10.noarch Complete!
Current CentOS Stream 10 and RHEL 10 use python3-pip for the default interpreter. Current RHEL 9 also provides python3-pip for the default Python 3.9 stream, while python3.11-pip and python3.12-pip install pip for those alternate interpreter streams. On RHEL 8, use the versioned package that matches the installed interpreter stream, such as python3.11-pip or python3.12-pip.
- Verify that the installed pip module is bound to the intended interpreter before using it for package installs.
$ python3 -m pip --version pip 23.3.2 from /usr/lib/python3.12/site-packages/pip (python 3.12)
Use the matching interpreter command on versioned streams, such as python3.11 -m pip --version or python3.12 -m pip --version, so the reported path matches the interpreter that owns the RPM package.
Current RHEL 9 systems that use python3-pip report the default Python 3.9 path here, while current CentOS Stream 10 and RHEL 10 report the default Python 3.12 path.
Related: How to check Python version
- Confirm that the packaged command set is available and still owned by RPM.
$ 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. inspect Inspect the python environment. $ rpm -q python3-pip python3-pip-23.3.2-7.el10.noarch
Do not use pip as root for routine interpreter-wide third-party installs on RHEL hosts. Use a virtual environment or a non-root install target instead so PyPI packages do not overwrite RPM-managed libraries.
On versioned streams, query the matching RPM name such as rpm -q python3.11-pip or rpm -q python3.12-pip.
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.
