3

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
5
  • Could you provide more information, like the requirements.txt? Commented Jan 3, 2020 at 14:06
  • is your function name called env_vars ? weird. In seems you are missing a module from the error message though Commented Jan 3, 2020 at 14:47
  • requirements.txt added Commented Jan 3, 2020 at 15:16
  • any chance you can get into the instance that's being deployed as the script user and check its paths? pip comes installed by default since Python 3.4, but it looks like maybe it's not in the path of the user running that script? Commented Jan 3, 2020 at 16:57
  • Looks like error is in function code, please provide more detail. Commented Jan 3, 2020 at 20:48

1 Answer 1

5

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.