Pip refuses to install torch with GPU

Alexander_Pollack: <p>Hello!</p>
<p>I am running Windows 10, with python 3.7.9, with pip 21.3.1, and CUDA 10.1 installed. I’ve had pytorch installed on this machine before but am having to reinstall after some changes were made. I previously had no issues, but now when I try to install as before, torch can only be installed with cpu backing. I am trying to install<br>
the full GPU version as I have in the past using Pip:</p>
<pre><code class="lang-auto">pip3 install torch==1.10.1 torchvision==0.10.2 torchaudio===0.10.1
</code></pre>
<p>However, this then results in me actually getting the version “torch==1.10.1+cpu”, which is not what I need. I checked the site to see if there was any changes and found this version:</p>
<pre><code class="lang-auto">pip3 install torch==1.10.1+cu101 torchvision==0.11.2+cu101 torchaudio===0.10.1+cu101
</code></pre>
<p>However, this results in me getting a version error stating:</p>
<pre><code class="lang-auto">ERROR: Could not find a version that satisfies the requirement torch==1.10.1+cu101 (from versions: 1.7.0, 1.7.1, 1.8.0, 1.8.1, 1.9.0, 1.9.1, 1.10.0, 1.10.1)
ERROR: No matching distribution found for torch==1.10.1+cu101
</code></pre>
<p>Does anyone know what is happening and why pip won’t allow this?</p>

smth: <p>you are missing the tags around <code>-f https://download.pytorch.org/...</code></p>
<p>for example, the current PyTorch install command is listed as:</p>
<pre><code class="lang-auto">pip3 install torch==1.10.1+cu113 torchvision==0.11.2+cu113 torchaudio===0.10.1+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html
</code></pre>

Alexander_Pollack: <p>Hey! Thanks for responding.</p>
<p>I have also tried using the tags as I’ve seen on the site, but when I do, I’m thrown a long error along the lines of:</p>
<pre><code class="lang-auto">ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

...

pip._vendor.urllib3.exceptions.ProtocolError: ("Connection broken: ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None)", ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))
</code></pre>
<p>Any ideas?</p>

smth: <p>I haven’t seen that error. But basically if you use anything that has a <code>+cu</code> tag, it has to be accompanied by a <code>-f https://download.pytorch.org/...</code>. Because the wheels with the <code>+cu</code> tags are not on the default PyPI repositories.</p>

Alexander_Pollack: <p>Thank you, that makes sense. Do you have any idea why the connection times out when I try to use the flag, or any potential resolutions you think may be worth a try?</p>

ptrblck: <p>You might be hitting a connection issue as described <a href="https://stackoverflow.com/questions/52328655/pip-cant-install-any-package">here</a> with some workarounds. Could you check, if e.g. specifying a proxy would work?</p>

Alexander_Pollack: <p>Thank you, this finally was what ended up working. I had to try out a handful before finding the one that eventually worked (for me it was using <code>--proxy 5.9.89.187:808</code>. Thanks again!</p>

josearangos: <p>To try used</p>
<p>pip install --find-links <a href="https://download.pytorch.org/whl/torch_stable.html" rel="noopener nofollow ugc">https://download.pytorch.org/whl/torch_stable.html</a><br>
torch==1.10.0+cpu</p>

FanfuSuzi: <p>Here are my thinking , maybe the reason “Could not find a version that satisfies the requirement torch==1.10.1+cu101(from versions:1.7.0 , 1.7.1, 1.8.0, 1.8.1, 1.9.0, 1.9.1, 1.10.0, 1.10.1)” is that your python version don`t support higher torch version. Try to build another environment with python==3.8 or 3.9 .</p>

ptrblck: <p>No, the reason for the error is that <code>1.10.1</code> wasn’t built with CUDA 10.1, but 10.2 as well as 11.3.</p>