question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Import error on deploy only: No module named google.appengine.api

See original GitHub issue

I’ve been following the tutorial, in particular section 6-pubsub. I have the project working locally just fine, but when I try to deploy, I get a timeout. See the stacktrace from the logs below. The import error is:

ImportError: No module named 'google.appengine.api'

and it occurs when I try to make a new logging Client. I’ve seen the same issue in another project when I try to make a new pubsub Client.

2016-11-02 17:02:18 worker[20161102t123058]  17:02:18 worker.1  |   File "/home/vmagent/app/main.py", line 19, in <module>
2016-11-02 17:02:18 worker[20161102t123058]  17:02:18 worker.1  |     app = bookshelf.create_app(config)
2016-11-02 17:02:18 worker[20161102t123058]  17:02:18 worker.1  |   File "/home/vmagent/app/bookshelf/__init__.py", line 40, in create_app
2016-11-02 17:02:18 worker[20161102t123058]  17:02:18 worker.1  |     client = google.cloud.logging.Client(app.config['PROJECT_ID'])
2016-11-02 17:02:18 worker[20161102t123058]  17:02:18 worker.1  |   File "/env/lib/python3.4/site-packages/google/cloud/client.py", line 186, in __init__
2016-11-02 17:02:18 worker[20161102t123058]  17:02:18 worker.1  |     Client.__init__(self, credentials=credentials, http=http)
2016-11-02 17:02:18 worker[20161102t123058]  17:02:18 worker.1  |   File "/env/lib/python3.4/site-packages/google/cloud/client.py", line 122, in __init__
2016-11-02 17:02:18 worker[20161102t123058]  17:02:18 worker.1  |     credentials = get_credentials()
2016-11-02 17:02:18 worker[20161102t123058]  17:02:18 worker.1  |   File "/env/lib/python3.4/site-packages/google/cloud/credentials.py", line 87, in get_credentials
2016-11-02 17:02:18 worker[20161102t123058]  17:02:18 worker.1  |     return client.GoogleCredentials.get_application_default()
2016-11-02 17:02:18 worker[20161102t123058]  17:02:18 worker.1  |   File "/env/lib/python3.4/site-packages/oauth2client/client.py", line 1288, in get_application_default
2016-11-02 17:02:18 worker[20161102t123058]  17:02:18 worker.1  |     return GoogleCredentials._get_implicit_credentials()
2016-11-02 17:02:18 worker[20161102t123058]  17:02:18 worker.1  |   File "/env/lib/python3.4/site-packages/oauth2client/client.py", line 1273, in _get_implicit_credentials
2016-11-02 17:02:18 worker[20161102t123058]  17:02:18 worker.1  |     credentials = checker()
2016-11-02 17:02:18 worker[20161102t123058]  17:02:18 worker.1  |   File "/env/lib/python3.4/site-packages/oauth2client/client.py", line 1191, in _implicit_credentials_from_gae
2016-11-02 17:02:18 worker[20161102t123058]  17:02:18 worker.1  |     return _get_application_default_credential_GAE()
2016-11-02 17:02:18 worker[20161102t123058]  17:02:18 worker.1  |   File "/env/lib/python3.4/site-packages/oauth2client/client.py", line 1450, in _get_application_default_credential_GAE
2016-11-02 17:02:18 worker[20161102t123058]  17:02:18 worker.1  |     from oauth2client.contrib.appengine import AppAssertionCredentials
2016-11-02 17:02:18 worker[20161102t123058]  17:02:18 worker.1  |   File "/env/lib/python3.4/site-packages/oauth2client/contrib/appengine.py", line 27, in <module>
2016-11-02 17:02:18 worker[20161102t123058]  17:02:18 worker.1  |     from google.appengine.api import app_identity
2016-11-02 17:02:18 worker[20161102t123058]  17:02:18 worker.1  | ImportError: No module named 'google.appengine.api'
2016-11-02 17:02:18 worker[20161102t123058]  17:02:18 system    | worker.1 stopped (rc=1)
2016-11-02 17:02:18 worker[20161102t123058]  17:02:18 system    | sending SIGTERM to monitor.1 (pid 8)
2016-11-02 17:02:18 worker[20161102t123058]  17:02:18 system    | monitor.1 stopped (rc=-15)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:25

github_iconTop GitHub Comments

2reactions
theacodescommented, Nov 2, 2016

Thank you. I’m trying to reproduce. This error is extremely bewildering.

1reaction
linsamtwcommented, Aug 17, 2019

@theacodes

please help me, i have same issue No module named ‘google.appengine’

my requirements.txt

Django==2.1.10
PyMySQL==0.9.3
numpy==1.17.0
plotly==4.0.0
pandas==0.25.0
requests==2.22.0

Flask==0.11.1
google-cloud==0.19.0
gunicorn==19.6.0
oauth2client==3.0.0
Flask-SQLAlchemy==2.1
Flask-PyMongo==0.4.1
PyMongo==3.3.0
six==1.10.0
honcho==0.7.1
psq==0.5.0
googleapis-common-protos==1.3.5

app.yam

# [START django_app]
runtime: python37

runtime_config:
  python_version: 3

handlers:
# This configures Google App Engine to serve the files in the app's static
# directory.
- url: /static
  static_dir: static/

# This handler routes all requests not caught above to your main app. It is
# required when static routes are defined, but can be omitted (along with
# the entire handlers section) when there are no static files defined.
- url: /.*
  script: auto
# [END django_app]

thank you

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fixing python import error “No module named appengine”
If it throws an import error, it means that either the App Engine SDK is not installed, or at least the Python run-time...
Read more >
[No module named 'google.appengine ... - Stack Overflow
1 Answer 1 · 1. hey Dustin, just a another quick question. So one of the imports is from google.appengine.api import datastore ....
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 >
ModuleNotFoundError: No module named 'main' - Server Fault
This line says to look for the variable named app in the module named main.py: entrypoint: gunicorn -b:$PORT main:app.
Read more >
Access legacy bundled services for Python 3 - Google Cloud
You can find the SDK on GitHub under the appengine-python-standard repo, ... migrate the code to Python 3 and deploy and test using...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found