Pytorch for CUDA12.0

ASHIYA_KANDHWAY: <p>Hi I’m trying to install pytorch for CUDA12.0, I have tried multiple ways to install it but constantly getting following error:<br>
I used the following command:</p>
<p>pip3 install --pre torch torchvision torchaudio --index-url <a href="https://download.pytorch.org/whl/nightly/cu121" rel="noopener nofollow ugc">https://download.pytorch.org/whl/nightly/cu121</a></p>
<p>ERROR: Could not find a version that satisfies the requirement torchvision (from versions: none)<br>
ERROR: No matching distribution found for torchvision</p>
<p>Can someone please help me out on this ?</p>

ptrblck: <p>It works for me:</p>
<pre data-code-wrap="python"><code class="lang-python">pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu121
...
Successfully installed nvidia-cublas-cu12-12.1.3.1 nvidia-cuda-cupti-cu12-12.1.105 nvidia-cuda-nvrtc-cu12-12.1.105 nvidia-cuda-runtime-cu12-12.1.105 nvidia-cudnn-cu12-8.9.2.26 nvidia-cufft-cu12-11.0.2.54 nvidia-curand-cu12-10.3.2.106 nvidia-cusolver-cu12-11.4.5.107 nvidia-cusparse-cu12-12.1.0.106 nvidia-nccl-cu12-2.19.3 nvidia-nvjitlink-cu12-12.1.105 nvidia-nvtx-cu12-12.1.105 pytorch-triton-2.1.0+6e4932cda8 torch-2.2.0.dev20231128+cu121 torchaudio-2.2.0.dev20231128+cu121 torchvision-0.17.0.dev20231128+cu121
</code></pre>
<p>Which Python version are you using?</p>

ASHIYA_KANDHWAY: <p>I am using python 3.12.0<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/0/f/0fac6d496775967234d936e76b7e55a3b38fbb3b.png" data-download-href="https://discuss.pytorch.org/uploads/default/0fac6d496775967234d936e76b7e55a3b38fbb3b" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/0/f/0fac6d496775967234d936e76b7e55a3b38fbb3b_2_690x330.png" alt="image" data-base62-sha1="2eEAgHgrkn4h4NfrGWUAHUmZBeb" width="690" height="330" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/0/f/0fac6d496775967234d936e76b7e55a3b38fbb3b_2_690x330.png, https://discuss.pytorch.org/uploads/default/optimized/3X/0/f/0fac6d496775967234d936e76b7e55a3b38fbb3b_2_1035x495.png 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/0/f/0fac6d496775967234d936e76b7e55a3b38fbb3b.png 2x" data-dominant-color="EDEDED"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">1150×550 72.7 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>

