ERROR: Could not find a version that satisfies the requirement torch (from versions: none) ERROR: No matching distribution found for torch
Asked Answered
N

6

8

I tried to download torch by using pip install torch

I faced this problem:

C:\Users\Ahmad Sadek>pip install torch
ERROR: Could not find a version that satisfies the requirement torch (from versions: none)
ERROR: No matching distribution found for torch
Nocturne answered 4/2, 2022 at 13:1 Comment(3)
Please try pip install -vvv torch and see what it says.Pelvis
using -vvv made it clear that none of the build versions match my current architecture (mine is arm64, which I found it by running $ arch), so it was not a python incompatibility (in case anyone is also spending a lot of time going through this rabbit hole) thanks @PelvisBookrack
Can you explain how you resolved that issue? I'm getting the same error but don't understand the outputs of pip install -vvv torchSerpent
P
8

It isn't officially supported by 3.10 yet. Use the nightly builds:

pip3 install --pre torch -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
Pius answered 5/2, 2022 at 16:23 Comment(2)
ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: 'C:\\Users\\Ahmad Sadek\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\caffe2\\python\\serialized_test\\data\\operator_test\\collect_and_distribute_fpn_rpn_proposals_op_test.test_collect_and_dist.zip' HINT: This error might have occurred since this system does not have Windows Long Path support enabled. You can find information on how to enable this at pip.pypa.io/warnings/enable-long-pathsNocturne
@AhmadSadekAlbasatneh you need to enable long paths, pip.pypa.io/warnings/enable-long-pathsPius
B
2

As per previous answers, python versions greater than 3.7 are not currently supported on the stable release.

Options are:

  1. Keep Python > 3.7: Use the Nightly version - modify the installation configuration from PyTorch website as per your needs (Win/Lin/Mac, CUDA version). For example: Nightly, Windows, pip, cuda 11.8 is:

pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu118
  1. revert to an earlier version of Python, e.g. 3.7 and install Stable release of PyTorch. E.g.:

pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu117
  1. Use Anaconda which seems to resolve issues, eventually (see image)

screenshot_anaconda_install_pytorch

Birthright answered 17/2, 2023 at 11:57 Comment(0)
F
0

This occurs if you are on a version of python greater than 3.7 on Windows. PyTorch specifies on their website that versions later than 3.7 are not supported. I had this error show up for me on my Windows machine when using 3.8. After installing 3.7 and setting that as the default python the issue resolved.

Fitzger answered 2/9, 2022 at 5:8 Comment(0)
F
0

I had the same problem what worked for me is, I opened python in venv/scripts/python.exe it was 3.11. something so I deleted the scripts folder and installed 3.10.6 and run webuser and it worked :)

Flocky answered 13/4, 2023 at 6:45 Comment(0)
J
0

install 3.10.6 version python, del venv file, and uninstalled earlier python version, and run webui-user.bat, it works

thankyou @impotent profile very it works

Jamille answered 1/2 at 12:23 Comment(1)
Please don't add "thank you" as an answer. Once you have sufficient reputation, you will be able to vote up questions and answers that you found helpful. - From ReviewRomish
O
0

Compiling many answers into one: make sure your python version is supported. From my standpoint, troubleshooting is hindered by the fact https://download.pytorch.org/whl/ does not list all what is really there, for example, it does have cu124 directory but you won't see it if you just list .../whl/. Also, https://pytorch.org/get-started/locally/ tells us the recommended version but my investigation shows the list is wider, but not for all drivers/arch/OS/etc.

So, step-by-step:

  1. check your CUDA version: try nvidia-smi or nvcc --version or whatever is for your system. It makes no sense to move ahead until you have CUDA ok.
  2. check here https://pytorch.org/get-started/locally/ what's the closest available version, in some pip options (and this question is about pip installation) you'll see something like pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
  3. get that url, modify it to match your version oad try to open in the browser. If the exact version does not exist then fallback to any older available. E.g. https://download.pytorch.org/whl/cu122 returns "access denied", so I switched to 121.
  4. you'll see a list of packages. Open torch.
  5. you'll see many links to .whl files, like this: torch-2.4.0+cu121-cp38-cp38-linux_x86_64.whl
  6. find the matching version: in the example above 2.4.0 is the library version, cu121 is the driver version, cp38-cp38 is for python 3.8, then os and arch. So, if there's no link for your combination you can try "the-same-but-older-python" or "the-same-but-older-library"
  7. install the required python version, make sure the correct one is activated (python -V, pip3 -V) then run that pip3 install...
  8. test: python3 -c "import torch; print(torch.__version__); print(torch.version.cuda);print(torch.cuda.is_available())"
Overblown answered 20/8 at 9:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.