# Install ComfyUI and Build Your First Stable Diffusion Workflow

> Source: <https://sourcefeed.dev/a/install-comfyui-and-build-your-first-stable-diffusion-workflow>
> Published: 2026-08-24 11:38:38+00:00

# Install ComfyUI and Build Your First Stable Diffusion Workflow

Get ComfyUI running locally, then wire a txt2img graph with a LoRA and ESRGAN upscaling.

[Mariana Souza](https://sourcefeed.dev/u/mariana_souza)

## What you'll build

A local [ComfyUI](https://www.comfy.org/) install running Stable Diffusion 1.5, plus a node-based text-to-image workflow you'll extend with a LoRA for style control and an ESRGAN upscaler — all copy-pasteable from a clean machine.

## Prerequisites

Verified against ComfyUI v0.33.1 (August 2026) with PyTorch CUDA 13.0 wheels.

[Python](https://www.python.org/)3.12 or 3.13 (3.13 is the best-supported; 3.14 works but some custom nodes break) and[Git](https://git-scm.com/)- An NVIDIA GPU with 6 GB+ VRAM for comfortable SD 1.5 use. AMD on Linux works via ROCm (swap the torch install for
`--index-url https://download.pytorch.org/whl/rocm7.2`

); Apple silicon works via PyTorch nightly. No GPU at all? Add`--cpu`

to the launch command — slow but functional. - ~8 GB free disk for the code and models

Commands below are for Linux/macOS; on Windows use `venv\Scripts\activate`

and the same pip commands (or grab the portable build from comfy.org and skip section 1).

## 1. Install ComfyUI

Clone the repo, create a virtual environment (ComfyUI's pinned deps will conflict with a system Python), and install PyTorch before the rest of the requirements:

```
git clone https://github.com/comfyanonymous/ComfyUI.git
cd ComfyUI
python3 -m venv venv
source venv/bin/activate
pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu130
pip install -r requirements.txt
```

## 2. Download a checkpoint

Checkpoints go in `models/checkpoints`

. Grab the fp16 SD 1.5 base model from Comfy-Org's [Hugging Face](https://huggingface.co/Comfy-Org/stable-diffusion-v1-5-archive) archive (~2 GB):

```
curl -L -o models/checkpoints/v1-5-pruned-emaonly-fp16.safetensors \
  "https://huggingface.co/Comfy-Org/stable-diffusion-v1-5-archive/resolve/main/v1-5-pruned-emaonly-fp16.safetensors"
```

## 3. Run the default txt2img workflow

```
python main.py
```

Open `http://127.0.0.1:8188`

. Load the default workflow via **Workflow → Browse Templates → Image Generation** (or it's already on the canvas on first launch). The graph reads left to right:

``` php
flowchart LR
    LC[Load Checkpoint] --> CT1[CLIP Text Encode<br>positive]
    LC --> CT2[CLIP Text Encode<br>negative]
    EL[Empty Latent Image] --> KS[KSampler]
    CT1 --> KS
    CT2 --> KS
    LC --> KS
    KS --> VD[VAE Decode] --> SI[Save Image]
```

Pick `v1-5-pruned-emaonly-fp16.safetensors`

in **Load Checkpoint**, type a prompt into the positive **CLIP Text Encode** node, and hit **Run** (Ctrl+Enter). Images land in the `output/`

folder.

## 4. Wire in a LoRA

LoRAs are small adapter weights that restyle a checkpoint. They live in `models/loras`

. The official docs use the SD 1.5-compatible blindbox LoRA from [Civitai](https://civitai.com/models/25995) (log in on the site if the direct download 401s):

```
curl -L -o models/loras/blindbox_V1Mix.safetensors \
  "https://civitai.com/api/download/models/32988?type=Model&format=SafeTensor&size=full&fp=fp16"
```

Back in the browser, press **R** to refresh the model lists, then double-click empty canvas, search **Load LoRA**, and splice it between the checkpoint and everything downstream: Load Checkpoint's `MODEL`

→ Load LoRA `model`

input, `CLIP`

→ `clip`

input; then Load LoRA's outputs feed the KSampler and both CLIP Text Encode nodes. `strength_model`

scales the LoRA's effect on the diffusion weights, `strength_clip`

on the text encoder — 1.0 for both is fine here. Add the trigger words `chibi, full body`

to your prompt and run again; you'll get toy-figurine style renders. Chain a second Load LoRA node after the first to stack styles.

## 5. Add upscaling

SD 1.5 natively generates 512×512. Model-based upscaling gets you a clean 4× without re-diffusing. Download RealESRGAN into `models/upscale_models`

:

```
curl -L -o models/upscale_models/RealESRGAN_x4plus.pth \
  "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth"
```

Refresh again, add a **Load Upscale Model** node and an **Upscale Image (using Model)** node. Wire VAE Decode's `IMAGE`

into the upscaler's `image`

input, the model loader into `upscale_model`

, and hang a second **Save Image** off the output so you keep both sizes.

## Verify it works

On launch the terminal should show your GPU and the server address:

```
Total VRAM 12282 MB, total RAM 32017 MB
pytorch version: 2.8.0+cu130
Device: cuda:0 NVIDIA GeForce RTX 3060
Starting server

To see the GUI go to: http://127.0.0.1:8188
```

After a run, the progress bar in KSampler completes, `got prompt`

and `Prompt executed`

appear in the terminal, and `output/`

contains a 512×512 image plus a 2048×2048 upscaled one.

## Troubleshooting

— you got CPU-only wheels (usually by running`AssertionError: Torch not compiled with CUDA enabled`

`pip install -r requirements.txt`

first). Fix:`pip uninstall torch torchvision torchaudio`

, then reinstall with the`--extra-index-url https://download.pytorch.org/whl/cu130`

command from step 1.— the model file is corrupt, usually an HTML login page saved as`safetensors_rust.SafetensorError: Error while deserializing header: HeaderTooLarge`

`.safetensors`

. Check`ls -lh`

; if it's kilobytes, re-download using the`/resolve/`

URL (not`/blob/`

) or after logging in to Civitai.— your GPU ran out of VRAM mid-sample. Relaunch with`torch.OutOfMemoryError: CUDA out of memory`

`python main.py --lowvram`

, or drop Empty Latent Image back to 512×512.**Checkpoint dropdown shows**— the file is in the wrong folder or was added while the server was running. Confirm it's in`null`

`models/checkpoints`

(not a subfolder of your home dir) and press**R** to refresh.

## Next steps

Install [ComfyUI-Manager](https://github.com/Comfy-Org/ComfyUI-Manager) (`git clone https://github.com/ltdrdata/ComfyUI-Manager`

inside `custom_nodes/`

, then restart) — it auto-installs missing custom nodes when you import someone else's workflow. From there, browse the built-in template library for SDXL and image-to-image graphs, work through the [official examples](https://docs.comfy.org/tutorials/basic/lora), and remember any PNG ComfyUI generates embeds its full workflow — drag one onto the canvas to reload it.

## Sources & further reading

-
[Manual Installation - Local Self-Hosted](https://docs.comfy.org/installation/manual_install)— docs.comfy.org -
[ComfyUI First Image Generation](https://docs.comfy.org/get_started/first_generation)— docs.comfy.org -
[ComfyUI LoRA Example](https://docs.comfy.org/tutorials/basic/lora)— docs.comfy.org -
[ComfyUI Image Upscale Example](https://docs.comfy.org/tutorials/basic/upscale)— docs.comfy.org -
[ComfyUI README](https://github.com/comfyanonymous/ComfyUI)— github.com -
[ComfyUI-Manager](https://github.com/Comfy-Org/ComfyUI-Manager)— github.com

[Mariana Souza](https://sourcefeed.dev/u/mariana_souza)· Senior Editor

Mariana covers the fast-moving world of machine learning and generative AI, with a particular focus on how these technologies are reshaping development workflows. When she isn't stress-testing the latest foundation models, she's usually at a local hackathon.

## Discussion 0

No comments yet

Be the first to weigh in.
