|

How To Fix Stable Diffusion Exit Code 9009 Instantly

Are you facing the Stable Diffusion exit code 9009 error when installing Automatic1111? This is an error faced by many users during the installation process of Automatic1111. 

It can be quite frustrating as it stops you from using Stable Diffusion on your device.

So, in this short tutorial, I’ll show you how to fix Stable Diffusion exit code 9009 error so that you can properly launch Automatic1111 WebUI on your device. 

Let’s get started. 

What Is Stable Diffusion Exit Code 9009

The Stable Diffusion Exit Code 9009 error occurs when you launch the Automatic1111 WebUI for the first time after installing it. 

The error message states: “Couldn’t launch Python. Exit code 9009” 

How To Fix Stable Diffusion Exit Code 9009 - Error Message

The exit code 9009 error means that Automatic1111 was not able to find the Python installation directory on your device. 

The error message also states: 

“Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Exclusion Aliases”. 

If you go ahead and follow the instructions given in the error message and disable the short from the Manage App Exclusion Aliases, you’ll get another error message as shown below: 

How To Fix Stable Diffusion Exit Code 9009 - Error Message 2

Unfortunately, the instructions in the error message do not fix the issue and you’re still stuck with Automatic1111 not being able to run. 

How To Fix Stable Diffusion Exit Code 9009

The solution to the exit code 9009 error is very simple and takes less than a minute. Here’s how you can fix Stable Diffusion exit code 9009 error: 

Edit Automatic1111 Arguments

As mentioned above, you get the exit code 9009 error because Automatic1111 is not able to find the Python installation directory. 

To fix this, you’ll have to edit the Automatic1111 arguments and specify the exact location where Python is installed. 

Here’s how you can do this: 

Step 1. Go to your Automatic1111 installation directory, right-click on the webui-user.bat file, and click on Edit. 

How To Fix Stable Diffusion Exit Code 9009 - Edit WebUI File

Step 2. The file opens in Notepad and you’ll notice a bunch of lines arguments written on the file. There’s an argument named “set PYTHON=” that lets you specify the location of your Python directory. We’ll have to add our Python directory right after this line. 

 How To Fix Stable Diffusion Exit Code 9009 - WebUI File Edit

Step 3. You can find the Python installation directory on your device here:



C:\Users\Your User Name\AppData\Local\Programs\Python\Python310

How To Fix Stable Diffusion Exit Code 9009 - Python Directory

Copy and paste this line and replace the “Your User Name” with the name of your user account. 

Step 4. Paste this line right after the “set PYTHON=” line in the webui-user.bat file. Save the file and close it.

How To Fix Stable Diffusion Exit Code 9009 - WebUI File Arguments

Step 5. Now, run the webui-user.bat file again and it’ll successfully run properly and start downloading all the Python modules required for running Stable Diffusion. 

How To Fix Stable Diffusion Exit Code 9009 - Error Fixed

That’s all you need to do to fix the exit code 9009 error in Automatic1111. By directly specifying the Python directory, you can fix this error instantly. 

Reinstall Python 

If for some reason, you’re still facing the error after following the steps above, then it means there are some issues with your Python installation. 

To fix this, you’ll have to uninstall and reinstall Python again and try running Automatic1111 after that. 

Reinstalling Python will fix any issues you might be having with setting up Automatic1111. 

Related: How To Update Automatic1111

Conclusion 

So, that’s how you can fix the exit code 9009 error while installing Automatic1111. The solution is quite simple and literally takes less than a minute to fix it. 

Once fixed, you’ll be able to properly set up Automatic1111 and run Stable Diffusion on your device. 

If you have any questions about this tutorial or aren’t able to fix the issue, please let me know in the comments below. I’ll try my best to help you out.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.