AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
142.91k stars 26.94k forks source link

[Bug]: Could not find a version that satisfies the requirement torch==1.12.1+cu113 #5485

Closed TheCarpetMerchant closed 1 year ago

TheCarpetMerchant commented 1 year ago

Is there an existing issue for this?

What happened?

RuntimeError: Couldn't install torch.
Command: "E:\AI\stable-diffusion-webui\venv\Scripts\python.exe" -m pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 --extra-index-url https://download.pytorch.org/whl/cu113
Error code: 1
stdout: Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cu113

stderr: ERROR: Could not find a version that satisfies the requirement torch==1.12.1+cu113 (from versions: none)
ERROR: No matching distribution found for torch==1.12.1+cu113

Steps to reproduce the problem

  1. Install Python 3.10.6
  2. git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
  3. Run webui-user.bat

What should have happened?

The project should use an available version of torch.

Commit where the problem happens

44c46f0ed395967cd3830dd481a2db759fda5b3b

What platforms do you use to access UI ?

Windows

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

No response

Additional information, context and logs

No response

TheCarpetMerchant commented 1 year ago

Note : I saw #5410 and I have restarted the machine.

PixelDough commented 1 year ago

Having this same issue

wywywywy commented 1 year ago

Try and update pip first.

"E:\AI\stable-diffusion-webui\venv\Scripts\python.exe" -m pip install --upgrade pip

Also use the latest Python (3.10.8) if possible.

TheCarpetMerchant commented 1 year ago

I tried Python .8 and 11.0, didn't work. Pip upgrading didn't work. What did work was using the docker image.

naanacchi commented 1 year ago

Having same issues there, Freshly installed. Zrzut ekranu 2022-12-07 154402

wywywywy commented 1 year ago

You can't use 3.11 yet. It's not supported.

saladplainzone commented 1 year ago

A friend of mine is getting the same error, on 3.10.6, fresh setup

tfrancis commented 1 year ago

The error seems related to an unsupported version of Python.

I had previously installed 3.11 and it isn't supported. I later installed Python 3.10.6, but stable-diffusion-webui had already created a virtual environment with the previously installed unsupported version of Python upon first run. Resetting the virtual environment resolved this error for me.

Here are steps I used to resolve this error on Windows 11:

  1. Delete the venv directory
  2. Install Python 3.10.06
  3. Run webui.bat to re-establish the stable-diffusion-webui virtual environment (venv directory will be recreated with Python 3.10.6).

Perhaps the Python version could be checked for a supported version prior to creating the virtual environment to avoid this error.

cooperdk commented 1 year ago

The error seems related to an unsupported version of Python.

I had previously installed 3.11 and it isn't supported. I later installed Python 3.10.6, but stable-diffusion-webui had already created a virtual environment with the previously installed unsupported version of Python upon first run. Resetting the virtual environment resolved this error for me.

Here are steps I used to resolve this error on Windows 11:

  1. Delete the venv directory
  2. Install Python 3.10.06
  3. Run webui.bat to re-establish the stable-diffusion-webui virtual environment (venv directory will be recreated with Python 3.10.6).

Perhaps the Python version could be checked for a supported version prior to creating the virtual environment to avoid this error.

I think it does, but only downwards. I was once told that I was running an unsupported version of Python, but it worked since it was a 3.9.

ImagineerNL commented 1 year ago

Try and update pip first.

"E:\AI\stable-diffusion-webui\venv\Scripts\python.exe" -m pip install --upgrade pip

Also use the latest Python (3.10.8) if possible.

Besides the obvious (changing the directory to my own directory) this resolved my issue.

TheCarpetMerchant commented 1 year ago

I'm still having the issue on my machine. The culprit is clearing the resolution of the torch version, but since the docker image works without trouble I'm unsubscribing from this issue but leaving it open for others. Good luck guys,

pedromichel23 commented 1 year ago

A friend of mine is getting the same error, on 3.10.6, fresh setup

If he tried first with other version of python the error continue; I delete the folder, downloaded again and tried with version 3.10.6 of python, because I haved the same issue, the problem was solved.

aliencaocao commented 1 year ago

If you bother to check out Pytorch's official website, they stated clearly that support is from python 3.7 to 3.10 (3.9 on the website but 3.10 is actually supported). This is not a bug.

