How to install pip on Red Hat Enterprise Linux?

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux 6
  • Red Hat Enterprise Linux 7
  • Red Hat Software Collections

Issue

Is the pip available in RHSCL for RHEL6 and RHEL7?

Resolution

WARNING: Using pip as root user can OVERWRITE your system python libraries, use a virtualenv as a normal user whenever possible to avoid issues when packages are upgraded using Red Hat provided RPM's.

RHEL 6

Python packageCorresponding pipLocation of pip
python.x86_64python-pip.noarch*epel
rh-python34rh-python34-python-piprhel-server-rhscl-6-rpms
rh-python35rh-python35-python-piprhel-server-rhscl-6-rpms
rh-python36rh-python36-python-piprhel-server-rhscl-6-rpms
python34*python34-pip*epel

RHEL 7

Python packageCorresponding pipLocation of pip
python.x86_64python2-pip.noarch*epel
python3.x86_64python3-pip.noarchrhel-7-server-rpms
python27-pythonpython27-python-piprhel-server-rhscl-7-rpms
rh-python34rh-python34-python-piprhel-server-rhscl-7-rpms
rh-python35rh-python35-python-piprhel-server-rhscl-7-rpms
python32*python34-pip*epel

Note

  • packages from the epel repository are not supported by Red hat.
  • applications or software installed via pip are not from Red Hat and do not fall under the scope of support

  • Here are some example steps for using pip from RHSCL on RHEL7:
    1. Install the pip from SCL as root

       # subscription-manager repos --enable rhel-server-rhscl-7-rpms
       # yum install python27-python-pip
      
    2. Switch to a normal user and check the pip

       $ scl enable python27 bash
       $ which pip
       $ pip -V
      

Note: When you close the current bash you will need to run the scl enable command again as the change is not persistent, more info about that can be found here

Diagnostic Steps

Verify the following commands:

$  rpm -qf /bin/scl
scl-utils-20130529-18.el7_4.x86_64

$ scl -l
python27

$ scl enable python27 bash

$which pip
/opt/rh/python27/root/usr/bin/pip

$ pip -V
pip 8.1.2 from /opt/rh/python27/root/usr/lib/python2.7/site-packages (python 2.7)
SBR
Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.