How to install Stable Diffusion on Windows (AUTOMATIC1111)

Updated Categorized as Tutorial Tagged , 359 Comments on How to install Stable Diffusion on Windows (AUTOMATIC1111)

We will go through how to download and install the popular Stable Diffusion software AUTOMATIC1111 on Windows step-by-step.

Stable Diffusion is a text-to-image AI that can be run on a consumer-grade PC with a GPU. After this tutorial, you can generate AI images on your own PC.

Systems requirements

Your PC should run Windows 10 or higher with a discrete Nvidia video card (GPU) with 4 GB VRAM or more. An integrated GPU will not work.

If your PC does not meet these requirements, alternatives are

Installation steps

Step 1: Install python

You will need Python 3.10.6. (DON’T use Python 3.11 or newer) There are two ways to install Python on Windows

Option 1: Install from the Microsoft store.

Option 2: Use the 64-bit Windows installer provided by the Python website. (If you use this option, make sure to select “Add Python to 3.10 to PATH“)

I recommend installing it from the Microsoft store.

First, remove all Python versions you have previously installed. You can do that in Control PanelAdd or remove programs.

Visit Python 3.10 on Microsoft Store and install the Python software.

This step is most likely to go wrong. Let’s do a check.

Press the Windows key on your keyboard and type “cmd” to find a program called “Command Prompt”.

Open the Command Prompt App. You should see a black terminal like you are a hacker…

Type “python” and press Enter. You should see you see it prints out Python 3.10. This tells you your Python is installed correctly.

Now you can close the Command Prompt App.

Don’t proceed to the next step until you get Python 3.10 installed correctly.

If you don’t see Python 3.10 running, try

  • Restarting the PC
  • Removing all the previous versions of Python and reinstalling from the Microsoft Store
  • If the one from Microsoft Store doesn’t work for you, remove it and try the one on the Python website.

Step 2: Install git

Git is a code repository management system. You will need it to install and update AUTOMATIC1111.

Go to this page to download the windows version.

Open the installer. Click Install to accept the license and install the software.

git install windows

Follow the instruction to complete the installation.

Step 3: Clone web-ui

This step downloads the Stable Diffusion software (AUTOMATIC1111).

Press the Window key (It should be on the left of the space bar on your keyboard), and a search window should appear. Type cmd.

Click on Command Prompt. The command prompt window would show up.

First, make sure you are in your home folder by typing the following command and then pressing Enter. (Tip: You should be able to use right-click to paste in Command Prompt.)

cd %userprofile%

You should see your prompt shows something like C:\Users\YOUR_USER_NAME>.

Next type the following command and press Enter to clone the AUTOMATIC1111 repository.

git clone

A folder called stable-diffusion-webui should be created in your home directory.

It’s ok to clone the repository in a different folder instead of %userprofile%, as long as you can find the newly created stable-diffusion-webui folder. You will need to change the folder location accordingly in the following steps.

Step 4: Download a model file

Next, go to the newly created folder in File Explorer. Put in


in the address bar and press enter.

Navigate to the folder models and then Stable-diffusion. You should see a file Put Stable Diffusion checkpoints here.txt like below.

Download the Stable Diffusion v1.5 model checkpoint file (download link). Put it in that folder.

Step 5: Run webui

Now in File Explorer, go back to the stable-diffusion-webui folder. That is, go back up two levels or type


again in the address bar.

Find a file called webui-user.bat. Double-click to run and complete the installation.

This last step is going to take a while. When it is done, you will see a message

Running on local URL:

like the one below.

In your web browser, go to the URL

You should see the AUTOMATIC1111 webui! Put in a prompt (e.g. “a cat”) and hit Generate to test if Stable Diffusion is running correctly.

When you are done using Stable Diffusion, close the cmd black window to shut down Stable Diffusion.

To rerun Stable Diffusion, you need to double-click the webui-user.bat.


You can speed up Stable Diffusion with the --xformers option. If you have less than 8 GB VRAM on GPU, it is a good idea to turn on the --medvram option to save memory to generate more images at a time.

To enable them, right-click on the file webui-user.bat and select Edit. (You may need to select “Show More Options” first if you use Windows 11).

Replace the line



set COMMANDLINE_ARGS=--xformers --medvram

Save and close the file.

Double-click the webui-user.bat file to run Stable Diffusion.

Additional arguments

Use the argument --gradio-img2img-tool color-sketch to enable the color sketch tool, which could be helpful in img2img.

If you want to use the computer as a server and access the GUI with another computer, use the argument --listen to enable a connection from another computer. You will need to set the firewall appropriately on the server, and this is beyond the scope of this installation guide.

Next Step

That’s it! I hope you will have fun making AI images.

