I am migrating from python27 to python37. I have ported the python2 code to python3 code. The problem is when i try to run the development server, it says ModuleNotFoundError: No module named 'google.appengine'
. I have the google cloud sdk downloaded.
I also have the following google libaries downloaded:
google==2.03
; google-api-core==1.17.0
; google-auth==1.14.3
; google-cloud==0.34.0
; google-cloud-core==1.3.0
; google-cloud-datastore==1.120
; google-cloud-ndb==1.2.0
; google-cloud-storage==1.28.0
;
I am using the CLOUD_DATASTORE. Does this have anything to do with that? Do i have to migrate?
Here is the full error:
INFO 2020-05-12 15:58:51,741 instance_factory.py:261] Running /tmp/tmpAvEFgc/bin/pip install -r /tmp/tmpjm7s5D
INFO 2020-05-12 15:59:02,605 dispatcher.py:267] Starting module "default" running at: http://192.168.1.15:8080
INFO 2020-05-12 15:59:02,613 instance_factory.py:121] Detected Python 3.7.5
INFO 2020-05-12 15:59:03,607 instance.py:561] Cannot decide GOOGLE_CLOUD_PROJECT, using "test" as a fake value
[2020-05-12 11:59:03 -0400] [30089] [INFO] Starting gunicorn 20.0.4
[2020-05-12 11:59:03 -0400] [30089] [INFO] Listening at: http://0.0.0.0:21217 (30089)
[2020-05-12 11:59:03 -0400] [30089] [INFO] Using worker: sync
[2020-05-12 11:59:03 -0400] [30092] [INFO] Booting worker with pid: 30092
[2020-05-12 11:59:03 -0400] [30092] [ERROR] Exception in worker process
Traceback (most recent call last):
File "/tmp/tmpAvEFgc/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
worker.init_process()
File "/tmp/tmpAvEFgc/lib/python3.7/site-packages/gunicorn/workers/base.py", line 119, in init_process
self.load_wsgi()
File "/tmp/tmpAvEFgc/lib/python3.7/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
self.wsgi = self.app.wsgi()
File "/tmp/tmpAvEFgc/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/tmp/tmpAvEFgc/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
return self.load_wsgiapp()
File "/tmp/tmpAvEFgc/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
return util.import_app(self.app_uri)
File "/tmp/tmpAvEFgc/lib/python3.7/site-packages/gunicorn/util.py", line 358, in import_app
mod = importlib.import_module(module)
File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/vicktree/Documents/project-noah-3/noah-app/main.py", line 19, in <module>
from handlers.noah_handler import NoahHandler
File "/home/vicktree/Documents/project-noah-3/noah-app/handlers/noah_handler.py", line 16, in <module>
from google.appengine.ext import db
ModuleNotFoundError: No module named 'google.appengine'
The google.appengine
module is baked into the first-generation Python (2.7) runtime. It's not available to install via pip
, in the second-generation (3.7) runtime, or in any Docker environment.
The only way to use it is by writing and deploying a first-generation App Engine app.
Depending on what you're doing, you should be able to replace it with a client library call instead.
See https://cloud.google.com/appengine/docs/standard/python/migrate-to-python3 for more details.