Reputation: 839
I'm trying to deploy a function on Cloud functions and I'm having trouble getting pytorch to work. I need either version 1.1, 1.2 or 1.3 (any version that has torch.hub
functionality)
Here is what I have been trying in the requirments.txt for my function:
numpy==1.17.2
https://download.pytorch.org/whl/cpu/torch-1.1.0-cp27-cp27mu-linux_x86_64.whl
Which results in the error:
Build failed: {"error": {"canonicalCode": "INVALID_ARGUMENT", "errorMessage": "`pip_download_wheels` had stderr output:\ntorch-1.1.0-cp27-cp27mu-linux_x86_64.whl is not a supported wheel on this platform.\n\nerror: `pip_download_wheels` returned code: 1", "errorType": "InternalError", "errorId": XXX}}
And of course trying the various other url for 1.2
and 1.3
and the same thing happens.
What can I do to fix this/ what am I doing wrong??
Appreciate the help.
-if this affects anything, I'm using Python 3.7 for my function and have been using the linux packages.
__________________________________________________________________________
Edit: I've tried this in my requirments.txt:
numpy==1.17.0
torch==1.3.0
torchvision===0.4.1
And I now get the error:
Build failed: {"cacheStats": [{"status": "MISS", "hash": "1f6ebb5b3667b3d677184dbf04b82666XXX", "type": "docker_layer_cache", "level": "global"}, {"status": "MISS", "hash": "1f6ebb5b3667b3d677184dbf04b826660b67c784608d4e4XXXXX", "type": "docker_layer_cache", "level": "project"}]}
I've never had this error with any other library on cloud functions. If anyone has other suggestions it would be greatly appreciated.
Upvotes: 1
Views: 165
Reputation: 839
For anyone who runs into this problem in the future, this is (one of) the methods you can use:
numpy==1.17.0
https://download.pytorch.org/whl/cpu/torch-1.1.0-cp37-cp37m-linux_x86_64.whl
Note the main difference being the cp37
as mentioned by Natthaphon Hongcharoen
above.
Upvotes: 0
Reputation: 2440
That cp27
means it's for python2.7. It's actually not a good idea to install from url, use the package name istead(like numpy==1.17.2)
Try something like pip3 install torch torchvision
, this will give the latest stable(1.3) version with cuda 10.
Look at the pytorch's home page - https://pytorch.org/ - for reference
Upvotes: 2