AUTOMATIC1111 / stable-diffusion-webui

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

[Bug]: Cannot find torch version 2.0.1 when running webui-user.bat on Windows 10 #14366

Open PochiiBoy opened 11 months ago

PochiiBoy commented 11 months ago

Checklist

What happened?

When I run webui-user.bat on Windows 10 it will start to install torch and torchvision but is unable to find the version 2.0.1 of torch. Other issues related to this from what I have seen were on another OS and was a memory issue but my allocated Vmemory (12800mb) is much above my recommended (3958mb).

Steps to reproduce the problem

  1. Go to installation of stable-diffusion-webui
  2. Run webui-user.bat

What should have happened?

Torch should have been installed and the rest of the install should have continued.

What browsers do you use to access the UI ?

Other

Sysinfo

(im so sorry, was having trouble figuring out how to run sysinfo command) Windows 10 Home Version 22H2 GPU: AMD Radeon RX 6600 XT Processor: AMD Ryzen 5 3600 6-Core Processor 3.60 GHz RAM: 24.0 GB

Console logs

Python 3.12.1 (tags/v3.12.1:2305ca5, Dec  7 2023, 22:03:25) [MSC v.1937 64 bit (AMD64)]
Version: v1.7.0
Commit hash: cf2772fab0af5573da775e7437e6acdca424f26e
Installing torch and torchvision
Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cu118
ERROR: Could not find a version that satisfies the requirement torch==2.0.1 (from versions: none)
ERROR: No matching distribution found for torch==2.0.1
Traceback (most recent call last):
  File "C:\ai\stable-diffusion-webui\launch.py", line 48, in <module>
    main()
  File "C:\ai\stable-diffusion-webui\launch.py", line 39, in main
    prepare_environment()
  File "C:\ai\stable-diffusion-webui\modules\launch_utils.py", line 378, in prepare_environment
    run(f'"{python}" -m {torch_command}', "Installing torch and torchvision", "Couldn't install torch", live=True)
  File "C:\ai\stable-diffusion-webui\modules\launch_utils.py", line 116, in run
    raise RuntimeError("\n".join(error_bits))
RuntimeError: Couldn't install torch.
Command: "C:\ai\stable-diffusion-webui\venv\Scripts\python.exe" -m pip install torch==2.0.1 torchvision==0.15.2 --extra-index-url https://download.pytorch.org/whl/cu118
Error code: 1
Press any key to continue . . .

Additional information

No response

alexanderMal commented 11 months ago

It seems not to be a bug but I ran into the same issue. Torch is not compatible with newer Python versions. Even though I set the path in the webui to 10.06 with "set PYTHON=" the version in the venv directory was the latest version I had installed there by i was unable to install torch

Fix: 1) Uninstall all Python versions except version 10.06 2) delete the venv directory 3) run webui-script

PochiiBoy commented 11 months ago

It seems not to be a bug but I ran into the same issue. Torch is not compatible with newer Python versions. Even though I set the path in the webui to 10.06 with "set PYTHON=" the version in the venv directory was the latest version I had installed there by i was unable to install torch

Fix:

  1. Uninstall all Python versions except version 10.06
  2. delete the venv directory
  3. run webui-script

Sweet! Thank you. I'll try this out real soon but I bet this will fix it.

PochiiBoy commented 11 months ago

I decided to uninstall everything and install Python 3.10.6 and then install everything else again. I have python 3.10.6 and no other version and its installed to my PATH but I get the same error about torch :c

alexanderMal commented 11 months ago

Does the pyvenv file in the venv directory contain the correct python version?

I decided to uninstall everything and install Python 3.10.6 and then install everything else again. I have python 3.10.6 and no other version and its installed to my PATH but I get the same error about torch :c

Can you post your error message again? The old message stated Python 3.12.1 in the top left.

PochiiBoy commented 11 months ago

Yes, in the pyvenv file it shows 3.10.6.

ImportError: cannot import name 'urllib3' from 'pip._vendor' (C:\ai\stable-diffusion-webui\venv\lib\site-packages\pip\_vendor\__init__.py) Traceback (most recent call last): File "C:\ai\stable-diffusion-webui\launch.py", line 48, in <module> main() File "C:\ai\stable-diffusion-webui\launch.py", line 39, in main prepare_environment() File "C:\ai\stable-diffusion-webui\modules\launch_utils.py", line 378, in prepare_environment run(f'"{python}" -m {torch_command}', "Installing torch and torchvision", "Couldn't install torch", live=True) File "C:\ai\stable-diffusion-webui\modules\launch_utils.py", line 116, in run raise RuntimeError("\n".join(error_bits)) RuntimeError: Couldn't install torch. Command: "C:\ai\stable-diffusion-webui\venv\Scripts\python.exe" -m pip install torch==2.0.1 torchvision==0.15.2 --extra-index-url https://download.pytorch.org/whl/cu118 Error code: 1 Press any key to continue . . .

alexanderMal commented 11 months ago

This looks like an other error did you pull the latest version from the git? Maybe you can take a look at this: https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/5928

PochiiBoy commented 11 months ago

When I git clone it am I getting the latest version? Cause that is what I always do.

alexanderMal commented 11 months ago

When I git clone it am I getting the latest version? Cause that is what I always do.

clone is usually a one time process. I´m not sure what appens if you git clone multiple times. Maybe it updates maybe it skips. Try going to your stable diffusion directory where you can see the .git folder (if you have enabled display hidden elements) and run the command git pull this will update to the latest version. Then delete the venv folder and execute the webui-user file.

PochiiBoy commented 11 months ago

It was all up to date but deleting the venv folder worked ^^ I just had to add the --no-half and --skip-torch-cuda-test commandline args :)))

alexanderMal commented 11 months ago

It seems not to be a bug but I ran into the same issue. Torch is not compatible with newer Python versions. Even though I set the path in the webui to 10.06 with "set PYTHON=" the version in the venv directory was the latest version I had installed there by i was unable to install torch

Fix:

  1. Uninstall all Python versions except version 10.06
  2. delete the venv directory
  3. run webui-script

so you basically did this and it worked (including step 2)

PochiiBoy commented 11 months ago

Yee, for some reason the first time i deleted it with the new python version it didnt work

loo-kevin commented 11 months ago

Based on my installation experience, I would like to give two suggestions:

  1. Install python-3.10.6. 32-bit cannot match any version of the torch package, but 64-bit will do.
  2. This error message may not reflect the actual error reason: pip is not installed. In fact, I installed pip and there may still be unknown errors. Finally, I reinstalled python and ran it again.
PieBru commented 9 months ago

Thanks @loo-kevin , I had the same issue on Arch Linux and pip was missing. So I solved after a simple $ yay -S python-pip