0

I have a server running RHEL 6 with Python 2.6.6. I am having trouble using pip with Python as a non-root user.

I am able to install pip packages and use them as root. However, when I try to run pip as a non-root user, I get this error:

[~]$ pip install requests
Traceback (most recent call last):
  File "/usr/bin/pip", line 7, in <module>
    from pip import main
ImportError: No module named pip

Likewise, while I can use requests for example after installing as root, I cannot then use it as a non-root user.

[~]$ python
Python 2.6.6 (r266:84292, May 22 2015, 08:34:51)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-15)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named requests
>>>

I am running pip 8.1.1:

[~]# pip --version
pip 8.1.1 from /usr/lib/python2.6/site-packages (python 2.6)
2
  • I checked to see that the site-packages folder has read permission by the user and it does. – Jake Jun 2 '16 at 18:24
  • You must have some custom version of pip. On RHEL 6 you should be using python-pip from EPEL, which is currently at version 7.1.0-1. It also sounds like your user and root are not seeing the same site-packages, which could indicate a custom compiled version of Python. What is the output of rpm -qf $(which python) as both your user and root? – carlwgeorge May 29 '17 at 17:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.