I am trying to install the python-oath2 library in my Python virtual environment running python 2.7.3 via Pythonbrew on a Dreamhost shared hosting file.
First I downloaded the tarball on this link and then extracted the file contents. https://github.com/simplegeo/python-oauth2
I then cd
ed into the extracted folder and then ran
python setup.py build
python setup.py install
This produced a new file oauth2-1.5.211-py2.7.egg
in the directory
/home/davidfaux/.pythonbrew/pythons/Python-2.7.3/lib/python2.7/site-packages
When I import oauth2
in the Python interpreter, no errors surface. However, when I call import oauth2
in views.py of my Django application, an error is raised:
Could not import myapp.views. Error was: No module named oauth2
I tried restarting Passenger (touch tmp/restart.txt
), restarting Python (pkill python
), and re-sshing into the server. I also tried pb switch 2.7.3
to ensure that I was using the right version of Python. Why doesn't Django let me import oauth2
if importing it works in the Python interpreter?
The process running your django application is either:
PYTHONPATH
for packages, and it cannot find it.*.pyc
files using something like this - find . -name *.pyc -exec rm {} \;
and restart your backend server (passenger).