1. Introduction

For those who want to start Stable Diffusion but are hesitant
Stable Diffusion allows you to create your own unique images using AI.
Just hearing that is exciting, isn't it?
However, when I actually tried to start, for a non-engineer like
me, the initial "wall of environment setup" was higher than I expected...
I was one of those people.
The wall I first faced
I want to generate highly flexible images with Stable Diffusion!
I thought, but after looking into it, the first stumbling block was
the question, "What exactly do I need to install and how?"
What is Python? How do I install it?
What is Git used for?
Model files? Where do I put them?
I was overwhelmed by technical terms and setup procedures like this,
and even though there is a lot of information on the internet,
there is very little summarized for beginners,
so I proceeded while feeling anxious, not knowing left from right.
Naturally, I remember my hands stopping every time an error occurred,
and I almost gave up many times.
The purpose of this article
Based on my experience, in this article,
I have summarized the setup method for running Stable Diffusion with ComfyUI
so that even beginners can understand it in one go.
I explain the steps carefully and have included
specific notes for points where you are likely to stumble.
Furthermore, I also share the methods I used to resolve errors when I was in trouble. There is no need to give up just because you are a beginner.
If you proceed one step at a time, you will definitely be able to complete it!
This article is useful for people like this
Those who want to try AI image generation but are anxious about program settings
Those who know about the existence of ComfyUI but stumbled during installation
Those who have read tutorials but gave up due to constant errors
What you will gain from reading this article
If you read this article to the end and put it into practice,
you will be able to do the following.
Easily set up Stable Diffusion using ComfyUI.
Experience the first step of image generation using model files.
Gain the ability to complete the setup yourself while dealing with common errors.
2. What you need to prepare
PC specs required for operation (e.g., 8GB RAM or more, GPU is best)
3. Actual installation steps
Introduction: Basic flow
Installation is broadly divided into the following steps:
Install Python.
Install Git.
Install Anaconda/Miniconda.
Download and launch ComfyUI.
Creating a launch bat file and how to exit
Adding the "Checkpoint" model
↑ Select the Python version from here and
download it.
However, there is a point to note when installing.
Please select "Python 3.10.x" from "Downloads"
(be sure to choose the 3.10 series).
Note: Since versions 3.11 and later may not work, please use 3.10.x
Verify that it was installed correctly
Open the command prompt or terminal and
run the following command:
python --version
Output example:
Python 3.10.x
If the version information is displayed as shown above, the installation is complete.
・ Download Git from the official website
Official Git website and download the version compatible with your OS (Windows/Mac/Linux).
・ Install Git
Open the downloaded installer and
follow the instructions to install.
Basically, the default settings are fine.
Verify correct installation
Open the Command Prompt or Terminal and
run the following command:
git --version
Output example:
git version 2.x.x
If the version information is displayed, you are good to go.
This is where the procedure unique to ComfyUI begins.
Miniconda is a tool that allows you to
easily create and manage Python virtual environments.
When installing Stable Diffusion or ComfyUI,
it is recommended because you can isolate and manage your Python environment.
You can download it from here.
There is also a point to note when installing Miniconda.
・Launch the installer:
Double-click the downloaded file to
start the installation.
・Installation steps
Check the "License Agreement" and click "Agree."
Set the installation type to "Just Me (recommended)."
Specify the installation location (the default is fine).
・Check the box for "Add Miniconda3 to my PATH environment variable"
. Be careful, as if you forget to add the environment variable, you won't be able to use the commands later!
Click "Install" to finish.
Once the installation is complete,
follow the steps below to verify that Miniconda is working correctly.
Open the Command Prompt (or Terminal).
Enter the following command and press Enter:
conda --version
Output example:
conda 23.x.x
If the version information is displayed as shown above, the installation was successful.
3-5. Installing ComfyUI
We will now proceed to install ComfyUI.
Install the necessary data for ComfyUI into the folder you prepared.
・Clone ComfyUI using Git
Enter the following in the Command Prompt or Terminal:
git clone https://github.com/comfyanonymous/ComfyUI.git
When you execute the command, the installation will begin.
・Move to the ComfyUI folder
Next, move to the created ComfyUI folder to work within it.
cd comfyui
Next, create an environment to run ComfyUI using Anaconda or Miniconda.
Enter the following in the command prompt or terminal:
conda create -n comfyui python=3.10.6
*For the final Python version,
enter the version you installed.
Press Enter after typing it.
Next, enter the ComfyUI environment you created.
Enter and execute the following command:
conda activate comfyui
Next, install the files necessary for Stable Diffusion ComfyUI.
Enter the following command and press Enter to execute it.
pip install torch-directml
Continue by entering the following:
pip install -r requirements.txt
4. Creating a startup bat file and how to exit
To start the installed Stable Diffusion ComfyUI,
you enter commands in the environment you created.
Enter the following command and press Enter:
python main.py --directml
We will create a bat file for startup.
Inside the "ComfyUI" folder,
create a new text document and open it with Notepad or similar.
Enter the following command.
call conda activate comfyui python main.py --directml
The first line is the command to enter the environment created for ComfyUI.
Please enter the name of the environment you created.
The second line is the ComfyUI startup command.
By adding commands to the continuation,
you can customize your environment.
[Example]
--auto-launch Automatically display the ComfyUI screen in the browser
--lowvram It is recommended to include this if you have a graphics card with low VRAM of 8GB or less.
--disable-smart-memory A command to use regular memory as well when graphics memory is low
Once you have entered this command, please save it.
5. Installing the "Checkpoint" model
What is a model?Many people might wonder, "What is a model?"
To explain simply, a model is
the "brain" that Stable Diffusion uses to create images.
For AI to generate images, it needs "rules" and "patterns" learned from a massive amount of data. The data containing these rules is the model file.
For example, when you give an instruction like "draw a picture of a cat," the role of the model is to provide the standard for what kind of cat to draw.
To use Stable Diffusion, you need to load
pre-trained model data.
Without this, the AI cannot generate images.
Models can be downloaded for free from platforms like Hugging Face.
Let's obtain the model file using the following steps:
Recommended model for beginners: Stable Diffusion 1.5
Hugging Face.
-
Search for the "Stable Diffusion 1.5" model page.
Stable Diffusion v1.5
-
In the "Files and versions" section on the right side of the page, find and download v1-5-pruned.ckpt (or a .safetensors file).
.ckpt or .safetensors extensions are common model formats.
Downloading files requires a free Hugging Face account registration.
Place the downloaded model file in the correct folder that ComfyUI can read.
Folder location
Open the folder where you installed ComfyUI.
Navigate to the following directory within it:
ComfyUI/models/checkpoints/
Place the file
Copy the downloaded model file (e.g., v1-5-pruned.ckpt) into the checkpoints folder mentioned above.
Launch ComfyUI and check if the model is loaded correctly.
Confirmation steps
Launch ComfyUI:
python run.py
Open the ComfyUI screen displayed in your browser.
-
Check the model selection menu on the screen.
If the model you just placed (e.g., v1-5-pruned) appears in the list, you've succeeded!
Models can be changed: Switching models changes the style of the generated images. Start with the official model (v1.5), and once you get used to it, it's fun to try other custom models.
Large file sizes: Model files range from several hundred MB to several GB. Please be mindful of your network environment when downloading.
Difference in extensions: Both .ckpt and .safetensors can be used, but .safetensors is considered a safer format.
Organizing folders as follows will allow
ComfyUI to load models correctly:
ComfyUI/ └── models/ └── checkpoints/ └── v1-5-pruned.ckpt
Next, let's actually generate an image using this model!
If you encounter any errors or have questions, please refer to this article.
Finally
Thank you for reading this far!
Through this article, I hope you have learned everything from the preparations for using Stable Diffusion with ComfyUI to the
setup process.
You might be confused by the technical terms and the number of steps at first, but
if you follow this article step by step, you will definitely succeed.
I stumbled many times at first too, but as a result of not giving up,
I have come to enjoy my own wonderful world of AI art.
Errors are opportunities for growth: If an error occurs along the way, it's a learning opportunity to move forward! Don't panic, and try to find the cause one by one.
Don't forget to have fun: AI art is a wonderful tool that allows you to give shape to your imagination. Above all, please make sure to enjoy it!
There is so much more you can do from here! For example:
Refine your prompts to create more unique images.
Introduce custom models to try out different styles of art.
Arrange the node structure to challenge yourself with more complex image generation.
Please feel free to share the images you generate on social media or in communities.
By showing your work to others, you might get new ideas or
find inspiration!
Finally, I would be very happy if this article helped you take your
first step into AI art.
Continue to challenge yourself with new things and enjoy the possibilities of AI!
I'm rooting for you!