这是我尝试使用gcloud app deploy
进行部署时收到的错误。我以前成功部署了相同的应用程序。我能够在本地计算机上运行该应用程序,但在部署
追溯:
Updating service [default]...failed.
ERROR: (gcloud.app.deploy) Error Response: [9]
Application startup error:
[2017-08-25 10:50:23 +0000] [1] [INFO] Starting gunicorn 19.7.1
[2017-08-25 10:50:23 +0000] [1] [INFO] Listening at: http://0.0.0.0:8080 (1)
[2017-08-25 10:50:23 +0000] [1] [INFO] Using worker: sync
[2017-08-25 10:50:23 +0000] [7] [INFO] Booting worker with pid: 7
[2017-08-25 10:50:23 +0000] [7] [ERROR] Exception in worker process
Traceback (most recent call last):
File "/env/lib/python3.5/site-packages/gunicorn/arbiter.py", line 578, in spawn_worker
worker.init_process()
File "/env/lib/python3.5/site-packages/gunicorn/workers/base.py", line 126, in init_process
self.load_wsgi()
File "/env/lib/python3.5/site-packages/gunicorn/workers/base.py", line 135, in load_wsgi
self.wsgi = self.app.wsgi()
File "/env/lib/python3.5/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/env/lib/python3.5/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
return self.load_wsgiapp()
File "/env/lib/python3.5/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
return util.import_app(self.app_uri)
File "/env/lib/python3.5/site-packages/gunicorn/util.py", line 352, in import_app
__import__(module)
File "/home/vmagent/app/main.py", line 19, in <module>
app = bookshelf.create_app(config)
File "/home/vmagent/app/bookshelf/__init__.py", line 49, in create_app
model = get_model()
File "/home/vmagent/app/bookshelf/__init__.py", line 107, in get_model
from . import model_datastore
File "/home/vmagent/app/bookshelf/model_datastore.py", line 16, in <module>
from google.cloud import datastore
File "/env/lib/python3.5/site-packages/google/cloud/datastore/__init__.py", line 61, in <module>
from google.cloud.datastore.client import Client
File "/env/lib/python3.5/site-packages/google/cloud/datastore/client.py", line 33, in <module>
from google.cloud.datastore.query import Query
File "/env/lib/python3.5/site-packages/google/cloud/datastore/query.py", line 19, in <module>
from google.api.core import page_iterator
ImportError: No module named 'google.api.core'
[2017-08-25 10:50:23 +0000] [7] [INFO] Worker exiting (pid: 7)
[2017-08-25 10:50:24 +0000] [1] [INFO] Shutting down: Master
[2017-08-25 10:50:24 +0000] [1] [INFO] Reason: Worker failed to boot.
答案 0 :(得分:8)
tl; dr:将您的google-cloud
升级到0.27
,它应该解决问题。
我认为这是新google-cloud
依赖项的错误。在我的情况下,google-cloud==0.25
在其setup.py
:
'google-cloud-core >= 0.24.0, < 0.25dev',
'google-cloud-datastore >= 1.0.0, < 2.0dev',
就在最近的8月24日(提交此问题的前一天),google-cloud-datastore
包已更新为1.3.0
。
不幸的是,google-cloud-datastore
1.3.0取决于较新版本的google-cloud-core
:
'google-cloud-core >= 0.27.0, < 0.28dev',
但似乎这个版本冲突没有得到解决/未经过使用旧版本的pip警告。但google-cloud-datastore
想要from google.api.core import page_iterator
,即使是google.api.core
,但在0.27.0
之前未添加,然后一切都会中断。
我认为“bug”在google-cloud===0.25
(或者你正在使用的任何版本)的过载广泛依赖中。
我认为我们的“修复”是升级到最新版本的google-cloud=0.27
。
虽然google-cloud
的“正确修复”是为了改善其版本依赖性,而不是那么广泛,或者冒着与已发布模块向后兼容的风险。