How to fix the issue of “ImportError: No module named twilio.rest”?

204    Asked by JordanPARKER in Cyber Security , Asked on May 25, 2021

When I run the code, it displays the error

"No module named twilio.rest.

I  tried to uninstall and install a few times with pip.

from twilio.rest import Client
client = Client(account_sid, auth_token)
message = client.messages.create(
                       to="",
                       from_="",
                       body="" )
print(message.sid)
ImportError: No module named twilio.rest

Answered by James Scott

First, check your python-pip version, is it 2 or 3?

After installing Twilio, in case you use python 3 and you have installed Twilio using your pip2, then of course you will face this issue.

Also, to solve no module named twilio.rest make sure to check your interpreter, if you have a correct interpreter set for your project and if your interpreter has the twilio library installed in it, because sometimes we have multiple interpreters in our IDE



Your Answer

Interviews

Parent Categories