How to install PyTorch with CUDA support on Windows 11 (CUDA 12)? – No Matching Distribution Found – Pytorch

by
Alexei Petrov
azure-pipelines dependencies llama-cpp-python pytorch

The Problem:

I want to install PyTorch with CUDA support on my Windows 11 machine, but when I try to install version 2.0.0 with CUDA 11.7 support using the pip command, I encounter an error stating that no matching distribution was found. The CUDA version currently installed on my machine is 12, and the output of the ‘nvcc –version’ command confirms this. Is there a way to install the correct version of PyTorch or resolve the distribution issue?

The Solutions:

Solution 1: Use pip to Install PyTorch with CUDA Support (Recommended)

For CUDA 11.7:

python3 -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117

For CUDA 11.8:

python3 -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

For CUDA 12.1 (PyTorch Nightly):

\

python3 -m pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu121

Note: As of September 9, 2023, cu12.1 is not available for a stable release.

Refer to PyTorch’s official page for more information: https://pytorch.org/get-started/locally/

Q&A

How to install PyTorch 2.0.0 with CUDA support on Windows?

Use pip to install PyTorch with the correct CUDA version index link.

What is the error when installing PyTorch?

No matching distribution found for the specified version of PyTorch.

How to install PyTorch Nightly for CUDA 12.1?

Use pip with the correct CUDA version index link.

Video Explanation:

The following video, titled "”[Solved", provides additional insights and in-depth exploration related to the topics discussed in this post.

Play video

This video provides further insights and detailed explanations related to the content discussed in the article.

Issues installing Pytorch 1.9 – No matching distribution found” description=”While installing Pytorch 1.9 using pip, it failed with error “No matching distribution found.” This video shows how I resolved this issue.”]