Google Cloud Function / Python 3.7 / requirements.txt makes deploy fail

前端 未结 1 603
感动是毒
感动是毒 2021-01-19 04:50

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

(gcloud.functions         


        
相关标签:
1条回答
  • 2021-01-19 05:25

    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.8
    numpy>=1.15.0
    requests>=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
    
    0 讨论(0)
提交回复
热议问题