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
Related
I'm trying to connect my python scripts to an MySQL or MariaDB Server on my RaspberryPi4.
My python script right now just contains import mysql.connector. But when I try to start it via sudo python3 startdb.py I just get import mysql.connector ModuleNotFoundError: No module named 'mysql' as an error.
I get an other error, when I start the script via sudo python startdb.py: import mysql.connector ImportError: No module named mysql.connector.
I searched for a solution on many sites or forums. I mostly just found various versions of pip install mysql-connector-python (also with pip3, mysql-connector-python-rf or mysql-connector) to run but none of them worked for me. The only difference I recognized is that I previously got the error ModuleNotFoundError with both sudo python and sudo python3, but now I only get it with sudo python3.
Does anyone know how to solve this?
Could the fact that my script isn't in a sub-directory of /home/pi/, but instead of /home/, be the problem?
Edit: I just tried executing the script via the desktop mode using my mouse and just clicking on run and it worked. But when I'm using the command line in desktop mode or with a SSH session it doesn't work.
Another Edit: It looks like when I'm starting the script without sudo it'll work just fine. Don't actually know why's that, but I'm good for now. But would be very interesting to know and understand why the sudo makes it "crash".
Thanks and happy to hear some solutions :D
Cooki
raspbian give user mode in running, just in Desktop gives some permission to user for run app as root to access all necessary attributes , use sudo with all initial steps when you download and install project package's
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.
In my python application i am using the matplotlib.when i start running it throws me an error:
ImportError: No named '_tkinter', please install the python3-tk package
Then i have installed sudo apt-get install python-tk.It got works in localhost.But same app i am deploying into the google cloudPlatforms.But i am getting this error:
import _tkinter # If this fails your Python may not be configured for Tk ImportError: libBLT.2.5.so.8.6: cannot open shared object file: No such file or directory
How to install python-tk to Google cloudPlatforms.After deactivate the vitualenv also i have installed.It shows already the newest version.I have tried many things but it doesn't seems to work.The App throws 502 Bad Gateway.
Thanks in advance.
Use
matplotlib.use('agg')
right after importing matplotlib, to render matplotlib graphics in a headless environment. You can also set this as the default in your matplotlibrc file, or via the MPLBACKEND environment variable.
See the matplotlib docs for more details: https://matplotlib.org/faq/usage_faq.html#what-is-a-backend See also the page on using matplotlib in a web application.
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
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.