How to install Stable Diffusion on Windows (AUTOMATIC1111)

Updated Categorized as Tutorial Tagged , 469 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

Installing on AMD GPU

AUTOMATIC1111 does not officially support AMD GPUs, but it is possible to make it work if you are tech-savvy or willing to try. See the unofficial installation guide on the official GitHub page.

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.

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 --lowvram instead of --medvram argument in webui-user.bat (See Adding arguments)

For optimizing memory usage for SDXL models:

  • Nvidia (12GB+) --xformers
  • Nvidia (8GB) --medvram-sdxl --xformers
  • Nvidia (4GB) --lowvram --xformers

See this article for more details.

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.


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 has a Ph.D. in engineering.


  1. Launching Web UI with arguments: –xformers –medvram
    Traceback (most recent call last):
    File “C:\Users\User\stable-diffusion-webui\”, line 48, in
    File “C:\Users\User\stable-diffusion-webui\”, line 44, in main
    File “C:\Users\User\stable-diffusion-webui\modules\”, line 465, in start
    import webui
    File “C:\Users\User\stable-diffusion-webui\”, line 13, in
    File “C:\Users\User\stable-diffusion-webui\modules\”, line 39, in imports
    from modules import processing, gradio_extensons, ui # noqa: F401
    File “C:\Users\User\stable-diffusion-webui\modules\”, line 14, in
    import cv2
    File “C:\Users\User\stable-diffusion-webui\venv\lib\site-packages\cv2\”, line 181, in
    File “C:\Users\User\stable-diffusion-webui\venv\lib\site-packages\cv2\”, line 153, in bootstrap
    native_module = importlib.import_module(“cv2”)
    File “C:\Users\User\AppData\Local\Programs\Python\Python310\lib\importlib\”, line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
    ImportError: DLL load failed while importing cv2: The specified module could not be found.
    Press any key to continue . . .

  2. ERROR: Could not find a version that satisfies the requirement torch==2.1.2 (from versions: 2.2.0, 2.2.0+cu121, 2.2.1, 2.2.1+cu121, 2.2.2, 2.2.2+cu121, 2.3.0, 2.3.0+cu121)
    ERROR: No matching distribution found for torch==2.1.2

  3. Hi, new problem here.
    After launching webui-user.bat, it opens the Stable Diffusion page in the Chrome browser.
    when I try to generate the “a cat” prompt, this text appears under the image preview
    “AttributeError: ‘NoneType’ object has no attribute ‘lowvram'”

    I’ve looked through all the files, but I have no idea how to fix it.
    I understand that the “lowvram” parameter is missing somewhere. But where?

  4. Hi, after clicking on webui-user.bat
    I’have this message in red:

    Version: v1.9.3
    Commit hash: 1c0a0c4c26f78c32095ebc7f8af82f5c04fca8c0
    Installing torch and torchvision
    Looking in indexes:,
    Collecting torch==2.1.2
    Using cached (2473.9 MB)
    ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
    torch==2.1.2 from
    Expected sha256 9925143dece0e63c5404a72d59eb668ef78795418e96b576f94d75dcea6030b9
    Got dba2917daacb9de3d858e4352674eca4404a417bef28760e82e76994da4a6f9b

    Why and what do I do?
    Thank you

  5. Hy. I already follow all your steps and run stable diffusion in chrome succesfuly.
    But after I type a prompt and click “generate” nothing happened.
    WIN. 11
    CPU: AMD Ryzen 5 3600
    GPU: Nvidia GTX1660
    Please Help me. Thank You.

  6. Just a quick note for anyone else trying to get Stable Diffusion working on WSL2
    (Windows 11 with WSL2 and Ubuntu 22.04.4 selected as distribution):

    It worked fine at least on my 4080RTX, the key part (at least for me) was that the default python installed for the default Ubuntu distribution kept trying to use python 3.9.
    Which resulted in an error code:
    Error code: 137

    (aliasing python3.10 and/or PATH$ to include the supported python 3.10 version didn’t work for me, what did work for me was setting it in the before trying to run

    uncomment the line containing python_cmd and update value to the (currently) supported Python path:


    This solved my issue.

  7. I encountered this error. I have installed pip module manually. Any other recommendations?

    venv “C:\stable-diffusion\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)]
    Version: v1.8.0
    Commit hash: bef51aed032c0aaa5cfd80445bc4cf0d85b408b5
    Installing torch and torchvision
    C:\stable-diffusion\stable-diffusion-webui\venv\Scripts\python.exe: No module named pip
    Traceback (most recent call last):
    File “C:\stable-diffusion\stable-diffusion-webui\”, line 48, in
    File “C:\stable-diffusion\stable-diffusion-webui\”, line 39, in main
    File “C:\stable-diffusion\stable-diffusion-webui\modules\”, line 380, in prepare_environment
    run(f'”{python}” -m {torch_command}’, “Installing torch and torchvision”, “Couldn’t install torch”, live=True)
    File “C:\stable-diffusion\stable-diffusion-webui\modules\”, line 115, in run
    raise RuntimeError(“\n”.join(error_bits))
    RuntimeError: Couldn’t install torch.
    Command: “C:\stable-diffusion\stable-diffusion-webui\venv\Scripts\python.exe” -m pip install torch==2.1.2 torchvision==0.16.2 –extra-index-url
    Error code: 1
    Press any key to continue . . .

    1. your python installation is missing the pip package.

      You can try removing it and installing python 3.10 from the microsoft store.

      start all over.

  8. Hi, nothing happens when I double click the webui-user.bat file, some git command prompt like thing opens for like half a second then closes itself and nothing happens

  9. Hi,

    When I run webui_user.bat, it give me this error message :

    venv “C:\Users\janis\stable-diffusion-webui\venv\Scripts\Python.exe”
    Python 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
    Version: v1.8.0
    Commit hash: bef51aed032c0aaa5cfd80445bc4cf0d85b408b5
    Traceback (most recent call last):
    File “C:\Users\janis\stable-diffusion-webui\”, line 48, in
    File “C:\Users\janis\stable-diffusion-webui\”, line 39, in main
    File “C:\Users\janis\stable-diffusion-webui\modules\”, line 386, in prepare_environment
    raise RuntimeError(
    RuntimeError: Torch is not able to use GPU; add –skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check
    Appuyez sur une touche pour continuer…

    Can anyone help me about what I have to do to resolve this?

  10. I have a 3060 ti and am trying to install this for the first time. I followed the instructions but installed python 3.12, then uninstalled and installed 3.10 instead as instructed from the windows store. I now get this error when running the webui batch file. I’d really appreciate some help

    venv “C:\Users\guswo\stable-diffusion-webui\venv\Scripts\Python.exe”
    No Python at ‘”C:\Users\guswo\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\python.exe’

  11. I’m using the collab and trying to use version 1.5. Since the most recent update I’m now getting the following error: ModuleNotFoundError: No module named ‘torchvision.transforms.functional_tensor’. Is there some way I can fix the code to roll back and updates?

    1. the most recent update simply load v1.8.0 instead of v1.7.0. Are you saying you are trying to load v1.5.0? You can post the whole error message

      1. Yes, I’m trying to load v1.5.0. Before the update, I was able to load v1.5.0 just fine. Here is the error:

        2024-03-19 23:23:30.305660: E external/local_xla/xla/stream_executor/cuda/] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
        2024-03-19 23:23:30.305707: E external/local_xla/xla/stream_executor/cuda/] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
        2024-03-19 23:23:30.307059: E external/local_xla/xla/stream_executor/cuda/] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
        2024-03-19 23:23:30.314216: I tensorflow/core/platform/] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
        To enable the following instructions: AVX2 AVX512F FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
        2024-03-19 23:23:31.355701: W tensorflow/compiler/tf2tensorrt/utils/] TF-TRT Warning: Could not find TensorRT
        /usr/local/lib/python3.10/dist-packages/gradio_client/ UserWarning: Could not get documentation group for : No known documentation group for module ‘gradio.mix’
        warnings.warn(f”Could not get documentation group for {cls}: {exc}”)
        /usr/local/lib/python3.10/dist-packages/gradio_client/ UserWarning: Could not get documentation group for : No known documentation group for module ‘gradio.mix’
        warnings.warn(f”Could not get documentation group for {cls}: {exc}”)
        no module ‘xformers’. Processing without…
        no module ‘xformers’. Processing without…
        No module ‘xformers’. Proceeding without it.

        ModuleNotFoundError: No module named ‘torchvision.transforms.functional_tensor’

        1. There’s likely an incompatibility between v1.5.0 and the colab env. Looks like the version of torchvision is incorrect. You can try copying the notebook and install it.

          The notebook works for v1.8.0. I won’t be able to support multiple versions of A1111.

  12. Hey! I’ve got everything set up and working, but do you remember the prompt you used for the image at the very top of the page? I’m testing out models and the like to get a feel for what I like, and that’s an amazing image, but I’m having a ton of trouble nailing it down and it’d serve as a great example for what a “good” prompt looks like.

    1. There should be something. You can delete the stable-diffusion-webui folder in Explorer and try again. Watch out for error messages

      1. Never mind I Fixed that issue, when I re-cloned the file, I notice the Webus-user.bat is not in the folder though.