# Webui-user bat file gives errors with Torch

**URL:** <https://discuss.huggingface.co/t/webui-user-bat-file-gives-errors-with-torch/114882>\
**Category:** Beginners\
**Created:** [October 31, 2024, 2:31pm UTC](https://discuss.huggingface.co/t/webui-user-bat-file-gives-errors-with-torch/114882 "2024-10-31T14:31:55Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![c3PO6889](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/c3po6889/32/33755_2.png) [@c3PO6889](https://discuss.huggingface.co/u/c3PO6889)\
**Post date:** [October 31, 2024, 2:31pm UTC](https://discuss.huggingface.co/t/webui-user-bat-file-gives-errors-with-torch/114882/1 "2024-10-31T14:31:55Z")

</div>

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](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](https://us1.discourse-cdn.com/hellohellohello/original/3X/7/d/7dc1e2a5e982173091a53bac082eac65a9ae5692.png)

-m pip install torch==2.1.2 torchvision==0.16.2 --extra-index-url [https://download.pytorch.org/whl/cu121](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?

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [October 31, 2024, 2:34pm UTC](https://discuss.huggingface.co/t/webui-user-bat-file-gives-errors-with-torch/114882/2 "2024-10-31T14:34:41Z")

</div>

Just delete version specification.

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

```

---

<div class="post-metadata">

**Author:** ![c3PO6889](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/c3po6889/32/33755_2.png) [@c3PO6889](https://discuss.huggingface.co/u/c3PO6889)\
**Post date:** [October 31, 2024, 2:42pm UTC](https://discuss.huggingface.co/t/webui-user-bat-file-gives-errors-with-torch/114882/3 "2024-10-31T14:42:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![c3PO6889](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/c3po6889/32/33755_2.png) [@c3PO6889](https://discuss.huggingface.co/u/c3PO6889)\
**Post date:** [November 1, 2024, 2:55am UTC](https://discuss.huggingface.co/t/webui-user-bat-file-gives-errors-with-torch/114882/4 "2024-11-01T02:55:05Z")

</div>

![image](https://us1.discourse-cdn.com/hellohellohello/original/3X/c/7/c74e4397954f967f5081dbb6a9533a42d25cb101.png)

Used shell to enter, and then this :

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [November 1, 2024, 2:57am UTC](https://discuss.huggingface.co/t/webui-user-bat-file-gives-errors-with-torch/114882/5 "2024-11-01T02:57:23Z")

</div>

Then try this.

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

```

Perhaps.

```auto
-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.

> **[GitHub - lllyasviel/stable-diffusion-webui-forge](https://github.com/lllyasviel/stable-diffusion-webui-forge/tree/main?tab=readme-ov-file#installing-forge)**
>
> main

---

<div class="post-metadata">

**Author:** ![c3PO6889](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/c3po6889/32/33755_2.png) [@c3PO6889](https://discuss.huggingface.co/u/c3PO6889)\
**Post date:** [November 1, 2024, 4:58am UTC](https://discuss.huggingface.co/t/webui-user-bat-file-gives-errors-with-torch/114882/6 "2024-11-01T04:58:36Z")

</div>

> [@John6666](#):
>
> `pip install torch==2.2.0 torchvision --extra-index-url https://download.pytorch.org/whl/cu121`

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.

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [November 1, 2024, 5:02am UTC](https://discuss.huggingface.co/t/webui-user-bat-file-gives-errors-with-torch/114882/7 "2024-11-01T05:02:53Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![c3PO6889](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/c3po6889/32/33755_2.png) [@c3PO6889](https://discuss.huggingface.co/u/c3PO6889)\
**Post date:** [November 1, 2024, 5:49am UTC](https://discuss.huggingface.co/t/webui-user-bat-file-gives-errors-with-torch/114882/8 "2024-11-01T05:49:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [November 1, 2024, 5:52am UTC](https://discuss.huggingface.co/t/webui-user-bat-file-gives-errors-with-torch/114882/9 "2024-11-01T05:52:09Z")

</div>

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://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/9074>
>
> \### Is there an existing issue for this?
> 
> \- \[X\] I have searched the existing iss…ues and checked the recent builds/commits
> 
> \### What happened?
> 
> This is my first time making a report on github, so I might miss a few things here and there.
> 
> I was using it normally for the first 5 minutes, after adding a couple of models, and changed model for the first time, it stayed refreshing for 5 minutes so I decided to refresh the page and now I see errors all over the page, when I type in the input box it shows an error and I can't change models it shows error there, I tried reloading UI, reinstalling the whole git and deleting the huggingface folder from ./cache sometimes it works but after 1 minute it breaks again
> 
> !\[image\](https://user-images.githubusercontent.com/66844990/228117644-1dfb9cc5-d056-4cda-96ed-6205c3cf5216.png)
> 
> I've tried checking the browser console all I see is 1 error and its
> \`Firefox can’t establish a connection to the server at ws://127.0.0.1:7860/queue/join.\`
> 
> \### Steps to reproduce the problem
> 
> Unknown
> 
> \### What should have happened?
> 
> Should not show error messages and work normally.
> 
> \### Commit where the problem happens
> 
> 955df775 
> 
> \### What platforms do you use to access the UI ?
> 
> Windows
> 
> \### What browsers do you use to access the UI ?
> 
> Mozilla Firefox
> 
> \### Command Line Arguments
> 
> \`\`\`Shell
> None
> \`\`\`
> 
> 
> \### List of extensions
> 
> Default
> 
> \### Console logs
> 
> \`\`\`Shell
> venv "D:\\Workspace\\Stable Diffusion WebUI\\stable-diffusion-webui\\venv\\Scripts\\Python.exe"
> Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) \[MSC v.1932 64 bit (AMD64)\]
> Commit hash: 955df7751eef11bb7697e2d77f6b8a6226b21e13
> Installing requirements for Web UI
> Launching Web UI with arguments:
> No module 'xformers'. Proceeding without it.
> Loading weights \[abcaf14e5a\] from D:\\Workspace\\Stable Diffusion WebUI\\stable-diffusion-webui\\models\\Stable-diffusion\\anything-v3-full.safetensors
> Creating model from config: D:\\Workspace\\Stable Diffusion WebUI\\stable-diffusion-webui\\configs\\v1-inference.yaml
> LatentDiffusion: Running in eps-prediction mode
> DiffusionWrapper has 859.52 M params.
> Applying cross attention optimization (Doggettx).
> Textual inversion embeddings loaded(0):
> Model loaded in 5.2s (load weights from disk: 0.5s, create model: 0.6s, apply weights to model: 0.9s, apply half(): 0.9s, move model to device: 0.9s, load textual inversion embeddings: 1.3s).
> Running on local URL: http://127.0.0.1:7860
> 
> To create a public link, set \`share=True\` in \`launch()\`.
> Startup time: 15.7s (import torch: 2.7s, import gradio: 2.5s, import ldm: 0.6s, other imports: 2.6s, load scripts: 1.1s, load SD checkpoint: 5.6s, create ui: 0.4s, gradio launch: 0.1s).
> \`\`\`
> 
> 
> \### Additional information
> 
> \_No response\_

[https://www.reddit.com/r/StableDiffusion/comments/xcsmrg/webui\_request\_assistance\_exit\_code\_9009/](https://www.reddit.com/r/StableDiffusion/comments/xcsmrg/webui_request_assistance_exit_code_9009/)
