Want to install pytorch for custom cuda version (cuda =11.2)

sarabhian: <p>I am looking for a guide to install Pytorch successfully , I have a system where I use cuda toolkit == 11.2.2 for tensorflow , but now I want to install pytorch for same version of cuda which is 11.2.2 ,<br>
I just want to keep my installations minimum and don’t wan’t to install different cuda versions for pytorch and tensorflow.</p>
<p>so please help me installing pytorch capable to run on gpu without reinstalling any new cuda libraries</p>

ptrblck: <p>You could build PyTorch from source as described <a href="https://github.com/pytorch/pytorch#from-source">here</a> using your locally installed CUDA 11.2 toolkit.</p>

shape_mismatch: <p>Thanks for the reply. But from the instructions, it seems I would need system administrator privileges to install <a href="https://docs.nvidia.com/gameworks/content/gameworkslibrary/nvtx/nvidia_tools_extension_library_nvtx.htm" rel="noopener nofollow ugc">NVTX</a> for a CUDA based build. Which is not a possibility for me on a huge shared server with no virtualisation. Are you aware of a repository which might provide precompiled distributions for 11.2? Alternatively, do you know if CUDA 11.0 compiled torch is (by and large) compatible with 11.2 drivers?</p>
<p>Thanks a lot!</p>

ptrblck: <p>No, I’m not aware of pre-built binaries using the latest PyTorch release with CUDA 11.2.</p>
<p>Yes, CUDA11.x drivers are all compatible. In your use case you are depending on backwards compatibility, which should just work. CUDA 11 introduced minor version compatibility, which also allows forward compatibility in 11.x releases.</p>

shape_mismatch: <p>Thanks! You were right, CUDA 11.1 compiled torch works for my system.</p>

Mikel_Mujika: <p>Hi <a class="mention" href="/u/shape_mismatch">@shape_mismatch</a> ,</p>
<p>How did you get torch for 11.1 CUDA?</p>

shape_mismatch: <p>Hi. You can find all previous binaries on this page - <a href="https://pytorch.org/get-started/previous-versions/" class="inline-onebox" rel="noopener nofollow ugc">Previous PyTorch Versions | PyTorch</a></p>
<p>You could do a search for “11.1” there and you’ll find it. <img src="https://discuss.pytorch.org/images/emoji/apple/slight_smile.png?v=12" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>

Shittheswaran_Selvak: <p>currently i am using CUDA 11.2,CuDNN 11.2(v8.1.0.77),OpenCV 4.5.2,Cmake 3.19.6 and Python (3.10.9) from Anaconda environment.Currently i am working a Custom data object detection project using Yolov4 Darknet. Afteri sucessfully completing the training the model iwant to convert the trianed modell into Pytorch (i.e) from Darknet to Pytorch.so currently i am in need of installing the pytorch which suits the CUDA 11.2.But in Pytorch webpage there is no pytorch for CUDA 11.2.so in this case can i use the CUDA 11.1 for the Pytorch ? if i can use CUDA 11.1… there are 10 different versions of CUDA 11.1 in the pytorch website.Amoung those ten different versions,which version can i use ? can someone give me a suggestion?</p>

bilalomar: <p>this popped up for my requirement : pip install torch==1.10.1+cu111 torchvision==0.11.2+cu111 torchaudio==0.10.1 -f <a href="https://download.pytorch.org/whl/cu111/torch_stable.html" rel="noopener nofollow ugc">https://download.pytorch.org/whl/cu111/torch_stable.html</a></p>
<p>but it shows error:</p>
<p>ERROR: Could not find a version that satisfies the requirement torch==1.10.1+cu111 (from versions: 1.11.0, 1.12.0, 1.12.1, 1.13.0, 1.13.1, 2.0.0, 2.0.1)<br>
ERROR: No matching distribution found for torch==1.10.1+cu111</p>

bilalomar: <p>Hii, have you found the solution?</p>

ptrblck: <p>I don’t know why you want to install this old release, but you can find <code>1.10.1+cu111</code> using these links for your corresponding Python version:</p>
<pre><code class="lang-auto">https://download.pytorch.org/whl/cu111/torch-1.10.1%2Bcu111-cp36-cp36m-linux_x86_64.whl
https://download.pytorch.org/whl/cu111/torch-1.10.1%2Bcu111-cp37-cp37m-linux_x86_64.whl
https://download.pytorch.org/whl/cu111/torch-1.10.1%2Bcu111-cp38-cp38-linux_x86_64.whl
https://download.pytorch.org/whl/cu111/torch-1.10.1%2Bcu111-cp39-cp39-linux_x86_64.whl
</code></pre>

Manish_Patel: <p>I was able to install  cuda 11.2 version with pytorch by following these steps:</p>
<ol>
<li>Create a new conda environment with python 3.8</li>
</ol>
<p><code>conda create -n torch python=3.8</code></p>
<p>2.Install cuda11.2 using following<br>
<code>conda install pytorch==1.10.1 torchvision torchaudio cudatoolkit=11.2 -c pytorch-lts -c nvidia</code></p>

Anar: <p><code>pip install torch==1.13.0 torchvision==0.14.0 torchaudio==0.13.0</code></p>
<p>worked for: <em>GeForce RTX 3090 | CUDA 11.2</em></p>

onlymeaily: <p>Might your python version is &gt; 3.9<br>
I meet the same question<br>
you could use virtual environment by py3.9<br>
and I have the other question<br>
ERROR: No matching distribution found for torchvision==0.11.2+cu111<br>
I don’t know how to settle it</p>

Kon33Krit33: <ol>
<li>
<p>conda create -n new_tf_gpu_env python=3.9</p>
</li>
<li>
<p>pip install tensorflow-gpu==2.10</p>
</li>
</ol>
<p>Ready to go!</p>