-
Notifications
You must be signed in to change notification settings - Fork 303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
uWSGI - ImportError: No module named google.oauth2.credentials #249
Comments
ImportError: No module named google.oauth2.credentials
I ended up solving my problem. Turns out the problem was a uWSGI configuration error on my part. Since I'm not using virtualenv, I needed to set Once the Example:
|
Glad you got it figured out, @richard-to! |
from google.oauth2.credentials import Credentials |
@MatthewR586, Please could you open a new issue here? Please also include the full stack trace. |
I am developing a Flask app that runs using uwsgi. I'm running into the following error
ImportError: No module named google.oauth2.credentials
.When I run the Flask app using Flask's builtin dev server, the application runs without issues.
The problem seems to stem from how the
google-auth
module is installed. There's no__init__.py
file in thegoogle
namespace folder insite-packages
. I believe this is the intended behavior.I'm aware that python3.3 has implicit namespace packaging via PEP-420.
What I'm confused about is how the implicit namespace packaging works in python2.7. Does the installation process via
pip
do something special to makeimport google.oauth2.credentials
work?I'm also confused about what is different when running python2.7 via uwsgi since the same import does not work.
I've also included the following barebones test to reproduce the error.
Relevant versions
test.ini
test.py
working command
failing command
failing result
When I run the above command, the program will fail due to the following ImportError.
Workaround
One way I got the google namespace import to work was by doing this:
I wonder why site-packages is not already added when using uwsgi.
I got the hint to try
site.addistedir
from this answer: https://stackoverflow.com/a/15209116/177646The text was updated successfully, but these errors were encountered: