Trying (and failing) to install PyTorch for CUDA 12.0

I have a new Lenovo machine with an Nvidia RTX 4080 running Windows 11, and am trying to install PyTorch under Anaconda. The machine came with CUDA 12.2, which I downgraded to 12.0 to make the PyTorch installation easier. But I’m having no luck. !nvcc --version confirms release 12.0, V12.0.76, and !nvidia-smi confirms Driver Version: 528.49 CUDA Version: 12.0.

I’ve tried the following, all without success, and with the noted results:

conda install torchvision torchaudio pytorch-cuda=12.0 -c pytorch -c nvidia
produces this error text:
PackagesNotFoundError: The following packages are not available from current channels: - pytorch-cuda=12.0

conda install pytorch torchvision torchaudio cudatoolkit=12.0 -c pytorch -c conda-forge
produces this error text:
PackagesNotFoundError: The following packages are not available from current channels: - cudatoolkit=12.0

pip install torch==2.0.1+cu121 -f https://download.pytorch.org/whl/cu120/torch_stable.html
produces this error text:

ERROR: Could not find a version that satisfies the requirement torch==2.0.1+cu121 (from versions: 2.0.0, 2.0.1)
ERROR: No matching distribution found for torch==2.0.1+cu121

pip install torch==1.12.1+cu120 torchvision==0.13.1+cu120 torchaudio==0.12.1
produces this error text:

ERROR: Could not find a version that satisfies the requirement torch==1.12.1+cu120 (from versions: 2.0.0, 2.0.1)
ERROR: No matching distribution found for torch==1.12.1+cu120

Thanks for your help!

The locally installed CUDA toolkit won’t be used if you install the PyTorch binaries as they ship with their own CUDA dependencies. Downgrading won’t make installing PyTorch easier or harder.
Which Python version are you using and is it still a supported one?

Thank you for replying so quickly! It’s Python 3.11.4.

Should be available e.g. via https://download.pytorch.org/whl/nightly/cu121/torch-2.1.0.dev20230811%2Bcu121-cp311-cp311-win_amd64.whl so unsure why pip cannot find it.

Maybe I’m doing this wrong, but I tried

pip install torch==2.0.1+cu121 -f https://download.pytorch.org/whl/nightly/cu121/torch-2.1.0.dev20230811%2Bcu121-cp311-cp311-win_amd64.whl

and got:

Looking in links: https://download.pytorch.org/whl/nightly/cu121/torch-2.1.0.dev20230811%2Bcu121-cp311-cp311-win_amd64.whl
Note: you may need to restart the kernel to use updated packages.
WARNING: Skipping page https://download.pytorch.org/whl/nightly/cu121/torch-2.1.0.dev20230811%2Bcu121-cp311-cp311-win_amd64.whl because the HEAD request got Content-Type: binary/octet-stream. The only supported Content-Types are application/vnd.pypi.simple.v1+json, application/vnd.pypi.simple.v1+html, and text/html
ERROR: Could not find a version that satisfies the requirement torch==2.0.1+cu121 (from versions: 2.0.0, 2.0.1, 2.1.0.dev20230811+cu121)
ERROR: No matching distribution found for torch==2.0.1+cu121

This worked:

pip install https://download.pytorch.org/whl/nightly/cu121/torch-2.1.0.dev20230811%2Bcu121-cp311-cp311-win_amd64.whl

And PyTorch now sees the GPU! Thanks very much!

1 Like

Pytorch version 2.1.0 or higher doesn’t work with Cuda 12.0
This is the error:

ImportError: /venv/lib/python3.10/site-packages/torch/lib/../../nvidia/cusparse/lib/libcusparse.so.12: undefined symbol: __nvJitLinkAddData_12_1, version libnvJitLink.so.12