Install ComfyUI and Build Your First Stable Diffusion Workflow
Get ComfyUI running locally, then wire a txt2img graph with a LoRA and ESRGAN upscaling.
What you'll build
A local ComfyUI 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 3.12 or 3.13 (3.13 is the best-supported; 3.14 works but some custom nodes break) and Git
- 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--cputo 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 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:
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 (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
AssertionError: Torch not compiled with CUDA enabled— you got CPU-only wheels (usually by runningpip install -r requirements.txtfirst). Fix:pip uninstall torch torchvision torchaudio, then reinstall with the--extra-index-url https://download.pytorch.org/whl/cu130command from step 1.safetensors_rust.SafetensorError: Error while deserializing header: HeaderTooLarge— the model file is corrupt, usually an HTML login page saved as.safetensors. Checkls -lh; if it's kilobytes, re-download using the/resolve/URL (not/blob/) or after logging in to Civitai.torch.OutOfMemoryError: CUDA out of memory— your GPU ran out of VRAM mid-sample. Relaunch withpython main.py --lowvram, or drop Empty Latent Image back to 512×512.- Checkpoint dropdown shows
null— the file is in the wrong folder or was added while the server was running. Confirm it's inmodels/checkpoints(not a subfolder of your home dir) and press R to refresh.
Next steps
Install 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, 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 — docs.comfy.org
- ComfyUI First Image Generation — docs.comfy.org
- ComfyUI LoRA Example — docs.comfy.org
- ComfyUI Image Upscale Example — docs.comfy.org
- ComfyUI README — github.com
- ComfyUI-Manager — github.com
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 3
local diffusion workflows are finally approachable enough that tutorials like this actually stick. the node graph approach just clicks different than the CLI soup we had before.
need to verify those vram numbers - 6gb comfortable or minimal? with what batch size and res? that matters more than version numbers
spent 4 hours last week debugging why my custom nodes kept throwing import errors after switching Python versions, turned out I had 3.13 installed but venv was still pointing at 3.12. would've saved myself a lot of grief if I'd just wiped the whole thing and started fresh with 3.13 first instead of trying to be clever about it.