cooperdk commented 1 year ago

If you bother to check out Pytorch's official website, they stated clearly that support is from python 3.7 to 3.10 (3.9 on the website but 3.10 is actually supported). This is not a bug.

I bothered.

https://pytorch.org/get-started/locally/

It just says that Linux distributions usually come with 3.7.

And then it says that they recommend to use 3.6, 3.7 or 3.8.

If 3.10 is supported, then our is at least not recommended, nor is 3.9.

And if 3.10 "is supported" as you say, then 3.10.6 is since the last digit according to semver just means that it is the sixth patch of the same minor version that you claim the Web UI requires. Thus is should work. It doesn't, because 3.10 is not supported.

This is on par with the very clear message on the same page (Windows button):

"Currently, PyTorch on Windows only supports Python 3.7-3.9".

Oops. No version of Python past 3.9 is supported...

So the developer should actually revert the Python requirement to 3.9 or even 3.8 as this might clear up a lot of issues people have. I bet that most people use this repo on Windows which means the developer should agere to the supported versions as specified on the official website.

Usually, you don't set a requirement that all operating systems cannot work with.

(BTW PyTorch 2 looks very interesting)

aliencaocao commented 1 year ago

@cooperdk

  1. the OP is using windows so no point seeing Linux requirements.
  2. Yes you are reading wrongly. It says Python 3.7 or greater is generally installed by default on any of our supported Linux distributions, which meets our recommendation. Meaning any version above 3.7 should work for linux. But again, OP is on Windows so this does not apply.
  3. No one in this thread said they are using 3.6. OP is using 3.10.6
  4. 3.10 is supported, the website is outdated. You can manually look up the wheel files in https://download.pytorch.org/whl/torch/

@TheCarpetMerchant If you are still having issue, here is a fix 100% will work (make sure your pip is Python 3.10 pip, not from any other python installations): download https://download.pytorch.org/whl/cu113/torch-1.12.1%2Bcu113-cp310-cp310-win_amd64.whl manually pip install torch-1.12.1+cu113-cp310-cp310-win_amd64.whl

cooperdk commented 1 year ago

@cooperdk

  1. the OP is using windows so no point seeing Linux requirements.
  2. Yes you are reading wrongly. It says Python 3.7 or greater is generally installed by default on any of our ...
  3. 3.10 is supported, the website is outdated. You can manually look up the wheel files in https://download.pytorch.org/whl/torch/

Sorry, I misread that page and mistyped stuff including the 3.6 reference and spent some time editing it. That they have a wheel for 3.10 doesn't mean they support it, just that they provide it. It is not pip available so I guess they dont really support it. (I honestly don't remember if torch bothers to provide their works thru pip).

Support for 3.10 is not clearly stated on the official website which is what I (and most other people and developers) choose to adhere to. Because they dont clearly, OFFICIALLY support it.

The page says Python 3.6 minimum for Linux, 3.7 for Windows, and up to and including 3.9 for both platforms. Not 3.10 regardless of the wheel repo. An auto dealer might also sell a tire that cannot be mounted on their cars, but state what tires can be mounted on their website.

aliencaocao commented 1 year ago

Thats a very funny opinion..whats the point of providing wheels if its not supported? Do you know what are wheels? They are compiled version of the library against a specific Python version. If it compiled successfully, it is supported. So many others have used this repo and python 3.10 without issues. The only few issues raised by people are all due to their environment causing them to somehow not use a supported python version (like 3.11) or venv related issues. Why not we let the OP try my suggested solution of installing from wheel directly first? If he can get it work, then it is supported and there is no need for debate already.

cooperdk commented 1 year ago

Thats a very funny opinion..whats the point of providing wheels if its not supported? Do you know what are wheels? They are compiled version of the library against a specific Python version. If it compiled successfully, it is supported.

I don't find it funny. Most software developers officially state what they support and what they don't support. Du does pytorch on the page I referred to.

I used to be a programmer for the company that developed the Bluetooth stack, drivers and software suite. I know what support means. It means that there is a clear, official message about what is supported. You can release software that is not supported because it requires testing. This was specifically what I worked with, actually. Anybody could compile anything if they wanted to. That it compiles and you toss it on a webserver does not mean it is supported.

shootweb commented 1 year ago

Lessons learned from install & this post:

1) Don't mix your Python installs, set your PATH variables correctly. (By making Python 3.11 the default PATH I recreated the error when opening webui-user.bat). 2) If Python installs were mixed (maybe you had Python 3.11 installed), delete venv folders, then open webui-user.bat again. This will generate venv again with your current Python version in PATH which shouldn't be 3.11. 3) Follow repo instructions, e.g. the repo says to install Python 3.10.6 but the library says it supports up to 3.9.... just follow repo instructions unless you're a dev in the project...

image

image

Hopefully this helps

emoryhobel commented 1 year ago

The error seems related to an unsupported version of Python.

I had previously installed 3.11 and it isn't supported. I later installed Python 3.10.6, but stable-diffusion-webui had already created a virtual environment with the previously installed unsupported version of Python upon first run. Resetting the virtual environment resolved this error for me.

Here are steps I used to resolve this error on Windows 11:

  1. Delete the venv directory
  2. Install Python 3.10.06
  3. Run webui.bat to re-establish the stable-diffusion-webui virtual environment (venv directory will be recreated with Python 3.10.6).

Perhaps the Python version could be checked for a supported version prior to creating the virtual environment to avoid this error.

thank you for this

this worked perfectly

norfanos commented 1 year ago

Confirming 3.11 was my issue. Running 3.10.9 is now installing torch/torchvision as expected.

aliencaocao commented 1 year ago

@ClashSAN think we should close this

jameswan commented 1 year ago

I created a venv for Python 3.10.6, but I still get the error:

RuntimeError: Couldn't install torch. Command: "C:\Users\James\stable-diffusion-webui\venv\Scripts\python.exe" -m pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 --extra-index-url https://download.pytorch.org/whl/cu113 Error code: 1 stdout: Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cu113

stderr: ERROR: Could not find a version that satisfies the requirement torch==1.12.1+cu113 (from versions: none) ERROR: No matching distribution found for torch==1.12.1+cu113

Press any key to continue . . .

(automatic) C:\Users\James\stable-diffusion-webui>python --version Python 3.10.6

aliencaocao commented 1 year ago

download https://download.pytorch.org/whl/cu113/torch-1.12.1%2Bcu113-cp310-cp310-win_amd64.whl manually pip install torch-1.12.1+cu113-cp310-cp310-win_amd64.whl @jameswan

jameswan commented 1 year ago

@aliencaocao I tried that: (automatic) C:\Users\James\stable-diffusion-webui>pip install torch-1.12.1+cu113-cp310-cp310-win_amd64.whl --force-reinstall Processing c:\users\james\stable-diffusion-webui\torch-1.12.1+cu113-cp310-cp310-win_amd64.whl Collecting typing-extensions Using cached typing_extensions-4.4.0-py3-none-any.whl (26 kB) Installing collected packages: typing-extensions, torch Attempting uninstall: typing-extensions Found existing installation: typing_extensions 4.4.0 Uninstalling typing_extensions-4.4.0: Successfully uninstalled typing_extensions-4.4.0 Attempting uninstall: torch Found existing installation: torch 1.12.1+cu113 Uninstalling torch-1.12.1+cu113: Successfully uninstalled torch-1.12.1+cu113 Successfully installed torch-1.12.1+cu113 typing-extensions-4.4.0

But I still get the error: stderr: ERROR: Could not find a version that satisfies the requirement torch==1.12.1+cu113 (from versions: none) ERROR: No matching distribution found for torch==1.12.1+cu113

wywywywy commented 1 year ago

Are you inside the venv when you ran those commands?

Can you try "C:\Users\James\stable-diffusion-webui\venv\Scripts\python.exe" --version please?

jameswan commented 1 year ago

Hi everyone, I just went and downloaded Python 3.10.6 for Windows from https://www.python.org/ftp/python/3.10.6/python-3.10.6-amd64.exe

I opened a basic command prompt via cmd.exe, rather than Anaconda prompt. Did not activate a venv

I did this again: C:\Users\James>git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git

C:\Users\James\stable-diffusion-webui>webui-user.bat Creating venv in directory venv using python "C:\Users\James\AppData\Local\Programs\Python\Python310\python.exe" venv "C:\Users\James\stable-diffusion-webui\venv\Scripts\Python.exe"