If you are new to Stable Diffusion, check out the Quick Start Guide for some quick tips to use Stable Diffusion.

Head to our beginner’s series to learn Stable Diffusion step by step.

Check out this prompt generator for building high-quality prompts.

RTX 4000 series graphic cards

Good news for you if you use RTX 4070, RTX 4080 or RTX 4090 Nvidia graphic cards. The latest version of AUTOMATIC1111 supports these video card. (with torch 2.0 and cuda 11.8)

I will provide a benchmark speed so that you can make sure your setup is working correctly. The settings are:

  • batch size: 4
  • batch count: 10
  • Image size: 512×512
  • Sampling steps: 20
  • Sampling method: Euler a
  • Model: SD v1.5

Using a batch size of 1 is not recommended, as the measured speed is likely to be highly dependent on other components on your system.

You should see the speed of generating each image. Pick a stable value, usually in the middle like the 5th batch. The speed is in it/s (iterations per second).

You should get about 10 its/s on RTX 4090. (Note that this is 4 images per iteration) This is the max speed you can get nowadays.

You can use one of the following speed-up parameters.

Option 1:


Option 2:

--opt-sdp-no-mem-attention --no-half-vae --opt-channelslast

Option 2 is slightly faster, but test them out to see what works best for you.

Updating AUTOMATIC1111

By default, your copy of AUTOMATIC1111 won’t be automatically updated. Given how fast things are moving, you will likely need to update your copy at some point to use the latest and the coolest.

There are two options for updating it. (1) Updating every time when you run it, and (2) Updating only when needed.

Updating every time you run

To update whenever you run webui, edit the file webui-user.bat. Add “git pull” before the line calling webui.bat. The file should look something like

@echo off

set GIT=
set COMMANDLINE_ARGS=--xformers --medvram
git pull
call webui.bat

From now on, webui will update itself every time it starts.

Updating as needed

It may not be a good idea to use the latest version because something could be broken. Updating periodically or only if you need a new feature is a more prudent approach.

To update the webui, open Command Prompt (cmd) and go to webui’s directory using the command below. (You will need to change %userprofile% if you installed it somewhere else.)

cd %userprofile%\stable-diffusion-webui

And run the command

git pull

Resetting webui

If git pull shows an error, it is usually because you have accidentally changed some files. You can reset the webui folder with the following two commands.

cd %userprofile%\stable-diffusion-webui
git checkout -f master

And then run git pull again.

git pull

Note that all files will be reset. You will need to make changes to webui-user.bat again.

Reverting back to a previous version

Sometimes the latest version of webui is broken, and you don’t want to use it. You can revert back to a previous version by following the instructions below.

Step 1: Go to this page to view previous versions. Each row is a previous version.

Step 2: Pick a previous version you want to revert back to. You can look at the date and comment to make a judgment.

Step 3: Press the copy button to copy the hash code of the version.

Step 4: In the command prompt, run the following commands. The hash code (highlighted below) is just an example. You will paste the one you just copied.

cd %userprofile%\stable-diffusion-webui
git checkout 076d624a297532d6e4abebe5807fd7c7504d7a73

If you see errors, reset the webui (see the previous section) and retry.

After checking out the previous code, delete the venv folder and restart WebUI.

Web options to run AUTOMATIC1111

Consider the following options for running Stable Diffusion without installing it locally.

(I earn a small commission if you subscribe.)

Graviti Diffus

Graviti Diffus lets you use AUTOMATIC1111 without having a GPU. The service is provided remotely. Follow the link to get an extra 20% credit!

Frequently Asked Questions

AUTOMATIC1111 does not start after updating.

Delete the venv folder and restart AUTOMATIC1111.

If it still doesn’t work, delete both the venv and the repositories folders and restart.

If it still doesn’t work and you have recently installed an extension, delete the folder of that extension in the extensions folder. Delete the venv folder and restart.

Does it work on AMD GPU?

No, you have to have an NVIDIA GPU.

What Python version should I use?

Python 3.10.6. Later versions of 3.10 work fine. But don’t use 3.11 or later.

How to resolve NaN errors when generating images?

Add --no-half argument to webui-user.bat (See Adding arguments)

How to resolve out-of-memory errors?

Use --low-vram instead of --med-vram argument in webui-user.bat (See Adding arguments)

Python doesn’t work correctly.

Try removing the previously installed Python using Add or remove programs.

There are two options for installing Python listed. Try the other one if the one you used didn’t work.

Is there an easier way to install AUTOMATIC1111?

The above is the official install instructions. Two alternatives:

I tried everything, but it still does not work.

You can use Google Colab to run AUTOMATIC1111. This is what I use. The notebook launches AUTOMATIC1111 with one mouse click.

Or Use AUTOMATIC1111 online.

