Why conda installs old pytorch with by default with cudatoolkit=11.2

Krishna_Garg: <p>I am trying to install <code>conda</code> for <code>cudatoolkit=11.2</code> on google colab using:</p>
<pre><code class="lang-auto">conda install pytorch cudatoolkit=11.2 -c pytorch -c nvidia
</code></pre>
<p>But why does it install old <code>pytorch=1.0.0</code> version not something <code>&gt;1.6</code>?</p>
<p>If I try to force install <code>pytorch=1.6</code>, it gives the following error:</p>
<pre><code class="lang-auto">UnsatisfiableError: The following specifications were found to be incompatible with a past
explicit spec that is not an explicit spec in this operation (cudatoolkit):

  - cudatoolkit=11.2
  - pytorch=1.6 -&gt; cudatoolkit[version='&gt;=10.1,&lt;10.2|&gt;=10.2,&lt;10.3|&gt;=9.2,&lt;9.3']

The following specifications were found to be incompatible with each other:

Output in format: Requested package -&gt; Available versions

Package setuptools conflicts for:
setuptools
python=3.7 -&gt; pip -&gt; setuptools
conda[version='&gt;=4.10.3'] -&gt; setuptools[version='&gt;=31.0.1']
wheel -&gt; setuptools
pip -&gt; setuptools
...
</code></pre>
<p>I basically want to work with the latest versions of pytorch with <code>cudatoolkit=11.2</code>.</p>

ptrblck: <p>The PyTorch binaries are not built with CUDA11.2 and you would have to stick to the install commands provided <a href="https://pytorch.org/get-started/locally/">here</a>.</p>

Krishna_Garg: <pre><code class="lang-auto">conda install pytorch cudatoolkit=11.1 -c pytorch -c nvidia
</code></pre>
<p>Can this work for even <code>cudatoolkit=11.2</code>?</p>

ptrblck: <p>No, you cannot install the PyTorch binaries built with CUDA11.2, since they are not available.<br>
If you want to use this specific CUDA version, you could build from source.<br>
Alternatively, you could install the nightly binaries with CUDA11.3 using:</p>
<pre><code class="lang-python">pip install --pre torch -f https://download.pytorch.org/whl/nightly/cu113/torch_nightly.html
</code></pre>

Krishna_Garg: <p>Thanks for the reply, I guess you overlooked <code>cudatoolkit=11.1</code> in my previous reply?</p>

ptrblck: <p>No, I haven’t overlooked it.<br>
Your posted command using <code>cudatoolkit=11.1</code> will work.</p>
<aside class="quote no-group" data-username="Krishna_Garg" data-post="3" data-topic="131140">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/krishna_garg/48/17850_2.png" class="avatar"> Krishna_Garg:</div>
<blockquote>
<p>Can this work for even <code>cudatoolkit=11.2</code>?</p>
</blockquote>
</aside>
<p>No, this won’t work.</p>

Krishna_Garg: <p>ok. I am curious why it did install cudatoolkit=11.1 even though my cuda version is actually 11.2.</p>

ptrblck: <p>The binaries ship with their own CUDA runtime so your local CUDA toolkit (assuming that’s what you mean by “cuda 11.2”) won’t be used unless you are building from source or a custom CUDA extension.</p>

NGluna03: <p>So this solution should work also with cuda version 11.2, isn’t it?</p>

ptrblck: <p>I’m unsure which “solution” you are referring to, but in case it’s my <a href="https://discuss.pytorch.org/t/why-conda-installs-old-pytorch-with-by-default-with-cudatoolkit-11-2/131140/2">initial post</a> mentioning to use the supported install commands, then yes. The PyTorch binaries use their own CUDA runtime and your local CUDA toolkit will only be used if you are building from source or a custom CUDA extension.</p>

NGluna03: <p>I’m reffering to the following command:</p>
<p>pip install --pre torch -f <a href="https://download.pytorch.org/whl/nightly/cu113/torch_nightly.html" rel="noopener nofollow ugc">https://download.pytorch.org/whl/nightly/cu113/torch_nightly.html</a></p>
<p>Would it allow me to use pytorch with cuda 11.2?</p>

ptrblck: <p>No, since the PyTorch binaries were not built for CUDA 11.2.</p>