Installing PyTorch with CUDA in setup.py
Asked Answered
C

2

6

I'm trying to specify PyTorch with CUDA in install_requires. The command to install with pip is

pip install torch==1.8.0+cu111 torchvision==0.9.0+cu111 torchaudio===0.8.0 -f https://download.pytorch.org/whl/torch_stable.html

How do I do that in the setup.py install_requires?

Custom answered 21/3, 2021 at 23:3 Comment(1)
You can specify the wheel file https://mcmap.net/q/190666/-heroku-slug-size-too-large-after-installing-pytorchUn
D
4

I also faced same problem later I fixed it but using this in setup.py files and it worked, just add these lines as in your setup.py file.

"torch@https://download.pytorch.org/whl/cu111/torch-1.8.0%2Bcu111-cp37-cp37m-linux_x86_64.whl",
"torchvision@https://download.pytorch.org/whl/cu111/torchvision-0.9.0%2Bcu111-cp37-cp37m-linux_x86_64.wh",
"torchaudio@https://download.pytorch.org/whl/torchaudio-0.8.0-cp36-cp36m-linux_x86_64.whl"

All these are for linux version if you wantr any MACOSX or windows just change the link after @ in each line you can get link of your desired version from https://download.pytorch.org/whl/torch_stable.html

Delusion answered 7/10, 2021 at 17:49 Comment(0)
I
0

As of (the just released) PyTorch v2.1.0, you no longer have to specify the PyTorch CUDA-specific wheel (for Linux at least). If you can use CUDA 12.1, then you can just have "torch >= 2.1.0" as the dependency.

Inspiratory answered 5/10, 2023 at 10:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.