简体   繁体   English

部署 Google Cloud Functions

[英]Deploying Google Cloud Functions

I am using MacOS .我正在使用MacOS

I used following command:我使用了以下命令:

gcloud beta functions deploy start --runtime python37
  --trigger-http --memory 2048MB --timeout 540s

But while deploying google cloud functions I got this error:但是在部署google cloud functions我收到了这个错误:

(gcloud.beta.functions.deploy) OperationError: code=3, message=Build failed: USER ERROR:
pip_download_wheels had stderr output:
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-wheel-8b_hn74q/PyWavelets/
error: pip_download_wheels returned code: 1

I added scikit-image in my requirements.txt , which was not added before.我在我的requirements.txt添加了scikit-image ,这是之前没有添加的。 Code was successfully deploying when scikit-image was not added in requirements.txt .scikit-image未添加到requirements.txt时,代码已成功部署。

Any ideas?有任何想法吗?

Do you have a Pipfile in your directory?你的目录中有 Pipfile 吗? I was able to replicate this same error when I tried to deploy a GCF containing a Pipfile but no accompanying Pipfile.lock.当我尝试部署包含 Pipfile 但没有随附的 Pipfile.lock 的 GCF 时,我能够复制同样的错误。 To fix, either remove Pipfile and just include requirements.txt, or generate Pipfile.lock:要修复,请删除 Pipfile 并只包含 requirements.txt,或生成 Pipfile.lock:

$ pipenv install without the --skip-lock flag $ pipenv install没有 --skip-lock 标志

While the current documentation does not state this, I have found that you can deploy to GCF without a requirements.txt file at all.虽然当前的文档没有说明这一点,但我发现您可以在没有 requirements.txt 文件的情况下部署到 GCF。 Just include Pipfile and Pipfile.lock.只需包含 Pipfile 和 Pipfile.lock。

To recap, acceptable dependency files to deploy a beta GCF:回顾一下,部署 beta GCF 可接受的依赖文件:

  • requirements.txt要求.txt
  • Pipfile + Pipfile.lock Pipfile + Pipfile.lock
  • requirements.txt + Pipfile + Pipfile.lock requirements.txt + Pipfile + Pipfile.lock

According to the google cloud function documentation it only supports installing dependency from requirements.txt file.根据谷歌云功能文档,它仅支持从requirements.txt文件安装依赖项。

And the file Pipfile/Pipfile.lock must not be present in the root directory.并且文件Pipfile/Pipfile.lock不能出现在根目录中。

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

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