Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
3 of 6 tasks
PochiiBoy opened this issue Dec 19, 2023 · 13 comments
Open
3 of 6 tasks
Labels
asking-for-help-with-local-system-issues This issue is asking for help related to local system; please offer assistance

Comments

@PochiiBoy
Copy link

Checklist

  • The issue exists after disabling all extensions
  • The issue exists on a clean installation of webui
  • The issue is caused by an extension, but I believe it is caused by a bug in the webui
  • The issue exists in the current version of the webui
  • The issue has not been reported before recently
  • The issue has been reported before but has not been fixed yet

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

@PochiiBoy PochiiBoy added the bug-report Report of a bug, yet to be confirmed label Dec 19, 2023
@alexanderMal
Copy link

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

@w-e-w w-e-w added asking-for-help-with-local-system-issues This issue is asking for help related to local system; please offer assistance and removed bug-report Report of a bug, yet to be confirmed labels Dec 19, 2023
@PochiiBoy
Copy link
Author

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
Copy link
Author

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
Copy link

alexanderMal commented Dec 20, 2023

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
Copy link
Author

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
Copy link

alexanderMal commented Dec 20, 2023

This looks like an other error did you pull the latest version from the git? Maybe you can take a look at this:
#5928

@PochiiBoy
Copy link
Author

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

@alexanderMal
Copy link

alexanderMal commented Dec 20, 2023

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
Copy link
Author

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
Copy link

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
Copy link
Author

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

@loo-kevin
Copy link

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
Copy link

PieBru commented Feb 5, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
asking-for-help-with-local-system-issues This issue is asking for help related to local system; please offer assistance
Projects
None yet
Development

No branches or pull requests

5 participants