Specify cuda version in setup.py when pip install -e .
see: https://stackoverflow.com/questions/66738473/installing-pytorch-with-cuda-in-setup-py
In setup function, use something like:
1"torch@https://download.pytorch.org/whl/cu111/torch-1.8.0%2Bcu111-cp37-cp37m-linux_x86_64.whl",2"torchvision@https://download.pytorch.org/whl/cu111/torchvision-0.9.0%2Bcu111-cp37-cp37m-linux_x86_64.wh",3"torchaudio@https://download.pytorch.org/whl/torchaudio-0.8.0-cp36-cp36m-linux_x86_64.whl"
version links are from: https://download.pytorch.org/whl/torch_stable.html
- method above is ok to download, but still failed to build.
The following succeeds for building sam-2 with cu118:
1pip install torch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 --index-url https://download.pytorch.org/whl/cu1182pip install --no-build-isolation -e .3# and delete these packages in `setup.py`