I'm trying to install PyTorch with CUDA support on my Windows 11 machine, which has CUDA 12 installed and python 3.10. When I run nvcc --version, I get the following output:
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Tue_Aug_15_22:09:35_Pacific_Daylight_Time_2023
Cuda compilation tools, release 12.2, V12.2.140
Build cuda_12.2.r12.2/compiler.33191640_0
I'd like to install PyTorch version 2.0.0 with CUDA support, so I attempted to run the following command:
python -m pip install torch==2.0.0+cu117
However, I encountered the following error:
ERROR: Could not find a version that satisfies the requirement torch==2.0.0+cu117 (from versions: 1.11.0, 1.12.0, 1.12.1, 1.13.0, 1.13.1, 2.0.0, 2.0.1)
ERROR: No matching distribution found for torch==2.0.0+cu117
Does anyone have any suggestions?
To install PyTorch using pip or conda, it's not mandatory to have an nvcc (CUDA runtime toolkit) locally installed in your system; you just need a CUDA-compatible device.
To install PyTorch (2.0.1 with CUDA 11.7), you can run:
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117
For CUDA 11.8, run:
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
If you want to use CUDA 12.1, you can install PyTorch Nightly using: (FYI: as of today (Sep 9, 2023), cu12.1 is not available for a stable release.)
pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu121
You can find more details on PyTorch's official page: https://pytorch.org/get-started/locally/.
I hope it helps you. Thank you!