在使用Google Cloud SDK设置环境变量时出现错误。

huangapple go评论83阅读模式
英文:

Error on setting Environment variables in Google Cloud using the SDK

问题

I am setting up Environment Variables for my Django app on Google Cloud.

我正在为我的Django应用程序在Google Cloud上设置环境变量。

I entered the following on the SDK:

我在SDK上输入了以下内容:

gcloud functions deploy env_vars --runtime python37 --set-env-vars SUBSCRIPTION_KEY=1234567890 --trigger-http

The error returned was:

返回的错误是:

ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Build failed: {"error": {"canonicalCode": "INTERNAL", "errorMessage": "`pip_install_from_wheels` had stderr output:\n/opt/python3.7/bin/python3.7: No module named pip\n\nerror: `pip_install_from_wheels` returned code: 1", "errorType": "InternalError", "errorId": "ECB5F712"}}

Please help.

请帮忙解决。

My requirements.txt file:

我的requirements.txt文件:

Django==2.2.5
Pillow==6.2.1
azure-cognitiveservices-language-textanalytics==0.2.0
azure-cognitiveservices-nspkg==3.0.1
azure-cognitiveservices-search-newssearch==1.0.0 
azure-cognitiveservices-search-nspkg==3.0.1
azure-common==1.1.23
azure-nspkg==3.0.2
msrest==0.6.10
numpy==1.17.1
oauthlib==3.1.0
pandas==0.24.2
pandas-datareader==0.7.4
pip==19.0.3
requests==2.21.0
setuptools==40.8.0
sqlparse==0.3.0
statistics==1.0.3.5
ta==0.4.5
gunicorn==20.0.4
英文:

I am trying to set up Environment Variables for my Django app on Google Cloud.
I entered the following on the SDK:

gcloud functions deploy env_vars --runtime python37 --set-env-vars SUBSCRIPTION_KEY=1234567890 --trigger-http

The error returned was:

ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Build failed: {"error": {"canonicalCode": "INTERNAL", "errorMessage": "`pip_install_from_wheels` had stderr output:\n/opt/python3.7/bin/python3.7: No module named pip\n\nerror: `pip_install_from_wheels` returned code: 1", "errorType": "InternalError", "errorId": "ECB5F712"}}

Please help.

My requirements.txt file:

Django==2.2.5
Pillow==6.2.1
azure-cognitiveservices-language-textanalytics==0.2.0
azure-cognitiveservices-nspkg==3.0.1
azure-cognitiveservices-search-newssearch==1.0.0 
azure-cognitiveservices-search-nspkg==3.0.1
azure-common==1.1.23
azure-nspkg==3.0.2
msrest==0.6.10
numpy==1.17.1
oauthlib==3.1.0
pandas==0.24.2
pandas-datareader==0.7.4
pip==19.0.3
requests==2.21.0
setuptools==40.8.0
sqlparse==0.3.0
statistics==1.0.3.5
ta==0.4.5
gunicorn==20.0.4

答案1

得分: 5

你的 requirements.txt 文件中包含了 pip,可能是因为你执行了类似 pip freeze --all > requirements.txt 的操作。Cloud Functions 使用的 Python 3.7 运行时存在一个 bug,如果将 pip 作为函数的依赖项指定会导致此问题。

你应该从你的 requirements.txt 文件中移除 pip,同时确保只指定实际作为函数依赖项的要求。

英文:

You have pip in your requirements.txt, possibly because you did something like pip freeze --all > requirements.txt. The Python 3.7 runtime for Cloud Functions has a bug where specifying pip as a dependency for the function causes this issue.

You should remove pip from your requirements.txt file, but also make sure that you're only specifying the requirements that are actually dependencies for your function.

huangapple
  • 本文由 发表于 2020年1月3日 21:55:43
  • 转载请务必保留本文链接:https://go.coder-hub.com/59579811.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定