Skip to content Skip to sidebar Skip to footer

Google Cloud Function / Python 3.7 / Requirements.txt Makes Deploy Fail

I try to deploy a google cloud function with dependencies via requirements.txt. Deployment takes terribly long and fails with this message: (gcloud.functions.deploy) OperationError

Solution 1:

PyTorch ships a distribution on PyPI with CUDA/Nvidia GPU support by default, but the Cloud Functions runtime doesn't have GPU support, or the necessary system libraries.

Instead, you should use the URL provided by https://pytorch.org/ when selecting:

  • Your OS: Linux
  • Package: Pip
  • Language: Python 3.7
  • CUDA: None
pip3 install https://download.pytorch.org/whl/cpu/torch-1.0.1.post2-cp37-cp37m-linux_x86_64.whl

Which would make your requirements.txt:

Flask==1.0.2
dill>=0.2.8numpy>=1.15.0requests>=2.20.0
six==1.12.0
spacy>=2.1.0
https://download.pytorch.org/whl/cpu/torch-1.0.1.post2-cp37-cp37m-linux_x86_64.whl
torchtext>=0.3.1

Post a Comment for "Google Cloud Function / Python 3.7 / Requirements.txt Makes Deploy Fail"