Trying (and failing) to install PyTorch for CUDA 12.0

sjfrank: <p>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.</p>
<p>I’ve tried the following, all without success, and with the noted results:</p>
<p><code>conda install torchvision torchaudio pytorch-cuda=12.0 -c pytorch -c nvidia</code><br>
produces this error text:<br>
<code>PackagesNotFoundError: The following packages are not available from current channels:  - pytorch-cuda=12.0</code></p>
<p><code>conda install pytorch torchvision torchaudio cudatoolkit=12.0 -c pytorch -c conda-forge</code><br>
produces this error text:<br>
<code>PackagesNotFoundError: The following packages are not available from current channels: - cudatoolkit=12.0</code></p>
<p><code>pip install torch==2.0.1+cu121 -f https://download.pytorch.org/whl/cu120/torch_stable.html</code><br>
produces this error text:</p>
<pre><code class="lang-auto">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
</code></pre>
<p><code>pip install torch==1.12.1+cu120 torchvision==0.13.1+cu120 torchaudio==0.12.1</code><br>
produces this error text:</p>
<pre><code class="lang-auto">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
</code></pre>
<p>Thanks for your help!</p>

ptrblck: <aside class="quote no-group" data-username="sjfrank" data-post="1" data-topic="186194">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/s/ac8455/48.png" class="avatar"> sjfrank:</div>
<blockquote>
<p>The machine came with CUDA 12.2, which I downgraded to 12.0 to make the PyTorch installation easier.</p>
</blockquote>
</aside>
<p>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.<br>
Which Python version are you using and is it still a supported one?</p>

sjfrank: <p>Thank you for replying so quickly!  It’s Python 3.11.4.</p>

ptrblck: <p>Should be available e.g. via <a href="https://download.pytorch.org/whl/nightly/cu121/torch-2.1.0.dev20230811%2Bcu121-cp311-cp311-win_amd64.whl">https://download.pytorch.org/whl/nightly/cu121/torch-2.1.0.dev20230811%2Bcu121-cp311-cp311-win_amd64.whl</a> so unsure why <code>pip</code> cannot find it.</p>

sjfrank: <p>Maybe I’m doing this wrong, but I tried</p>
<p><code>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</code></p>
<p>and got:</p>
<pre><code class="lang-auto">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
</code></pre>

sjfrank: <p>This worked:</p>
<p><code>pip install https://download.pytorch.org/whl/nightly/cu121/torch-2.1.0.dev20230811%2Bcu121-cp311-cp311-win_amd64.whl</code></p>
<p>And PyTorch now sees the GPU!  Thanks very much!</p>

ng123: <p>Pytorch version 2.1.0 or higher doesn’t work with Cuda 12.0<br>
This is the error:</p>
<pre><code class="lang-auto">ImportError: /venv/lib/python3.10/site-packages/torch/lib/../../nvidia/cusparse/lib/libcusparse.so.12: undefined symbol: __nvJitLinkAddData_12_1, version libnvJitLink.so.12

</code></pre>

mono: <p>i might have the same problem, can you help me, my company bought a rtx 4090</p>
<p>(environmentname) C:\Users\ahsan&gt;pip3 install torch torchvision torchaudio --index-url <a href="https://download.pytorch.org/whl/cu124" rel="noopener nofollow ugc">https://download.pytorch.org/whl/cu124</a><br>
Looking in indexes: <a href="https://download.pytorch.org/whl/cu124" rel="noopener nofollow ugc">https://download.pytorch.org/whl/cu124</a><br>
ERROR: Could not find a version that satisfies the requirement torch (from versions: none)<br>
ERROR: No matching distribution found for torch</p>
<p>windows11<br>
python version is 3.10.0<br>
just installed cuda:<br>
Cuda compilation tools, release 12.4, V12.4.99<br>
Build cuda_12.4.r12.4/compiler.33961263_0</p>
<p>i have tired python 3.11.0 as well as 3.12 but i get the same error</p>

mono: <p>it is solved: i had to download the pytorch manully from <a href="https://download.pytorch.org/whl/torch/" rel="noopener nofollow ugc">https://download.pytorch.org/whl/torch/</a>. Then i had to manually install it using pip.</p>

iqra: <p>!pip install torch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0 --index-url <a href="https://download.pytorch.org/whl/cu121" rel="noopener nofollow ugc">https://download.pytorch.org/whl/cu121</a><br>
ERROR: Could not find a version that satisfies the requirement torch==2.1.0 (from versions: 2.2.0+cu121, 2.2.1+cu121, 2.2.2+cu121, 2.3.0+cu121, 2.3.1+cu121, 2.4.0+cu121)<br>
ERROR: No matching distribution found for torch==2.1.0 kindly  help me what i need to do i am encountring this error</p>