After successfully porting from Python 2.7 to 3.7 on Google App Engine, I decided to try upgrading to Python 3.8 runtime.
The only changes I made in the configuration from Python 3.7 was to specify the python38 runtime in the app.yaml file and to add google-cloud-datastore to requirements.txt
When I deploy and run the app runtime,I get a Bad Gateway 502 (nginx). Below is the stderr log:
Traceback (most recent call last):
File "/layers/google.python.webserver/gunicorn/gunicorn/arbiter.py", line 583, in spawn_worker
worker.init_process()
File "/layers/google.python.webserver/gunicorn/gunicorn/workers/gthread.py", line 92, in init_process
super().init_process()
File "/layers/google.python.webserver/gunicorn/gunicorn/workers/base.py", line 119, in init_process
self.load_wsgi()
File "/layers/google.python.webserver/gunicorn/gunicorn/workers/base.py", line 144, in load_wsgi
self.wsgi = self.app.wsgi()
File "/layers/google.python.webserver/gunicorn/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/layers/google.python.webserver/gunicorn/gunicorn/app/wsgiapp.py", line 49, in load
return self.load_wsgiapp()
File "/layers/google.python.webserver/gunicorn/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
return util.import_app(self.app_uri)
File "/layers/google.python.webserver/gunicorn/gunicorn/util.py", line 358, in import_app
mod = importlib.import_module(module)
File "/opt/python3.8/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/srv/main.py", line 2, in <module>
from google.cloud import ndb
File "/layers/google.python.pip/pip/google/cloud/ndb/__init__.py", line 28, in <module>
from google.cloud.ndb.client import Client
File "/layers/google.python.pip/pip/google/cloud/ndb/client.py", line 26, in <module>
from google.cloud.datastore_v1.gapic import datastore_client
ModuleNotFoundError: No module named 'google.cloud.datastore_v1.gapic'
My requirements.txt file has the following:
googleapis_common_protos
google-cloud-ndb
google-cloud-datastore
Flask==0.10.1
I do not specify an entry point in the app.yaml file. Per the docs, there is no requirement to include gunicorn in requirments.txt in that case. Initially I did not have the google-cloud-datastore library included. Python37 runtime did not need it. Seems to make no difference wrt the error with python38 runtime.
As mentioned this works perfectly with the python37 runtime.
Thanks.