Cannot import pip installed package as non-root user

Solution Verified - Updated -

Issue

  • Unable to import a python module as non-root that was installed using pip.
[root@localhost] # pip install django
[root@localhost] # su - testuser

[testuser@localhost] # python -c 'import django'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named django
  • Apache HTTPD mod_wsgi returns 500 Internal Server Error caused by import failure in python
[Wed Sep 21 17:14:50 2016] [error] mod_wsgi (pid=14834): Exception occurred processing WSGI script '/opt/graphite/conf/graphite.wsgi'.
[Wed Sep 21 17:14:50 2016] [error] Traceback (most recent call last):
[Wed Sep 21 17:14:50 2016] [error]   File "/opt/graphite/conf/graphite.wsgi", line 5, in <module>
[Wed Sep 21 17:14:50 2016] [error]    import django
[Wed Sep 21 17:14:50 2016] [error] ImportError: No module named django

Environment

  • Red Hat Enterprise Linux
  • Red Hat Software Collections

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In