Then I executed webui-user.bat

Now its progressing with installing everything ...

aliencaocao commented 1 year ago

@jameswan you definitely did not install into the venv properly. If torch exists, it would not try to install again. As for your working attempt, you are installing global packages and making venv to inherent them. Works too, but you need to beware that any modification to torch outside of venv will also affect the SD webui

jameswan commented 1 year ago

@aliencaocao could you please explain your reply above further?

On my first attempt I first created an Python 3.6.10 environment in Windows (I had not downloaded the Python 3.6.10 .exe as I was using Python 3.11) with: conda create -n automatic Python=3.10.6 activate automatic

then proceeded to execute webui-user.bat

which then resulted in the error message as per above, which was: stderr: ERROR: Could not find a version that satisfies the requirement torch==1.12.1+cu113 (from versions: none) ERROR: No matching distribution found for torch==1.12.1+cu113

cooperdk commented 1 year ago

Why the hell are you using conda when the ui is developed for venv..?

Den 7. jan. 2023 07.36, fra 07.36, James @.***> skrev:

@aliencaocao could you please explain your reply above further?

On my first attempt I first created an Python 3.6.10 environment in Windows (I had not downloaded the Python 3.6.10 .exe as I was using Python 3.11) with: conda create -n automatic Python=3.10.6 activate automatic

then proceeded to execute webui-user.bat

which then resulted in the error message as per above, which was: stderr: ERROR: Could not find a version that satisfies the requirement torch==1.12.1+cu113 (from versions: none) ERROR: No matching distribution found for torch==1.12.1+cu113

-- Reply to this email directly or view it on GitHub: https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/5485#issuecomment-1374392498 You are receiving this because you were mentioned.

Message ID: @.***>

jameswan commented 1 year ago

@cooperdk Just used to using conda.

aliencaocao commented 1 year ago

@jameswan conda does not work...i dont know who gave you the idea/instruction to make venv using conda, but no, it does not work. Delete the venv folder and uninstall conda and try again.

wywywywy commented 1 year ago

@jameswan conda does not work...i dont know who gave you the idea/instruction to make venv using conda, but no, it does not work. Delete the venv folder and uninstall conda and try again.

If that's the case, then the Wiki should be updated. https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Install-and-Run-on-NVidia-GPUs#alternative-installation-on-windows-using-conda

hexufeng commented 1 year ago

this error always happened with some warn log like

WARNING: You are using pip version 20.2.3; however, version 23.0.1 is available.
You should consider upgrading via the '~/stable-diffusion-webui/venv/bin/python3 -m pip install --upgrade pip' command.

try to copy the command and execute, things will be fine !

aliencaocao commented 1 year ago

this error always happened with some warn log like

WARNING: You are using pip version 20.2.3; however, version 23.0.1 is available.
You should consider upgrading via the '~/stable-diffusion-webui/venv/bin/python3 -m pip install --upgrade pip' command.

try to copy the command and execute, things will be fine !

You can ignore this warning, it doesnt affect anything as far as this repo is concerned

sjlee9908 commented 9 months ago

Try and update pip first.

"E:\AI\stable-diffusion-webui\venv\Scripts\python.exe" -m pip install --upgrade pip

Also use the latest Python (3.10.8) if possible.

this is work for me.

snimavat commented 2 months ago

Unable to install torch 2.4.1 on python 3.11.2

pip index versions torch
WARNING: pip index is currently an experimental command. It may be removed/changed in a future release without prior warning.
torch (2.2.2)
Available versions: 2.2.2, 2.2.1, 2.2.0, 2.1.2, 2.1.1, 2.1.0, 2.0.1, 2.0.0

trying to install 2.4.1 results in error

ERROR: Could not find a version that satisfies the requirement torch<3.0.0,>=2.3.0 (from surya-ocr) (from versions: 2.0.0, 2.0.1, 2.1.0, 2.1.1, 2.1.2, 2.2.0, 2.2.1, 2.2.2)
ERROR: No matching distribution found for torch<3.0.0,>=2.3.0
cooperdk commented 2 months ago

You install torch from their own source. Read their guide.