Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stable Diffusion (Couldn't Install Torch & Pip Version)

I am trying to install and configure Stable Diffusion AI locally on my PC (Windows 11 Pro x64), following the How-To-Geek article, How to Run Stable Diffusion Locally With a GUI on Windows

Naturally enough, I've run into problems, primarily (as the code below shows, Torch install and Pip version :)

This is what I get when I run the Stable Diffusion batch file:

venv "D:\stable-diffusion-webui-master\venv\Scripts\Python.exe"
Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit (AMD64)]
Commit hash: <none>
Installing torch and torchvision
Traceback (most recent call last):
  File "launch.py", line 108, in <module>
    run(f'"{python}" -m {torch_command}', "Installing torch and torchvision", "Couldn't install torch")
  File "launch.py", line 55, in run
    raise RuntimeError(message)
RuntimeError: Couldn't install torch.
Command: "D:\stable-diffusion-webui-master\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: Collecting torch==1.12.1+cu113

stderr:   Cache entry deserialization failed, entry ignored
  Could not find a version that satisfies the requirement torch==1.12.1+cu113 (from versions: 1.7.0, 1.10.0+cu113, 1.10.1+cu113, 1.10.2+cu113)
No matching distribution found for torch==1.12.1+cu113
You are using pip version 9.0.1, however version 22.2.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

That's even after I tried the following:

  • pip install -vvv torch
  • pip3 install --pre torch -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
  • python -m pip install --upgrade pip

For #2 I get "ERROR: torch has an invalid wheel, .dist-info directory not found". It's probably worth noting that although I installed the program to my D: drive, I already have python 6.1 (64bit) installed on my C: drive.

I'm an ex-techy (now author) trying to install an image generator on my PC to potentially make a book cover. It probably won't work but it certainly won't if I can't get the thing running so, any help appreciated :)

James

like image 716
James Rocks Avatar asked May 06 '26 22:05

James Rocks


1 Answers

You need to install Python 3.10.6 (https://www.python.org/ftp/python/3.10.6/python-3.10.6-amd64.exe)

Make sure to choose "add to PATH" when installing or add it manually.

Remove the venv folder from your Stable Diffusion folder that was created with the wrong version of python.

Launch webui-user.bat again and it should work fine.

like image 179
chris91 Avatar answered May 08 '26 12:05

chris91



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!