问题描述
我正在通过App Engine Flex使用云存储.突然,部署成功后我开始收到此错误消息
I am using cloud storage with App Engine Flex. Out of the blue i start getting this error message after deploy succeeds
我的烧瓶应用程序中的这些行发生了错误.
The error is happening from these lines in my flask app.
from google.cloud import storage, datastore
client = storage.Client()
File "/home/vmagent/app/main.py", line 104, in _load_db
client = storage.Client()
File "/env/lib/python3.6/site-packages/google/cloud/storage/client.py", line 110, in __init__
project=project, credentials=credentials, _http=_http
File "/env/lib/python3.6/site-packages/google/cloud/client.py", line 250, in __init__
Client.__init__(self, credentials=credentials, client_options=client_options, _http=_http)
File "/env/lib/python3.6/site-packages/google/cloud/client.py", line 143, in __init__
scopes = client_options.scopes or self.SCOPE
AttributeError: 'ClientOptions' object has no attribute 'scopes'
这与基于众多SO线程对grpcio和google-api-core以及google-cloud-storage软件包进行的重大升级有关.但是,我不知道这是哪里发生的.
This is something to do with breaking upgrades made to grpcio and google-api-core and google-cloud-storage packages based on numerous SO threads. However, I cant figure out where this is happening.
我的requirements.txt如下:
My requirements.txt is as follows:
setuptools>=40.3
grpcio<=1.27.2
google-api-core<1.17.0
Flask
gevent>=0.13
gunicorn>=19.7.1
numpy>=1.18.0
numpy-financial
scipy>=1.4
pvlib>=0.7
google-cloud-storage==1.28.0
google-cloud-datastore==1.12.0
google-cloud-pubsub
pandas==1.0.5
我的app.yaml如下:
my app.yaml is as follows:
service: app-preprod
runtime: custom
env: flex
entrypoint: gunicorn -t 600 -c gunicorn.conf.py -b :$PORT main:app
runtime_config:
python_version: 3.6
manual_scaling:
instances: 1
resources:
cpu: 1
memory_gb: 4
beta_settings:
cloud_sql_instances: xxxx:europe-west6:component-cost
endpoints_api_service:
name: apipreprod-dot-xxxx.appspot.com
rollout_strategy: managed
根据发布历史,几天前发布了一些新版本的google-cloud-storage等,但我试图保持相同的旧版本号.
Looking at the release histories, some new versions of google-cloud-storage etc were released a few days ago, but i have tried to maintain the same older version number.
荒谬的是,在这些完全相同的requirements.txt中,我有一个相同的prod应用程序引擎,可以正常工作---但我没有重新部署一个星期.显然,使用完全相同版本的存储和数据存储区从我的本地计算机上运行客户端完全没有问题.
The ridiculous thing is that with these exact same requirements.txt, i have an identical prod app engine that is working fine --- but that i had not redeployed for a week.Obviously, no problems at all with exactly the same versions of storage and datastore to run the client from my local machine.
-编辑-显然是根据
https://github.com/googleapis/google-cloud-python/问题/10471
我应该添加
google-cloud-core==1.3.0
到requirements.txt这似乎是一种解决方法---确保此中断不会让我不知不觉的更好的永久方法?
google-cloud-core==1.3.0
to requirements.txtThis seems a workaround --- any better permanent way of ensuring this break doesnt catch me unawares?
推荐答案
这是由于 https://github.com/googleapis/google-cloud-python/issues/10471 .
我建议使用错误修正将google-cloud-core
和google-api-core
升级到最新版本.
I'd recommend upgrading google-cloud-core
and google-api-core
to the latest versions with the bugfix.
这篇关于谷歌云存储python客户端AttributeError:'ClientOptions'对象没有属性'scopes'部署后发生的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!