简体   繁体   English

google-cloud 依赖项在 python 应用引擎中被覆盖

[英]google-cloud dependencies getting overriden in python app engine

We are using GAE standard and as per google documentation, we are expected to vendor dependencies in some folder using pip install requirement-name -t lib/ .我们正在使用 GAE 标准,并且根据谷歌文档,我们希望使用pip install requirement-name -t lib/来在某些文件夹中供应商依赖项。

We want to use both BigQuery & pub-sub in the same GAE project which is I think not a very rare combination.我们想在同一个 GAE 项目中同时使用BigQuerypub-sub ,我认为这不是一个非常罕见的组合。

Now the issue is at a time we are able to install only one of the client libraries as both share google>cloud namespace whichever is installed later will override earlier dependency.现在的问题是,我们有时只能安装一个客户端库,因为两者都共享google>cloud命名空间,无论以后安装哪个都将覆盖之前的依赖项。

Screenshots:-截图:-

1) When only BigQuery client library is installed :- 1)仅安装 BigQuery 客户端库时:-

只有 GBQ 依赖截图

2) After installing pip install -t lib/ google-cloud-pubsub 2)安装后pip install -t lib/ google-cloud-pubsub

安装pubsub后

What can be the issue and solution for the same?相同的问题和解决方案是什么?

UPDATE :-更新:-

Further tried installing these two dependencies in the virtual environment without vendoring in lib/ folder, there both dependencies are getting installed without overwriting each other.进一步尝试在虚拟环境中安装这两个依赖项,而无需在lib/文件夹中进行 vendoring,这两个依赖项都已安装而不会相互覆盖。 So looked like the issue is with vendoring in folder.所以看起来问题出在文件夹中的vendoring。

Screenshot for the same without vendoring dependencies.没有 vendoring 依赖项的相同屏幕截图。

在此处输入图片说明

You should install all the dependencies in a single command:您应该在一个命令中安装所有依赖项:

$ pip install -t lib/ google-cloud-bigquery google-cloud-pubsub

This will install both packages along side each other:这将同时安装两个软件包:

$ ls lib/google/cloud
__pycache__  _testing.py  environment_vars.py  obsolete.py   pubsub_v1
_helpers.py  bigquery     exceptions.py        operation.py
_http.py     client.py    iam.py               pubsub.py

Installing the dependencies from a requirements file should have the same effect:从需求文件安装依赖项应该具有相同的效果:

$ cat requirements.txt
google-cloud-bigquery
google-cloud-pubsub
$ pip install -t lib/ -r requirements.txt

Make sure to start with an empty lib/ folder, and with the latest version of pip :确保从一个空的lib/文件夹开始,并使用最新版本的pip

pip install -U pip

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM