I am having the same problem as this thread regarding twilio-python:
twilio.rest missing from twilio python module version 2.0.8?
However I have the same problem but I have 3.3.3 installed. I still get "No module named rest" when trying to import twilio.rest.
Loading the library from stand alone python script works. So I know that pip installing the package worked.
from twilio.rest import TwilioRestClient
def main():
account = "xxxxxxxxxxxxxxxx"
token = "xxxxxxxxxxxxxxxx"
client = TwilioRestClient(account, token)
call = client.calls.create(to="+12223344",
from_="+12223344",
url="http://ironblanket.herokuapp.com/",
method="GET")
if __name__ == "__main__":
main()
but this does not work:
from twilio.rest import TwilioRestClient
def home(request):
client = TwilioRestClient(account, token)
Do you have any idea what I can try next?
I named a python file in my project twilio.py
. Since that file was loaded first, then subsequent calls to load twilio would reference that file instead of the twilio library.
TLDR: just don't name your python file twilio.py
Check which versions of pip
and python
you are running with this command:
which -a python
which -a pip
pip
needs to install to a path that your Python executable can read from. Sometimes there will be more than one version of pip
like pip-2.5
, pip-2.7
etc. You can find all of them by running compgen -c | grep pip
. There can also be more than one version of Python, especially if you have Macports or brew or multiple versions of Python installed.
Check which version of the twilio module is installed by running this command:
$ pip freeze | grep twilio # Or pip-2.7 freeze etc.
The output should be twilio==3.3.3
.
I hope that helps - please leave a comment if you have more questions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With