0

I believe this has something to do with having multiple versions of python but after fiddling for many hours I am just plain lost. I am on OSX Yosemite. I have tried installing and reinstalling the twilio libraries multiple times. The script won't run past line 1 without throwing this error.

ImportError: No module named twilio

from twilio import twiml
from twilio.rest import TwilioRestClient

Basic info for Twilio and python

twilio==4.5.0

/Library/Frameworks/Python.framework/Versions/2.7/bin/python
/usr/local/bin/python
/usr/bin/python

Thanks to anyone that can help.

Daniel Roseman
  • 588,541
  • 66
  • 880
  • 895
jim
  • 71
  • 1
  • 7
  • 4
    Find which directory `twilio` installed into - you don't say how you installed it, which python you installed it with and which python you are trying to run it from. Then check the `PYTHONPATH` environment variable. – cdarke Sep 07 '15 at 08:00
  • As an aside, you might consider using `pyenv` to manage your Python versions; it's designed to solve problems like this. https://github.com/yyuu/pyenv – Will Vousden Sep 07 '15 at 08:09

3 Answers3

0

I had this same problem, and found the solution here: Import error in twilio

It could be that you simply already have a file named twilio.py that is being imported instead of the library, twilio-python. Remove your twilio.py and twilio.pyc and hopefully it will solve your problem.

Community
  • 1
  • 1
mboss
  • 123
  • 1
  • 8
0

Since you're using Python 2.7 try installing twilio with pip2 (the python 2.7 pip version)

sudo pip2 install twilio

And remember to always keep you main pip version the same as your python version

Khaled Al-Ansari
  • 3,910
  • 2
  • 24
  • 27
0

i had the same problem, the problem was emanating from naming conflict. Had named my project file "twilio.py" thus

from twilio.rest import Client gave an error

DereckChamboko
  • 187
  • 2
  • 6