How to Run ComfyUI for Local Image Generation
By the end of this guide, you will be generating images from a node-based graph on your own hardware — and with ComfyUI’s weight streaming, even the largest open models run on 4 GB of VRAM plus 8 GB of RAM. The official README says it supports all operating systems and GPU types — NVIDIA, AMD, Intel, Apple Silicon, Ascend.
The numbers up front: community benchmarks put Flux.1-dev at 1024², 28 steps in 8–12 s on an RTX 4090 and 15–20 s on an RTX 3090, while a 16 GB Mac M1 or M2 takes 30–60 s for the same class of image. Every row below is a named hardware card, not a guess.
Requirements
- Windows, Linux, or macOS (Apple Silicon M series).
- Python 3.13 is the recommended runtime — 3.14 works with caveats, 3.12 is the fallback. PyTorch 2.7+ (newer is recommended).
- On Windows: the MSVC Redistributable first, or nothing compiles cleanly.
- No official Docker image — the paths are git clone + a Python environment, or the Desktop app.
- Practical minimum: 6–8 GB GPU (GTX 1060 6 GB / RX 580 8 GB is the community floor), 16 GB RAM, 20 GB+ disk for model files.
1. Install ComfyUI (git or Desktop)
Latest release as of October 2026: v0.42.1 (2026-10-19). One gotcha up front: the repository’s default branch is master, not main — raw URLs on main 404.
git clone https://github.com/Comfy-Org/ComfyUI.git
cd ComfyUI
conda create -n comfyenv
conda activate comfyenv
pip install -r requirements.txt
python main.py
The Desktop app (Windows & macOS) tracks the stable channel; switch it to “Latest on GitHub” for the edge. This guide assumes the git route.
2. Install PyTorch for your GPU
Pick the wheel for your card:
NVIDIA (20-series and newer need the cu130+ wheel):
pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu130
AMD on Linux (ROCm 7.2):
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm7.2
AMD on Windows: ROCm 10.0 multi-arch wheels covering RDNA 2–4, no HIP SDK needed, on Windows 11 with 64-bit Python 3.13. Intel Arc uses the torch.xpu path. Apple Silicon gets the MPS backend — verify it works first:
python -c "import torch; print(torch.backends.mps.is_available())"
If that prints False, fall back to --cpu (it works; it is slow).
3. Start the server on port 8188
python main.py
ComfyUI “automatically starts an HTTP server at http://127.0.0.1:8188”. The flags below are verified from comfy/cli_args.py on master, so the defaults are not folklore:
--listen— defaults to 127.0.0.1. Bare--listen(no IP) opens 0.0.0.0,::, i.e. every interface.--port— defaults to 8188;--max-upload-size— defaults to 100 (MB);--enable-cors-header— defaults to*.--cpu,--novram,--highvram,--gpu-only,--reserve-vram(GB reserved for the OS).--lowvram— its own help text says it “doesn’t do anything if dynamic vram is enabled”, which is the default. Do not reach for it first.--cache-ram— default 10% of system RAM, clamped 2–10 GB (inactive above 128 GB);--cache-classic,--cache-lru,--cache-noneswitch strategies.--fp16-unet,--fp8_e4m3fn-unet,--force-fp32/--force-fp16— precision switches; the fp8 unet is the one that halves VRAM.--extra-model-paths-config— one or moreextra_model_paths.yamlfiles so several installs share one model library.
4. Load a checkpoint and generate
Drop weight files into the right folder — this is where most “my model is missing” reports come from:
models/checkpoints/— full checkpointsmodels/unet/— UNet files
The two reference models, with exact sizes: Flux.1-dev is 11.9B parameters in BF16 — flux1-dev.safetensors is 23,802,932,552 bytes (≈ 23.8 GB) plus ae.safetensors (≈ 335 MB), and it carries a non-commercial license. SDXL base 1.0 is the open-weights option: sd_xl_base_1.0.safetensors at 6.94 GB.
Short on VRAM? Three levers, in order: the fp8 unet (roughly half of fp16’s VRAM), FLUX GGUF Q4_K_S (runs, but slow, on 8 GB), and FLUX schnell — and weight streaming is what lets the largest open models run at all on a 4 GB card.
5. Update without breaking custom nodes
git pull
pip install -r requirements.txt
Pin with git checkout master or a specific commit. The portable install ships three scripts: update_comfyui.bat (dev), update_comfyui_stable.bat, and update_comfyui_and_python_dependencies.bat — the last one reinstalls all dependencies plus PyTorch (CUDA 12.9) and is the one that breaks custom nodes. If nodes stopped after an update, that script is the first suspect.
What to expect
Flux.1-dev class images, 1024², 28 steps unless noted. GPU rows are community benchmarks; Mac rows are from the macgpu source group — and the Mac GPU working set is about 70% of unified memory, so the memory size in each row matters:
| Hardware | Model | Size | Time per image |
|---|---|---|---|
| 1× RTX 4090 24 GB | Flux.1-dev | 1024², 28 steps | 8–12 s |
| 1× RTX 4080 16 GB | Flux.1-dev | 1024², 28 steps | 12–16 s |
| 1× RTX 3090 24 GB | Flux.1-dev | 1024², 28 steps | 15–20 s |
| Mac M1 / M2, 16 GB | SDXL-class | 512–768 px | 30–60 s |
| Mac M2 Pro / M3, 32 GB | SDXL-class | 1024² | 15–30 s |
| Mac M3 Pro / M4, 36 GB | SDXL-class | 1024–1280² | 10–20 s |
| Mac M4 Max / Pro, 64 GB | SDXL-class | 1024² | 8–18 s |
Anchor data point: an M1 Max 16 GB produced SDXL 1024² in about 40 s, where an RTX 4060 laptop GPU did it in 16 s — unified memory is fast, but discrete VRAM cards win on raw per-image time.
Troubleshooting
torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate X MiB. GPU 0 has a total capacity of 24.00 GiB… (or RuntimeError: CUDA error: out of memory) — the model plus cache exceeds VRAM. Reach for the fp8 unet first, then --novram, then a smaller model. --lowvram may do nothing under the default dynamic vram.
Cannot find node class 'NodeClassName' — a workflow references a node from a custom pack that is missing or stale. Update or install that pack before re-running.
SafetensorError: Error reading file: invalid header or RuntimeError: PytorchStreamReader failed reading zip archive — the weight file is corrupt or truncated. Delete and re-download; partial downloads are the usual cause.
Model is not in the dropdown — the file is not in models/checkpoints/ (or models/unet/ for UNet files). The UI only lists those two trees.
FAQ
Can I run Flux on 8 GB of VRAM? Yes, with compromises: FLUX GGUF Q4_K_S runs but is slow, FLUX schnell is the lighter sibling, and the fp8 unet roughly halves the VRAM of fp16. Weight streaming is what keeps it alive at all on smaller cards.
Which Python version should I use? 3.13 is the recommendation; 3.14 works with caveats and 3.12 is the fallback. If you are on Windows, the MSVC Redistributable is required before any of it.
Is Flux.1-dev free to use commercially? No — it is non-commercial licensed. SDXL is the open-weights option for commercial work. This is a license line, not a speed trade-off.
Is there an official Docker image? No. The documented paths are git clone + a Python environment and the Desktop app; community Dockerfiles exist, none official.
That is the image-generation path. For the text side, the vLLM guide and the llama.cpp guide cover LLM serving on the same hardware. The ComfyUI review in the Software pillar covers architecture this guide skips, and the Task Finder maps any task to the tools that do it, local and cloud.
Sources
- Comfy-Org/ComfyUI README — “all operating systems and GPU types” line, weight streaming at 4 GB VRAM + 8 GB RAM, manual install, PyTorch wheels (cu130, rocm7.2), MPS check, MSVC note (branch
master). - ComfyUI v0.42.1 release — published 2026-10-19.
- ComfyUI docs — System requirements — OS support, Python 3.13 recommended / 3.12 fallback, PyTorch 2.7+, ROCm 7.2 (AMD Linux) / ROCm 10.0 multi-arch RDNA 2–4 (AMD Windows), no official Docker image.
- ComfyUI docs — Manual install — step-by-step, the 127.0.0.1:8188 server line,
pip install -r requirements.txt. - ComfyUI docs — Update ComfyUI —
git pull+ requirements, pinning, the three portable update scripts and the full-reinstall warning, Desktop stable/Latest channels. - Comfy-Org/ComfyUI
comfy/cli_args.py(master) — every default in step 3:--listen127.0.0.1,--port8188,--max-upload-size100,--lowvramhelp text,--cache-ram10%/2–10 GB, precision flags. - Hugging Face — black-forest-labs FLUX.1-dev — 11,901,408,320 params (11.9B) BF16,
flux1-dev.safetensors= 23,802,932,552 B ≈ 23.8 GB,ae.safetensors≈ 335 MB, non-commercial license. - Hugging Face — stabilityai SDXL —
sd_xl_base_1.0.safetensors= 6.94 GB. - macgpu — Mac GPU benchmarks — all Mac per-image timings, the M1 Max vs 4060 laptop data point, the ~70% unified-memory working set; NVIDIA timings attributed to community benchmarks.
- wangkanai — FLUX fp8 — fp8 ≈ 50% of fp16 VRAM.
- artokun/comfyui-mcp and deepwiki — Comfy-Org/ComfyUI — the exact error strings in Troubleshooting (CUDA OOM, node class, SafetensorError, missing-model dropdown).