If you find the content helpful, please support this site by becoming a member.

Buy Me A Coffee

By Andrew

Andrew is an experienced engineer with a specialization in Machine Learning and Artificial Intelligence. He is passionate about programming, art, photography, and education. He possesses a Ph.D. in engineering.


  1. stderr:
    ‘-m’ is not recognized as an internal or external command,
    operable program or batch file.

  2. I am getting the following Error when I run webui-user.bat:
    exit code: 9009

    ‘-m’ is not recognized as an internal or external command,
    operable program or batch file.

    1. I think you may have inadvertently edited the file webui-user.bat in a way that you are not supposed to.

      you can revert the change typing the following command inside the stable-diffusion-webui directory:

      git checkout -f

  3. Waste of time. It dosent work:
    RuntimeError: Couldn’t install torch.
    Command: “C:\Users\User\stable-diffusion-webui\venv\Scripts\python.exe” -m pip install torch==2.0.0 torchvision==0.15.1 –extra-index-url
    Error code: 1
    Press any key to continue . . .

  4. hey is there anyone with this problem? can you help me?
    venv “C:\Users\Admin\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: 22bcc7be428c94e9408f589966c2040187245d81
    Traceback (most recent call last):
    File “C:\Users\Admin\stable-diffusion-webui\”, line 355, in
    File “C:\Users\Admin\stable-diffusion-webui\”, line 260, 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:\Users\Admin\stable-diffusion-webui\”, line 121, in run_python
    return run(f'”{python}” -c “{code}”‘, desc, errdesc)
    File “C:\Users\Admin\stable-diffusion-webui\”, line 97, in run
    raise RuntimeError(message)
    RuntimeError: Error running command.
    Command: “C:\Users\Admin\stable-diffusion-webui\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
    stderr: C:\Users\Admin\stable-diffusion-webui\venv\lib\site-packages\torch\cuda\ UserWarning: CUDA initialization: The NVIDIA driver on your system is too old (found version 10010). Please update your GPU driver by downloading and installing a new version from the URL: Alternatively, go to: to install a PyTorch version that has been compiled with your version of the CUDA driver. (Triggered internally at ..\c10\cuda\CUDAFunctions.cpp:109.)
    return torch._C._cuda_getDeviceCount() > 0
    Traceback (most recent call last):
    File “”, line 1, in
    AssertionError: Torch is not able to use GPU; add –skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check

  5. I am lost. My install breaks with this error: “ModuleNotFoundError: No module named ‘basicsr.version'”
    I don’t see anyone reporting this above.

  6. I have the following error when I run webui-user.bat ERROR: Could not find a version that satisfies the requirement torch==1.13.1+cu117 (from versions: 2.0.0, 2.0.0+cu117)
    ERROR: No matching distribution found for torch==1.13.1+cu117

    1. You can see if you are using Python 3.10. It should have printed out in the console. Remove all python and install the one in Microsoft store if not.

      Delete the venv folder inside stable-diffusion-webui and start over.

  7. Okay, well to answer my own question, I removed the 3.11 and installed 3.10 instead. Now it’s working. Thanks!

  8. I keep getting a error of this. I have Python 3.10 installed.

    Please see the error, thanks.

    No Python at ‘”C:\Users\USERPROFILE\AppData\Local\Programs\Python\Python311\python.exe’

    1. It is calling a python that doesn’t exist anymore… please remove all python install from your PC, remove the stable diffusion folder, then install python 3.10 from Microsoft. start all over after.

  9. So it’s already tapping into the NVIDA GPU by default? I don’t have to take extra steps to make sure it’s tapping into that?

  10. Hello. I’m trying to run Stable Diffusion on an Acer Nitro 5 gaming laptop. The OS is Windows 11, GPU 0 is Intel UHD Graphics, and GPU 1 is NVIDIA GeForce RTX 3050 Ti Laptop GPU.

    In order to ensure maximum performance, how do I make sure the program is tapping into NVIDIA and not Intel?

  11. Hi!

    I had Stable Diffusion before but had to remove it, and am now trying to reinstall it. Everything went smoothly until I tried to use .bat, which gives me this:

    venv “C:\Users\Matilda\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: 22bcc7be428c94e9408f589966c2040187245d81
    Installing torch and torchvision
    C:\Users\Matilda\stable-diffusion-webui\venv\Scripts\python.exe: No module named pip
    Traceback (most recent call last):
    File “C:\Users\Matilda\stable-diffusion-webui\”, line 355, in
    File “C:\Users\Matilda\stable-diffusion-webui\”, line 257, in prepare_environment
    run(f'”{python}” -m {torch_command}’, “Installing torch and torchvision”, “Couldn’t install torch”, live=True)
    File “C:\Users\Matilda\stable-diffusion-webui\”, line 81, in run
    raise RuntimeError(f”””{errdesc or ‘Error running command’}.
    RuntimeError: Couldn’t install torch.
    Command: “C:\Users\Matilda\stable-diffusion-webui\venv\Scripts\python.exe” -m pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 –extra-index-url
    Error code: 1
    Press any key to continue . . .

    What do I do next?

    1. Hi, it looks like you don’t have pip installed in your python3.
      Try run
      python3 -m ensurepip
      If it still doesn’t work, uninstall all python and install the one on Microsoft store.

  12. I’m installing SD in a blank folder on my PC. I correctly installed Python 3.10.6, but I keep getting this:

    Collecting torch==1.13.1+cu117
    Downloading (2255.4 MB)

    … a LOT of RED error messages …

    RuntimeError: Couldn’t install torch.
    Command: “C:\AI\StableDiffusion\stable-diffusion-webui\venv\Scripts\python.exe” -m pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 –extra-index-url
    Error code: 2

    Any ideas what’s wrong?

    1. I don’t see the whole error message but it could be a permission issue. Try installing in your home directory to rule out a permission issue.

    1. It appears you already have the directory called “stable-diffusion-webui”.
      If you don’t need it, you can delete this folder and start again.
      You can reach the folder in File explorer at


  13. After running the .bat in step 5 I get an error message which prevents me to complete the rest:
    ERROR: Could not find a version that satisfies the requirement torch==1.13.1+cu117 (from versions: 2.0.0, 2.0.0+cu117)
    Can anyone help? thanks!

      1. So you’re saying that Python 3.11.3 won’t work? Since I’ve been having the same problem for days now.
        I DID get this to work a little while back but then not anymore.
        Tried reinstalling it all but back at the same problem.

  14. hi,camen,Is there an existing issue for this?
    I have searched the existing issues and checked the recent builds/commits
    What happened?
    web-ui didn’t work in every page, the same issue happend no matter which function I try to use. generate, setting, load new models, etc.
    nothings works now, It happened everywhere
    even if I cloned a new one, the same issue happened.
    try to remove extentions, delete config.jason, ui-config.jasion, add the user.css file… didn’t work

    1. Check the error logs: The first step in troubleshooting any issue is to check the logs for any error messages or warnings that may indicate what the problem is. If the logs are not available, enable logging and reproduce the issue to generate new logs.

      Verify dependencies: Stable-diffusion web-ui has several dependencies that must be installed and configured correctly for it to work. Verify that all dependencies are up-to-date and correctly configured.

      Verify web server configuration: The web server configuration could be causing the issue. Check the web server configuration to ensure that it is correctly set up to serve the stable-diffusion web-ui.

      Check for conflicts: It is possible that there is a conflict with another installed application or extension. Disable all extensions and applications except for the stable-diffusion web-ui to see if this resolves the issue.

      Verify the integrity of the source code: Clone the stable-diffusion web-ui repository again, and verify that the source code is intact and complete.

      Rebuild the application: If all else fails, rebuild the application from scratch. This may resolve any underlying issues with the code.

  15. I did everything so far but when the tutorial told me to find “webui-user.bat” to open it didn´t apeare nothing on my foldier…… so now what I can do?

      1. Help me

        venv “C:\Users\Josias\stable-diffusion-webui\venv\Scripts\Python.exe” Python 3.10.6 (tags/v3.10.6:9c7b4bd, 1er août 2022, 21:38:17) [MSC v. 1932 32 bits (Intel)] Version : v1.5.1 Commit hash : 68f336bd994bed5442ad95bad6b6ad5564a5409a Lancement de l’interface utilisateur Web avec des arguments : –skip-torch-cuda-test Microsoft Visual C++ Redistributable n’est pas installé, cela peut entraîner l’échec du chargement de la DLL. Il peut être téléchargé sur (appel le plus récent en dernier) : Fichier “C:\Users\Josias\stable-diffusion-webui\”, ligne 39, dans main() Fichier “C:\Users\Josias\stable-diffusion-webui\”, ligne 35, dans le fichier start() principal “C:\Users\Josias\stable-diffusion-webui\modules\”, ligne 390, dans start import webui File “C:\Users\Josias \stable-diffusion-webui\”, ligne 38, dans le fichier de torche d’importation “C:\Users\Josias\stable-diffusion-webui\venv\lib\site-packages\torch_ init”, ligne 122 , dans raise err OSError : [WinError 193] %1 n’est pas une application Win32 valide. Erreur lors du chargement de “C:\Users\Josias\stable-diffusion-webui\venv\lib\site-packages\torch\lib\asmjit.dll” ou de l’une de ses dépendances.

Leave a comment

Your email address will not be published. Required fields are marked *