ImportError: No module named twilio - python

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.

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.

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

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

Related

Python Can't Find Wolframalpha Module

I'm tyring to import wolfamalpha into my code but it gives a error saying:
ModuleNotFoundError: No module named 'wolframalpha'
I tried installing it with pip install wolframalpha, but it still doesn't work.
Here is my code:
import wolframalpha
client = wolframalpha.Client('*************')
When you run your python file, are you sure that you are using the correct python interpreter that you performed the pip install wolframalpha to? It sounds like you may have multiple versions of python on your machine and there is a mismatch. If you are using VSCode, it is easy to see which interpreter is running on the bottom of the screen, which may help you debug the issue.

No module named 'oauth2_provider.ext'

i'm having this error could someone help me with it.
File "/Users/king/Desktop/dash1-env/DASH/lib/python3.7/site-packages/rest_framework_social_oauth2/views.py", line 7, in
from oauth2_provider.ext.rest_framework import OAuth2Authentication
ModuleNotFoundError: No module named 'oauth2_provider.ext'
I was facing the same error.
Here is the solution:
pip install django-rest-framework-social-oauth2
instead of:
django-rest-framework-social-oauth2==1.0.4
...this version caused the error
(I'm guessing outh2_provider.ext is a module)
The ModuleNotFoundError comes if you did not properly download the module, not download it at all, or mistyped it.
Go to the terminal inside of your script editor or IDE
to download with python 3 and above:
pip3 install OAuth2 Provider
to download with python 2:
pip install OAuth2 Provider
It should download and the at the top instead of import oauth2_provider.ext you write:
import oauth2

Using Import for PIP Installed Packages While Using Kivy on Windows

I am trying to use the Python module pyowm with Kivy and am having problems getting the import statement to work. I am on Windows 8.1 and downloaded pyowm using PIP. When I try and use "import pyowm" and then send the file to Kivy.bat it says "No module named pyowm" but when I just run a program that uses only pyowm from command line it works.
Any help would be greatly appreciated.
Cheers
The kivy portable package includes its own python, but it sounds like you have installed pyowm into some other python installation.
I haven't used the windows package, but I think somewhere in it there should be a way to run its internal pip. If nobody responds here, someone on the kivy mailing list or irc probably knows.

Getting "ImportError: cannot import name HTTPSConnection" error in Python 2.7

I'm trying to deploy django in AWS ElasticBeanstalk.
While I was following the steps as shown here, I'm stuck with the command, "eb init".
I'm using Python 2.7 in Ubuntu 12.10 (vmware)
I'm getting the error as below:
eb init
.....
from lib.aws.http_client import HTTP_GET, HTTP_POST
File "/home/g/Documents/Files/AWS/AWS-ElasticBeanstalk-CLI-2.4.0/eb/linux/python2.7/lib/aws/http_client.py", line 17, in <module>
from httplib import HTTPSConnection
ImportError: cannot import name HTTPSConnection
Two possibilities spring to mind...
The Python installation on AWS doesn't include SSL support.
You've created a file called httplib.py which is shadowing the one in the standard Python library.
Try doing import ssl, and if you get ImportError: No module named _ssl, then it's #1, otherwise it's #2.
I had installed python via homebrew and was getting this error. For some reason the solution was to uninstall and reinstall it:
brew uninstall python
brew install python
I had the same problem with a virtual environment. I deleted the virtual environment and recreated it and the problem disappeared.

Pylons: Webhelpers: missing secure_form module

I installed Pylons 0.9.7 using the go-pylons.py script.
I have a line of python:
from webhelpers.html.secure_form import secure_form
When I try to serve my application I get the error: no module secure_form.
I've tried writing import webhelpers.html.tags and other modules from webhelpers and those work. I'm wondering why I don't have secure_form and how I can obtain this module manually? I've tried re-running go-pylons.py and it didn't help.
Any ideas?
if your webhelpers version is 1.0b4 or above, secure_form is under webhelpers.pylonslib, ie.
from webhelpers.pylonslib import secure_form
I just ran into this as well.
In case the other posts aren't obvious to get the old version of webhelpers you can run:
easy_install webhelpers==0.6.4
ugh, so for some reason I have 1.0b4 of webhelpers installed and the path to secure_form changed... (http://groups.google.com/group/pylons-discuss/msg/695d73b831a4aee3) I guess my question now becomes: how do I install a previous version of webhelpers? I have easy_install
Actually looking at this, I got something similar and the proper tested line of import is:
from webhelpers.pylonslib.secure_form import secure_form

Categories

Resources