stable-diffusion-webui
stable-diffusion-webui copied to clipboard
[Bug]: Doesn't run in newer python versions (ex. python v3.13.5.)
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?
This program is tested with 3.10.6 Python, but you have 3.13.5.
ERROR: Could not find a version that satisfies the requirement torch==2.1.2 (from versions: none)
ERROR: No matching distribution found for torch==2.1.2
Traceback (most recent call last):
File "D:\Download\Programs\stable-diffusion-webui-master\launch.py", line 48, in
Steps to reproduce the problem
Try to open program with python version newer than 1.10
What should have happened?
update if possible, so it work with latest python versions
What browsers do you use to access the UI ?
Brave
Sysinfo
Console logs
This program is tested with 3.10.6 Python, but you have 3.13.5.
ERROR: Could not find a version that satisfies the requirement torch==2.1.2 (from versions: none)
ERROR: No matching distribution found for torch==2.1.2
Traceback (most recent call last):
File "D:\Download\Programs\stable-diffusion-webui-master\launch.py", line 48, in <module>
main()
~~~~^^
File "D:\Download\Programs\stable-diffusion-webui-master\launch.py", line 39, in main
prepare_environment()
~~~~~~~~~~~~~~~~~~~^^
File "D:\Download\Programs\stable-diffusion-webui-master\modules\launch_utils.py", line 381, in prepare_environment
run(f'"{python}" -m {torch_command}', "Installing torch and torchvision", "Couldn't install torch", live=True)
~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Download\Programs\stable-diffusion-webui-master\modules\launch_utils.py", line 116, in run
raise RuntimeError("\n".join(error_bits))
RuntimeError: Couldn't install torch.
Command: "D:\Download\Programs\stable-diffusion-webui-master\venv\Scripts\python.exe" -m pip install torch==2.1.2 torchvision==0.16.2 --extra-index-url https://download.pytorch.org/whl/cu121
Error code: 1
Additional information
No response
You can install multiple python versions at once.
Set python 3.10 in webui-user.bat and delete the venv folder.
set PYTHON=python3.10.exe
As @missionfloyd said but be sure to set the exe path in quotes as well
I'm having the same issue, and I wrote a Discussion post yesterday about this that hasn't gotten any views yet.
In my case, on Linux Mint, README.md says nothing about editing a .bat file, though there is one present. Is the .bat file used on Mint too or just Windows?
Instead, it instructs to edit the webui.sh launch script, which as I mention in the post, conflicts with the file's comment instructing not to edit it, but to edit webui-user.sh instead.
So I edit webui-user.sh and it has no effect. And now that I discovered this bug thread, I tried editing the webui-user.bat file instead, and it still it does not work. I still get the same error message as the OP, but in a GNU accent.
Python 3.12.3 (main, Aug 14 2025, 17:47:21) [GCC 13.3.0]
Version: v1.10.1
Commit hash: 82a973c04367123ae98bd9abdf80d9eda9b910e2
Installing torch and torchvision
Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cu121
ERROR: Could not find a version that satisfies the requirement torch==2.1.2 (from versions: 2.2.0, 2.2.0+cu121, 2.2.1, 2.2.1+cu121, 2.2.2, 2.2.2+cu121, 2.3.0, 2.3.0+cu121, 2.3.1, 2.3.1+cu121, 2.4.0, 2.4.0+cu121, 2.4.1, 2.4.1+cu121, 2.5.0, 2.5.0+cu121, 2.5.1, 2.5.1+cu121, 2.6.0, 2.7.0, 2.7.1, 2.8.0, 2.9.0, 2.9.1)
ERROR: No matching distribution found for torch==2.1.2
Traceback (most recent call last):
File "/home/user/apps/0_ai/stable-diffusion-webui/stable-diffusion-webui/launch.py", line 48, in <module>
main()
File "/home/user/apps/0_ai/stable-diffusion-webui/stable-diffusion-webui/launch.py", line 39, in main
prepare_environment()
File "/home/user/apps/0_ai/stable-diffusion-webui/stable-diffusion-webui/modules/launch_utils.py", line 381, in prepare_environment
run(f'"{python}" -m {torch_command}', "Installing torch and torchvision", "Couldn't install torch", live=True)
File "/home/user/apps/0_ai/stable-diffusion-webui/stable-diffusion-webui/modules/launch_utils.py", line 116, in run
raise RuntimeError("\n".join(error_bits))
RuntimeError: Couldn't install torch.
Command: "/home/user/apps/0_ai/stable-diffusion-webui/stable-diffusion-webui/venv/bin/python" -m pip install torch==2.1.2 torchvision==0.16.2 --extra-index-url https://download.pytorch.org/whl/cu121
Error code: 1
I should note that the instructions for GNU systems instruct to install Python 3.11—not Python 3.10, and links a ppa repository. Is this information correct?
The team may want to look into revising the README.md to address all these issues! Documentation is important!
Currently, with minor dependency changes, there's no problem keeping Automatic1111 updated to Python 3.12 + PyTorch 2.9.1 + CU130 + xformers: 0.0.34+, using a good number of installed extensions, and it works perfectly.
With Python 3.13, I haven't finished resolving some indirect problems specifically caused by ControlNet, since it requires at least pydantic 1.10.20, which breaks several parts of Automatic1111 that I'm currently working on.
Some other extensions also have problems because they don't yet have dependencies compatible with Python 3.13 (obviously, these are the ones I use).