ASHIYA_KANDHWAY: <p>Found conflicts! Looking for incompatible packages.<br>
This can take several minutes.  Press CTRL-C to abort.<br>
failed</p>
<p>UnsatisfiableError: The following specifications were found<br>
to be incompatible with the existing python installation in your environment:</p>
<p>Specifications:</p>
<ul>
<li>pytorch → python[version=‘&gt;=2.7,&lt;2.8.0a0|&gt;=3.10,&lt;3.11.0a0|&gt;=3.11,&lt;3.12.0a0|&gt;=3.8,&lt;3.9.0a0|&gt;=3.9,&lt;3.10.0a0|&gt;=3.7,&lt;3.8.0a0|&gt;=3.6,&lt;3.7.0a0|&gt;=3.5,&lt;3.6.0a0’]</li>
<li>torchaudio → python[version=‘&gt;=3.10,&lt;3.11.0a0|&gt;=3.11,&lt;3.12.0a0|&gt;=3.9,&lt;3.10.0a0|&gt;=3.8,&lt;3.9.0a0|&gt;=3.7,&lt;3.8.0a0|&gt;=3.6,&lt;3.7.0a0|&gt;=3.5,&lt;3.6.0a0’]</li>
<li>torchvision → python[version=‘&gt;=2.7,&lt;2.8.0a0|&gt;=3.10,&lt;3.11.0a0|&gt;=3.8,&lt;3.9.0a0|&gt;=3.9,&lt;3.10.0a0|&gt;=3.11,&lt;3.12.0a0|&gt;=3.7,&lt;3.8.0a0|&gt;=3.6,&lt;3.7.0a0|&gt;=3.5,&lt;3.6.0a0’]</li>
</ul>
<p>Your python: python=3.12</p>
<p>If python is on the left-most side of the chain, that’s the version you’ve asked for.<br>
When python appears to the right, that indicates that the thing on the left is somehow<br>
not available for the python version you are constrained to. Note that conda will not<br>
change your python version to a different minor version unless you explicitly specify<br>
that.</p>
<p>The following specifications were found to be incompatible with each other:</p>
<p>Output in format: Requested package → Available versions</p>
<p>Package libgcc conflicts for:<br>
pytorch → libgcc<br>
torchvision → pytorch → libgcc</p>
<p>Package pytorch-cuda conflicts for:<br>
torchvision → pytorch-cuda[version=‘11.6.<em>|11.7.</em>|11.8.<em>|12.1.</em>’]<br>
torchaudio → pytorch-cuda[version=‘11.6.<em>|11.7.</em>|11.8.<em>|12.1.</em>’]<br>
pytorch → pytorch-cuda[version=‘&gt;=11.6,&lt;11.7|&gt;=11.7,&lt;11.8|&gt;=11.8,&lt;11.9|&gt;=12.1,&lt;12.2’]<br>
torchaudio → pytorch==2.1.1 → pytorch-cuda[version=‘&gt;=11.6,&lt;11.7|&gt;=11.7,&lt;11.8|&gt;=11.8,&lt;11.9|&gt;=12.1,&lt;12.2’]<br>
torchvision → pytorch==2.1.1 → pytorch-cuda[version=‘&gt;=11.6,&lt;11.7|&gt;=11.7,&lt;11.8|&gt;=11.8,&lt;11.9|&gt;=12.1,&lt;12.2’]</p>
<p>Package ca-certificates conflicts for:<br>
python=3.12 → openssl[version=‘&gt;=3.1.3,&lt;4.0a0’] → ca-certificates<br>
torchvision → python[version=‘&gt;=2.7,&lt;2.8.0a0’] → ca-certificates<br>
pytorch → python[version=‘&gt;=2.7,&lt;2.8.0a0’] → ca-certificates</p>
<p>Package pytorch conflicts for:<br>
torchaudio → pytorch[version=‘1.10.0|1.10.1|1.10.2|1.11.0|1.12.0|1.12.1|1.13.0|1.13.1|2.0.0|2.0.1|2.1.0|2.1.1|1.9.1|1.9.0|1.8.1|1.8.0|1.7.1|1.7.0|1.6.0|1.5.1’]<br>
torchvision → pytorch[version=‘1.1.<em>|1.10.0|1.10.1|1.10.2|1.11.0|1.12.0|1.12.1|1.13.0|1.13.1|2.0.0|2.0.1|2.1.0|2.1.1|1.9.1|1.9.0|1.8.1|1.8.0|1.7.1|1.7.0|1.6.0|1.5.1|1.7.1.</em>|1.3.1.<em>|1.2.0.</em>|&gt;=0.4|&gt;=0.3’]The following specifications were found to be incompatible with your system:</p>
<ul>
<li>feature:/linux-64::__cuda==12.0=0</li>
<li>feature:/linux-64::__glibc==2.31=0</li>
<li>feature:|@/linux-64::__cuda==12.0=0</li>
<li>python=3.12 → libgcc-ng[version=‘&gt;=11.2.0’] → __glibc[version=‘&gt;=2.17’]</li>
<li>pytorch → __cuda[version=‘&gt;=11.8’]</li>
<li>pytorch → cudatoolkit[version=‘&gt;=11.3,&lt;11.4’] → __glibc[version=‘&gt;=2.17|&gt;=2.17,&lt;3.0.a0’]</li>
<li>torchaudio → cudatoolkit[version=‘&gt;=11.6,&lt;11.7’] → __glibc[version=‘&gt;=2.17,&lt;3.0.a0’]</li>
<li>torchaudio → pytorch==2.0.1 → __cuda[version=‘&gt;=11.8’]</li>
<li>torchvision → __glibc[version=‘&gt;=2.17,&lt;3.0.a0’]</li>
<li>torchvision → libgcc-ng[version=‘&gt;=11.2.0’] → __glibc[version=‘&gt;=2.17’]</li>
<li>torchvision → pytorch==2.0.1 → __cuda[version=‘&gt;=11.8’]</li>
</ul>
<p>Your installed version is: 2.31</p>
<p>This is the error I am getting after I ran :  conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia</p>
<p>If I downgrade python version I get conflicts with torchaudio and torchvision.</p>

ptrblck: <p>Python 3.12 is not supported yet, if I’m not mistaken, so downgrade to e.g. 3.10.</p>

ASHIYA_KANDHWAY: <p>Thanks a lot! It worked.</p>