Webui-user bat file gives errors with Torch

Please help, im brand new to all of this. so confused.

im following the instructions for local SD at https://www.datacamp.com/tutorial/how-to-run-stable-diffusion, and when I get to the step where one needs to run the “webui-ui.bat” file, it gives me this error every time :
image

-m pip install torch==2.1.2 torchvision==0.16.2 --extra-index-url https://download.pytorch.org/whl/cu121
Error code: 1

Ive tried to manually install Torch via PyTorch, which was recommended , same two errors.
Tried deleting PIP cache, same
Editing “Launch.Py” on the 14th line just gave even more errors.

What am I doing wrong? what can I do?

1 Like

Just delete version specification.

-m pip install torch==2.1.2 torchvision --extra-index-url https://download.pytorch.org/whl/cu121

and where do I edit that? in Launch. py?

1 Like

image

Used shell to enter, and then this :

1 Like

Then try this.

-m pip install torch==2.2.0 torchvision --extra-index-url https://download.pytorch.org/whl/cu121

Perhaps.

-m pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/cu121

Come to think of it, if you just want to use Stable Diffusion, it’s faster and more reliable to download the WebUI Forge all-in-one package below than to manually install all the stuff.

I downloaded, ran the update, and then did the “run.bat” as the github follows. Same two errors.

The only way I have been able to install torch or related to PyTorch is in VIsual Studio 22, but I cannot figure how to run SD in VS22 environments.

1 Like

Setting up a real Python environment, including torch, properly is a difficult task, even virtually impossible unless you have a virtual environment like Docker or venv.
Try Forge, since it’s basically the same program as A1111.
It was created by a HF user.
https://github.com/lllyasviel/stable-diffusion-webui-forge/releases/download/latest/webui_forge_cu121_torch231.7z

Anyone who follows the HF samples and github instructions and gets it to work is a very lucky person. This is not limited to WebUI. Anyway, what actually works is justice, everything else is suspect.

Okay , so , I had to improvise. Nothing worked until I deleted the new python version and rolled back to a recent version (Python 3.10.6) for whatever reason, the script would not install torch without the rollback. I deleted the old python with RevUninstaller, than deleted the “Python.Exe” in the Venv folder, in the webui directory, replaced it with the rollbacked exe. shortcut.

This was the only way I got it to work after several hours of troubleshooting, no guide on the internet helped, just a shot in the dark.

This FINALLY got torch to install, and the rest of the prereqs…but now I cant get the UI to launch in my browser. It did once, and I got continual “error : connection lost” messages, so I tried to reopen the CMD window, and now the UI wont launch at all.

This is hilariously frustrating. lol.

1 Like

That’s why there is such a thing as an all-in-one package. But you’re one step away from getting there! Maybe.

Perhaps?

https://www.reddit.com/r/StableDiffusion/comments/xcsmrg/webui_request_assistance_exit_code_9009/