Cannot import pip installed package as non-root user

Solution Verified - Updated -


  • 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


  • Red Hat Enterprise Linux
  • Red Hat Software Collections

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content