Pip refuses to install torch with GPU

Hello!

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
the full GPU version as I have in the past using Pip:

pip3 install torch==1.10.1 torchvision==0.10.2 torchaudio===0.10.1

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:

pip3 install torch==1.10.1+cu101 torchvision==0.11.2+cu101 torchaudio===0.10.1+cu101

However, this results in me getting a version error stating:

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

Does anyone know what is happening and why pip won’t allow this?

you are missing the tags around -f https://download.pytorch.org/...

for example, the current PyTorch install command is listed as:

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

Hey! Thanks for responding.

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:

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))

Any ideas?

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

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?

You might be hitting a connection issue as described here with some workarounds. Could you check, if e.g. specifying a proxy would work?

1 Like

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 --proxy 5.9.89.187:808. Thanks again!