ModuleNotFoundError: No module named 'google.appengine'
See original GitHub issuePlease run down the following list and make sure you’ve tried the usual “quick fixes”:
Environment details
- OS: Mac 10.13
- Python version: 3.7
- pip version: 19.3.1
google-api-python-client
version: 1.7.11
Steps to reproduce
- Initiate flow with a valid code from oauth2:
flow = Flow.from_client_secrets_file(
client_secrets_file=ga['client_secret'],
scopes=ga['scopes'].split(','),
redirect_uri=ga['redirect_uri'])
-
Now when token based on the given code:
flow.fetch_token(code=request.args['code'])
-
Now when you issue
flow.credentials.to_json()
you can see the obtained token. -
Now build a service for analytics:
service = build(serviceName='analytics',
version='v3',
credentials=flow.credentials)
It gives the error below:
2020-01-29 15:12:44,190 [googleapiclient.discovery_cache] file_cache is unavailable when using oauth2client >= 4.0.0 or google-auth
Traceback (most recent call last):
File "/Users/fc/PycharmProjects/something/venv/lib/python3.7/site-packages/googleapiclient/discovery_cache/__init__.py", line 36, in autodetect
from google.appengine.api import memcache
File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
ModuleNotFoundError: No module named 'google.appengine'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/fc/PycharmProjects/something/venv/lib/python3.7/site-packages/googleapiclient/discovery_cache/file_cache.py", line 33, in <module>
from oauth2client.contrib.locked_file import LockedFile
File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
ModuleNotFoundError: No module named 'oauth2client.contrib.locked_file'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/fc/PycharmProjects/something/venv/lib/python3.7/site-packages/googleapiclient/discovery_cache/file_cache.py", line 37, in <module>
from oauth2client.locked_file import LockedFile
File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
ModuleNotFoundError: No module named 'oauth2client.locked_file'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/fc/PycharmProjects/something/venv/lib/python3.7/site-packages/googleapiclient/discovery_cache/__init__.py", line 41, in autodetect
from . import file_cache
File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/Users/fc/PycharmProjects/something/venv/lib/python3.7/site-packages/googleapiclient/discovery_cache/file_cache.py", line 41, in <module>
'file_cache is unavailable when using oauth2client >= 4.0.0 or google-auth')
ImportError: file_cache is unavailable when using oauth2client >= 4.0.0 or google-auth
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2463, in __call__
return self.wsgi_app(environ, start_response)
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2449, in wsgi_app
response = self.handle_exception(e)
File "/usr/local/lib/python3.7/site-packages/Flask_Cors-3.0.8-py3.7.egg/flask_cors/extension.py", line 161, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1866, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.7/site-packages/Flask_Cors-3.0.8-py3.7.egg/flask_cors/extension.py", line 161, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.7/site-packages/Flask_DebugToolbar-0.10.1-py3.7.egg/flask_debugtoolbar/__init__.py", line 125, in dispatch_request
return view_func(**req.view_args)
File "/usr/local/lib/python3.7/site-packages/Flask_Classful-0.14.2-py3.7.egg/flask_classful.py", line 268, in proxy
response = view(**request.view_args)
File "/usr/local/lib/python3.7/site-packages/Flask_Classful-0.14.2-py3.7.egg/flask_classful.py", line 239, in inner
return fn(*args, **kwargs)
File "/Users/fc/PycharmProjects/something/venv/lib/python3.7/site-packages/tf_api_common-20191026-py3.7.egg/tf_api_common/jwt.py", line 129, in decorator
return fn(*a, **k)
File "/Users/fc/PycharmProjects/something/tf_api/views/oauth.py", line 50, in get
credentials=flow.credentials)
File "/Users/fc/PycharmProjects/something/venv/lib/python3.7/site-packages/googleapiclient/_helpers.py", line 130, in positional_wrapper
return wrapped(*args, **kwargs)
File "/Users/fc/PycharmProjects/something/venv/lib/python3.7/site-packages/googleapiclient/discovery.py", line 231, in build
raise e
File "/Users/fc/PycharmProjects/something/venv/lib/python3.7/site-packages/googleapiclient/discovery.py", line 223, in build
requested_url, discovery_http, cache_discovery, cache, developerKey)
File "/Users/fc/PycharmProjects/something/venv/lib/python3.7/site-packages/googleapiclient/discovery.py", line 276, in _retrieve_discovery_doc
raise HttpError(resp, content, uri=actual_url)
googleapiclient.errors.HttpError: <HttpError 403 when requesting https://www.googleapis.com/discovery/v1/apis/analytics/v3/rest returned "Forbidden">
I have installed the latest of below packages:
google-auth-oauthlib
google-api-python-client
oauth2client
google-auth
googleapis-common-protos
scopes I gave for getting the code and then token:
https://www.googleapis.com/auth/analytics.readonly
https://www.googleapis.com/auth/tagmanager.readonly
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
[No module named 'google.appengine ... - Stack Overflow
I have ported the python2 code to python3 code. The problem is when i try to run the development server, it says ModuleNotFoundError:...
Read more >Fixing python import error “No module named appengine”
Have you ever tried importing any package from Google App Engine library? If it throws an import error, it means that either the...
Read more >No module named 'google.appengine'
I have built an app using Google App Engine. As the next step, I would like to use task queues but when I...
Read more >appengine-python-standard - PyPI
In your main.py , import google.appengine.api.wrap_wsgi_app and call it on your WSGI app object. ... Then deploy your app as usual, with gcloud...
Read more >ModuleNotFoundError: No module named 'google'
ModuleNotFoundError : No module named 'google' ... How to remove the ModuleNotFoundError: No module named 'google' error? ... Hi,. In your python environment...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@busunkim96, thank you for your reply. Yes, the API endpoint link works when opened in the browser. I just started debugging and came across that my timeout is actually happening because of the different unrelated bug 🤦♂️ Sorry for that unclarity.
However the previously mentioned
ModuleNotFoundError: No module named 'google.appengine'
still happens. As a workaround addingcache_discovery=False
tobuild
method is helping for now 👍Did we manage to solve it? I m also getting same error. Tried adding
cache_discovery` to `service = build('calendar', 'v3', credentials=creds, cache_discovery=False)
but now it seems to be timing out onURL being requested: GET https://www.googleapis.com/discovery/v1/apis/calendar/v3/rest