PyTorch with CUDA support is not installed, although everything worked before that

GameSD: <p>Everything worked fine for about 2 years. Unexpectedly, I discovered an error connecting to CUDA today.</p>
<p>Now the <code>torch.cuda.is_available()</code> function is <strong>False</strong>, and the <code>torch.zeros(1).cuda()</code> command returns the error: <em>Torch is not compiled with CUDA enabled.</em> It’s very similar to the fact that I have a version of torch installed without CUDA, but I didn’t change anything and just a couple of days ago I was quietly using CUDA.</p>
<p>If you type “nvidia-smi” into the console:<br>
NVIDIA-SMI 576.02 Driver Version: 576.02 CUDA Version: 12.9<br>
…</p>
<p>I deleted torch to reinstall it, but an error occurs when trying to install it:<br>
<code>pip3 install torch torchvision --index-url https://download.pytorch.org/whl/сu129</code></p>
<p><code>WARNING: Ignoring invalid distribution -illow</code><br>
<code>WARNING: Ignoring invalid distribution -pencv-python</code><br>
<code>ERROR: Could not find a version that satisfies the requirement torch (from versions: none)</code><br>
<code>ERROR: No matching distribution found for torch</code></p>
<p>I tried other variations of the installation commands, but nothing works, the errors are similar:<br>
<code>pip3 install torch==2.8.0 torchvision==0.23.0 torchaudio==2.8.0 --index-url https://download.pytorch.org/whl/cu128</code></p>
<p>and other versions of cu121, cu126, cu130</p>
<p><code>pip install torch==2.9.0+cu128 --index-url https://download.pytorch.org/whl/cu128</code><br>
<code>Looking in indexes: https://download.pytorch.org/whl/cu128</code><br>
<code>ERROR: Could not find a version that satisfies the requirement torch==2.9.0+cu128 (from versions: none)</code><br>
<code>ERROR: No matching distribution found for torch==2.9.0+cu128</code></p>
<p>I have Python 3.10.2 (64bit)</p>
<p>How do I install pytorch with CUDA? Why did everything work on CUDA a couple of days ago, but now it doesn’t? In the Task Manager, I made sure that CUDA is present, but something prevents me from installing and connecting the library to it.</p>

ptrblck: <aside class="quote no-group" data-username="GameSD" data-post="1" data-topic="223662">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/g/bb73d2/48.png" class="avatar"> GameSD:</div>
<blockquote>
<p>How do I install pytorch with CUDA?</p>
</blockquote>
</aside>
<p>Please refer to our <a href="https://pytorch.org/get-started/locally/">install instructions</a>. E.g. a simple <code>pip install torch</code> will install the latest stable PyTorch release (2.9.0) with CUDA support (12.8) on Linux x86.</p>
<aside class="quote no-group" data-username="GameSD" data-post="1" data-topic="223662">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/g/bb73d2/48.png" class="avatar"> GameSD:</div>
<blockquote>
<p>Why did everything work on CUDA a couple of days ago, but now it doesn’t?</p>
</blockquote>
</aside>
<p>Unfortunately, we would not know what exactly happened to your setup. Based on your description I guess a new virtual environment was created and the CPU-only PyTorch binary was installed. The other installation errors are often raised e.g. if an unsupported Python version is used (e.g. an old version or the 32 bit version).</p>