stable-diffusion-webui
stable-diffusion-webui copied to clipboard
[Bug]: Unable to install webui due to torch
Is there an existing issue for this?
- [X] I have searched the existing issues and checked the recent builds/commits
What happened?
I installed everything according to the 'Steps to reproduce the problem' section. I then ran webui-user.bat. I get this error message:
Creating venv in directory C:\Utilities\Stable-Diffusion\venv using python "C:\Users\Bouwhuis\AppData\Local\Programs\Python\Python311\python.exe"
venv "C:\Utilities\Stable-Diffusion\venv\Scripts\Python.exe"
==============================================================================================================
INCOMPATIBLE PYTHON VERSION
This program is tested with 3.10.6 Python, but you have 3.11.2.
If you encounter an error with "RuntimeError: Couldn't install torch." message,
or any other error regarding unsuccessful package (library) installation,
please downgrade (or upgrade) to the latest version of 3.10 Python
and delete current Python and "venv" folder in WebUI's directory.
You can download 3.10 Python from here: https://www.python.org/downloads/release/python-3109/
Alternatively, use a binary release of WebUI: https://github.com/AUTOMATIC1111/stable-diffusion-webui/releases
Use --skip-python-version-check to suppress this warning.
==============================================================================================================
Python 3.11.2 (tags/v3.11.2:878ead1, Feb 7 2023, 16:38:35) [MSC v.1934 64 bit (AMD64)]
Commit hash: <none>
Installing torch and torchvision
Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cu117
ERROR: Could not find a version that satisfies the requirement torch==1.13.1+cu117 (from versions: none)
ERROR: No matching distribution found for torch==1.13.1+cu117
[notice] A new release of pip available: 22.3.1 -> 23.0.1
[notice] To update, run: C:\Utilities\Stable-Diffusion\venv\Scripts\python.exe -m pip install --upgrade pip
Traceback (most recent call last):
File "C:\Utilities\Stable-Diffusion\launch.py", line 360, in <module>
prepare_environment()
File "C:\Utilities\Stable-Diffusion\launch.py", line 269, in prepare_environment
run(f'"{python}" -m {torch_command}', "Installing torch and torchvision", "Couldn't install torch", live=True)
File "C:\Utilities\Stable-Diffusion\launch.py", line 89, in run
raise RuntimeError(f"""{errdesc or 'Error running command'}.
RuntimeError: Couldn't install torch.
Command: "C:\Utilities\Stable-Diffusion\venv\Scripts\python.exe" -m pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 --extra-index-url https://download.pytorch.org/whl/cu117
Error code: 1
Press any key to continue . . .
Steps to reproduce the problem
- I downloaded and copied the repository files to C:\Utilities\Stable-Diffusion
- I downloaded and copied GFPGANv1.4.pth in C:\Utilities\Stable-Diffusion
- I downloaded and copied 'sd-v1-4-full-ema.ckpt' in C:\Utilities\Stable-Diffusion\models\Stable-diffusion
- I downloaded and copied a couple of ESRGAN files in C:\Utilities\Stable-Diffusion\models\ESRGAN
What should have happened?
I expected the program to install correctly
Commit where the problem happens
0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8
What platforms do you use to access the UI ?
Windows
What browsers do you use to access the UI ?
Mozilla Firefox
Command Line Arguments
No
List of extensions
No
Console logs
Creating venv in directory C:\Utilities\Stable-Diffusion\venv using python "C:\Users\Bouwhuis\AppData\Local\Programs\Python\Python311\python.exe"
venv "C:\Utilities\Stable-Diffusion\venv\Scripts\Python.exe"
==============================================================================================================
INCOMPATIBLE PYTHON VERSION
This program is tested with 3.10.6 Python, but you have 3.11.2.
If you encounter an error with "RuntimeError: Couldn't install torch." message,
or any other error regarding unsuccessful package (library) installation,
please downgrade (or upgrade) to the latest version of 3.10 Python
and delete current Python and "venv" folder in WebUI's directory.
You can download 3.10 Python from here: https://www.python.org/downloads/release/python-3109/
Alternatively, use a binary release of WebUI: https://github.com/AUTOMATIC1111/stable-diffusion-webui/releases
Use --skip-python-version-check to suppress this warning.
==============================================================================================================
Python 3.11.2 (tags/v3.11.2:878ead1, Feb 7 2023, 16:38:35) [MSC v.1934 64 bit (AMD64)]
Commit hash: <none>
Installing torch and torchvision
Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cu117
ERROR: Could not find a version that satisfies the requirement torch==1.13.1+cu117 (from versions: none)
ERROR: No matching distribution found for torch==1.13.1+cu117
[notice] A new release of pip available: 22.3.1 -> 23.0.1
[notice] To update, run: C:\Utilities\Stable-Diffusion\venv\Scripts\python.exe -m pip install --upgrade pip
Traceback (most recent call last):
File "C:\Utilities\Stable-Diffusion\launch.py", line 360, in <module>
prepare_environment()
File "C:\Utilities\Stable-Diffusion\launch.py", line 269, in prepare_environment
run(f'"{python}" -m {torch_command}', "Installing torch and torchvision", "Couldn't install torch", live=True)
File "C:\Utilities\Stable-Diffusion\launch.py", line 89, in run
raise RuntimeError(f"""{errdesc or 'Error running command'}.
RuntimeError: Couldn't install torch.
Command: "C:\Utilities\Stable-Diffusion\venv\Scripts\python.exe" -m pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 --extra-index-url https://download.pytorch.org/whl/cu117
Error code: 1
Press any key to continue . . .
Additional information
No response
@SanderBouwhuis torch isn't officially supported on python 3.11 yet, you could try changing line ~222 in launch.py
:
https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8/launch.py#L221-L223
to:
torch_command = os.environ.get('TORCH_COMMAND', "pip install --pre torch -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html")
to install the nightly (unstable) version instead.
If you installed from the microsoft store, you get 3.11, make sure you install Python 3.10.6, and tick the add to path checkbox
@bolshoytoster @ClashSAN Thanks a huge bunch for helping me! Ok, I got farther with the change @bolshoytoster proposed, but still no complete success:
Creating venv in directory C:\Utilities\Stable-Diffusion\venv using python "C:\Users\Bouwhuis\AppData\Local\Programs\Python\Python311\python.exe"
venv "C:\Utilities\Stable-Diffusion\venv\Scripts\Python.exe"
==============================================================================================================
INCOMPATIBLE PYTHON VERSION
This program is tested with 3.10.6 Python, but you have 3.11.2.
If you encounter an error with "RuntimeError: Couldn't install torch." message,
or any other error regarding unsuccessful package (library) installation,
please downgrade (or upgrade) to the latest version of 3.10 Python
and delete current Python and "venv" folder in WebUI's directory.
You can download 3.10 Python from here: https://www.python.org/downloads/release/python-3109/
Alternatively, use a binary release of WebUI: https://github.com/AUTOMATIC1111/stable-diffusion-webui/releases
Use --skip-python-version-check to suppress this warning.
==============================================================================================================
Python 3.11.2 (tags/v3.11.2:878ead1, Feb 7 2023, 16:38:35) [MSC v.1934 64 bit (AMD64)]
Commit hash: <none>
Installing torch and torchvision
Looking in links: https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
Collecting torch
Downloading https://download.pytorch.org/whl/nightly/cpu/torch-2.0.0.dev20230220%2Bcpu-cp311-cp311-win_amd64.whl (174.1 MB)
---------------------------------------- 174.1/174.1 MB 12.4 MB/s eta 0:00:00
Collecting filelock
Using cached filelock-3.9.0-py3-none-any.whl (9.7 kB)
Collecting typing-extensions
Using cached typing_extensions-4.5.0-py3-none-any.whl (27 kB)
Collecting sympy
Downloading sympy-1.11.1-py3-none-any.whl (6.5 MB)
---------------------------------------- 6.5/6.5 MB 21.8 MB/s eta 0:00:00
Collecting networkx
Using cached networkx-3.0-py3-none-any.whl (2.0 MB)
Collecting mpmath>=0.19
Downloading mpmath-1.2.1-py3-none-any.whl (532 kB)
---------------------------------------- 532.6/532.6 kB 32.6 MB/s eta 0:00:00
Installing collected packages: mpmath, typing-extensions, sympy, networkx, filelock, torch
Successfully installed filelock-3.9.0 mpmath-1.2.1 networkx-3.0 sympy-1.11.1 torch-2.0.0.dev20230220+cpu typing-extensions-4.5.0
[notice] A new release of pip available: 22.3.1 -> 23.0.1
[notice] To update, run: C:\Utilities\Stable-Diffusion\venv\Scripts\python.exe -m pip install --upgrade pip
Traceback (most recent call last):
File "C:\Utilities\Stable-Diffusion\launch.py", line 362, in <module>
prepare_environment()
File "C:\Utilities\Stable-Diffusion\launch.py", line 274, in prepare_environment
run_python("import torch; assert torch.cuda.is_available(), 'Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check'")
File "C:\Utilities\Stable-Diffusion\launch.py", line 129, in run_python
return run(f'"{python}" -c "{code}"', desc, errdesc)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Utilities\Stable-Diffusion\launch.py", line 105, in run
raise RuntimeError(message)
RuntimeError: Error running command.
Command: "C:\Utilities\Stable-Diffusion\venv\Scripts\python.exe" -c "import torch; assert torch.cuda.is_available(), 'Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check'"
Error code: 1
stdout: <empty>
stderr: Traceback (most recent call last):
File "<string>", line 1, in <module>
AssertionError: Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check
Press any key to continue . . .
@SanderBouwhuis the error is:
AssertionError: Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check
Try reading this stackoverflow answer.
My graphics card supports the right version of CUDA. My graphics driver supports the right version of CUDA. I guess the Torch version still has bugs or incompatibilities.
I downgraded Python from v3.11 to v3.10.9 and it works now. I'm a little worried about using older versions which may contain vulnerabilities, so I hope that the Torch package will soon be updated.
@SanderBouwhuis
I'm a little worried about using older versions which may contain vulnerabilities
Most old versions of software still recieve security updates (and v3.10.9 isn't really that old) so you should be fine.
mine work with v3.10.9