I am getting an import error when trying to import twilio into a preexisting Django app. Here is what is happening/things I have tried:
The twilio package downloads to
(/home/ubuntu/.local/lib/python2.7/site-packages)
:
This directory contains request package plus urllib3. Both of these seem to be dependencies for twilio. However, I have no idea if these were downloaded as dependencies or if they were already there from the original structure. If so, I don't know if other parts of the program require them.
The working location is
(/var/www/polar/venv/lib/python2.7/site-packages):
I moved twilio to this location and that is when the import twilio error went away, but this is when I got an import error for the request package. So I copied the request package and put it here, then I got import urllib3 error, did the same thing and got another import error from a file from the other directory. So it seems that the first location has a lot of the dependencies for twilio and the other location does not.
My sys.path is:['',
'/usr/lib/python2.7',
'/usr/lib/python2.7/plat-x86_64-linux-gnu',
'/usr/lib/python2.7/lib-tk',
'/usr/lib/python2.7/lib-old',
'/usr/lib/python2.7/lib-dynload',
'/home/ubuntu/.local/lib/python2.7/site-packages',
'/usr/local/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages']
ImportError at / No module named twilio.rest Request Method: GET Request URL: XXXXXXXXXX Django Version: 1.11.4 Exception Type: ImportError Exception Value: No module named twilio.rest Exception Location: /var/www/polar/frontend/views.py in , line 24 Python Executable: /var/www/polar/venv/bin/python Python Version: 2.7.12 Python Path: ['/var/www/polar', '/var/www/polar/venv/lib/python2.7', '/var/www/polar/venv/lib/python2.7/plat-x86_64-linux-gnu', '/var/www/polar/venv/lib/python2.7/lib-tk', '/var/www/polar/venv/lib/python2.7/lib-old', '/var/www/polar/venv/lib/python2.7/lib-dynload', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/var/www/polar/venv/local/lib/python2.7/site-packages', '/var/www/polar/venv/lib/python2.7/site-packages']
This is the original error message. Anyone have any ideas or suggestions this has been driving me crazy for a bit now?