ComfyUI Setup
This page was translated automatically from Italian. Read the original
Create video, images and audio with artificial intelligence on your computer, using free models. No subscriptions, no credits to buy, no files uploaded to someone else’s servers: your graphics card does the work, and what you create stays in your home.
ComfyUI is the most powerful tool available today to do this, but it is also one of the most difficult to set up. This project is a script that does the hard work for you: it checks your system, measures your GPU, builds a ComfyUI installation with over a hundred pre-configured extensions, launches it with the right settings for your hardware and, when requested, downloads the models and workflows to get you started.
What you can create
| What | With which models | |
|---|---|---|
| Video | Clips from text or a photo, long videos via segments, intermediate frames for smoothness, upscale | Wan 2.2 (14B and 5B), LightX2V at 4 steps, Stable Video Infinity, RIFE, SeedVR2, LTX-2.3 |
| Images | Realistic photos, illustrations, text-based retouching, part replacement, enlargements | Z-Image Turbo, Juggernaut XL, Flux, Qwen-Image, FireRed Edit, ControlNet, IPAdapter |
| Audio | Sounds and effects generated by watching the video, synchronized with what is happening | MMAudio (and, outside the EU, HunyuanVideo-Foley) |
And then everything the community publishes every day: the included CivitAI scraper brings the most used workflows for video, images, and audio directly into your ComfyUI, ready to open.
Why it exists
Anyone who has tried to install ComfyUI for video generation knows the struggle: finding the right PyTorch version for the card, extensions failing to load due to a library update, searching for models one by one using the exact names the workflow expects, running out of VRAM halfway through generation, and guessing parameters. Weeks of attempts before producing the first decent video.
This script is the result of those weeks, organized into a single process. Every fix it contains stems from a real error encountered on test hardware:
- fixed extensions: over one hundred custom nodes installed and verified, including fixes for those broken by updated libraries;
- memory under control: VRAM and RAM profiles selected automatically, with a cautious CUDA mode that can be enabled only if necessary;
- SageAttention compiled for your specific card on the first run, with a safe fallback if the card does not support it;
- consistent model names: workflows find files even when searching with different names or folder structures;
- no paid services: official ComfyUI API nodes (OpenAI, Google, etc.) are disabled and everything runs locally; only two nodes for the RunningHub service remain installed, which do nothing without an account.
Tested on real hardware
Everything you find here has been tested on a normal machine, not on a server costing thousands of euros:
| Component | Test machine |
|---|---|
| Graphics card | NVIDIA GeForce RTX 4070, 12 GB VRAM |
| Processor | Intel Xeon E5-2699 v4 (22 cores, 44 threads, from 2016) |
| Memory | 64 GB DDR4 |
| Card connection | PCI Express 3.0 x16 |
| System | Ubuntu 24.04 LTS, Docker, NVIDIA driver 595 |
Twelve gigabytes of VRAM are considered the minimum for 14 billion parameter video models, which alone weigh more than the card’s memory. With the settings the script applies automatically, the 4070 runs them without memory errors by swapping model parts into system RAM.
Measured times
| Task | Settings | First run | Subsequent runs | VRAM used |
|---|---|---|---|---|
| Image with SDXL Lightning | 1024×1024, 6 steps | 44 s | 4.6 s | 9.7 GB |
| Image with Z-Image Turbo | 1024×1024, 8 steps | 2 min | 10 s | 11.8 GB |
| Audio with MMAudio | 5 seconds of sound extracted from a video | 37 s | 7 s | 6.1 GB |
| Video with Wan 2.2 14B from a photo | 5 seconds at 832×480, LightX2V 4 steps | 4 min 16 s | 2 min 16 s | 10.5 GB |
| Video with Wan 2.2 5B from text | 5 seconds at 1280×704, 20 steps | 8 min | 7 min | 11.8 GB |
The first run after startup includes loading the models from the disk (this is significantly shortened with a fast SSD); subsequent runs find them already in memory. All tests were performed with the script’s default settings, without manual tweaks, and none ran out of memory.
What came out of those tests
![]() | ![]() |
| Z-Image Turbo, 10 seconds | SDXL Lightning, 4.6 seconds |
![]() | ![]() |
| Wan 2.2 14B: the photo above becomes a video | Wan 2.2 5B: a video from a sentence |
The bicycle video started exactly from the image generated with Z-Image, and MMAudio then added the sound: a small complete workflow, all running locally.
Requirements
| Minimum | Recommended | |
|---|---|---|
| System | Linux with Docker (Ubuntu or Debian) | Ubuntu 22.04 or 24.04 |
| Graphics Card | NVIDIA with 8 GB | NVIDIA with 12 GB or more (RTX 30, 40, 50 series) |
| Memory | 16 GB | 32 GB, 64 GB for long videos |
| Disk | about 100 GB free for the first build (then the image occupies about 50) + models | an SSD with 250 GB free |
The script automatically installs what is missing (Docker, NVIDIA drivers, NVIDIA Container Toolkit) after asking for confirmation. On Windows, you can use WSL2 with Ubuntu, but it is not a tested path.
Watch your disk space. Many gigabytes are required, and they grow with use: the Docker image occupies about 50 GB (about 100 during the first build), models range from 6 GB to over 100 GB depending on what you choose, and every execution of the CivitAI scraper can add up to 20 GB of LoRAs. Before downloading, check the space with
--statusand see what would be downloaded with--dry-run. If the Docker disk fills up, other containers on the machine will also suffer.
Installation
1. Download the script into an empty folder, which will become the installation folder:
mkdir ~/comfyui && cd ~/comfyui
wget https://git.eandgcode.com/egprojects/comfyuisetup/-/raw/main/setup-comfyui.sh
chmod +x setup-comfyui.sh
2. Run it:
./setup-comfyui.sh
On the first run, it creates the .env file with all settings commented out, checks the system, displays your machine’s calibration profile, and builds the Docker image. The first build takes one to two hours, depending on your connection and processor; afterwards, a startup takes a few minutes and a restart takes less than one.
3. Choose the models for what you want to do:
./setup-comfyui.sh --models video
./setup-comfyui.sh --models image,audio
4. Open your browser at http://indirizzo-del-pc:8188. In the workflow menu, you will find the quick guide and ready-to-use workflows; in the Workflow → Browse Templates menu, you can find the official ComfyUI templates, which work immediately with the downloaded models.
At the end of each execution, the script tells you what the next step is.
The models
Models are never downloaded automatically: you choose them, by category. Each set has been tested and is filtered based on your graphics card: anything that wouldn’t fit is skipped.
| Command | What it downloads | Space |
|---|---|---|
--models video | Wan 2.2 14B image-to-video and text-to-video (FP8), Wan 2.2 5B, 4-step LoRA LightX2V, encoder, VAE, RIFE interpolation, upscaler | approx. 85 GB |
--models image | Z-Image Turbo with its encoder, Juggernaut XL Lightning, DMD2, 4x upscaler | approx. 29 GB |
--models audio | MMAudio with its components and the BigVGAN vocoder | approx. 6 GB |
--models all | all three | approx. 120 GB |
--full (in addition) | GGUF and FP16 variants, LTX-2.3, Flux, Qwen-Image Edit, FireRed, IPAdapter, ControlNet, InstantID, SAM2, SeedVR2… | up to approx. 850 GB if you take absolutely everything |
Useful details:
- an already downloaded and intact file will not be re-downloaded: if a download is interrupted, just rerun the same command (or
--download, which repeats the last choice); - downloads run in a separate container: you can close the terminal and resume tracking them with
--job; - with
--dry-runyou can see the list of what would be downloaded, without downloading anything; - files 27 GB and larger (full precision versions) are excluded until you set
INCLUDE_LARGE_MODELS=truein the.env; - you can add your favorite models to a personal catalog (see below) and download them using the same commands.
Model Licenses
Models are free, but each has its own license. All are fine for personal use; for commercial use, check first:
| Model | License | Commercial use |
|---|---|---|
| Wan 2.2, LightX2V | Apache 2.0 | yes |
| Z-Image Turbo, Qwen-Image | Apache 2.0 | yes |
| Juggernaut XL | CreativeML OpenRAIL-M | yes, subject to license usage restrictions |
| DMD2, MMAudio | CC BY-NC 4.0 | no |
| FLUX.1 dev | FLUX.1 [dev] Non-Commercial | no (and must be accepted on Hugging Face) |
| LTX-2.3 | LTX-2 Community License | free under 10 million annual turnover |
| HunyuanVideo and HunyuanVideo-Foley | Tencent Hunyuan Community | the license is not valid in the European Union: this is why they are not in the default sets |
The CivitAI scraper
CivitAI is where the ComfyUI community publishes workflows, models, and examples. The scraper searches for them for you, by category:
./setup-comfyui.sh --civitai-scraper video
./setup-comfyui.sh --civitai-scraper image,audio
For each category, it does three things:
- workflow: searches for the most downloaded, highest-rated, and most recent published workflows, downloads them, extracts them from archives, and places them in the ComfyUI workflow browser, in
civitai/<categoria>/; - examples (for images): examines the most liked images of the period and saves the ComfyUI workflow that many have embedded, so you can recreate that image and change it however you want;
- LoRA: downloads the most downloaded LoRAs for the models in that category, within a storage limit that you decide (20 GB by default).
Finally, it analyzes all workflows and tells you which models are missing and how many workflows need them, so you know what to download.
Keep an eye on the scraper. Workflows and examples are small, but LoRAs are not: each run can download up to
SCRAPER_MAX_MODEL_GB(20 GB by default), and runs accumulate because it finds new results every time. Before launching it, check the free space with--statusand the list of what it would download with--dry-run; if you only want workflows, setSCRAPER_MODELS_PER_CATEGORY=0in the.env. Downloaded LoRAs are all stored inmodels/loras/civitai/, making them easy to monitor and delete.
Searches change with every execution: rerunning it will find new things. A free CivitAI token (Account settings → API Keys) is required in the .env: without it, the search works but many downloads will be rejected.
Content filter
The scraper has an active NSFW filter by default: it only requests content from CivitAI classified as safe for all audiences and discards any result with a higher rating. The --include-nsfw option disables it; results that the filter would have excluded end up in separate folders (<categoria>-nsfw). Users of this option are responsible for complying with CivitAI’s rules and their own country’s laws.
Configuration
Everything personal is contained in the .env file next to the script: if it does not exist, it is created on the first run, with a comment for each entry. No entry is mandatory for calibration. The main ones:
| Entry | Purpose |
|---|---|
HF_TOKEN | Hugging Face token, for the few models that require license acceptance |
CIVITAI_TOKEN | CivitAI token, for the scraper |
BASE_DIR, MODELS_DIR | where to place the installation and the models (including on another disk) |
COMFYUI_PORT, BIND_ADDR | interface port and which network to listen on |
PERSONAL_CATALOG | your catalog of models and workflows |
DOWNLOAD_PROFILE, FORCE_VRAM_GB, RAM_PROFILE | to force choices different from the automatic ones |
SCRAPER_* | how many workflows, examples, and LoRAs the scraper searches for |
An environment variable with the same name overrides the .env value. When a new version of the script introduces new entries, it adds them to the end of the .env without touching yours.
Personal Catalog
To add your own models and workflows, copy catalogo.esempio.tsv as catalogo-personale.tsv and specify it in the .env with PERSONAL_CATALOG=catalogo-personale.tsv. Each line specifies where to fetch a file (Hugging Face, CivitAI, a direct URL), where to place it, which category it belongs to, and how much memory it requires; it can also create a link with another name, for workflows that look for a file with a different name. The format is explained at the top of the example file.
All commands
| Command | What it does |
|---|---|
./setup-comfyui.sh | calibration: prerequisites, hardware profile, build, and startup |
--models <categorie> | downloads models (video, image, audio, all); with --full also includes variants |
--civitai-scraper <categorie> | workflows, examples, and LoRAs from CivitAI |
--include-nsfw | disables the NSFW filter in --models and --civitai-scraper |
--dry-run | shows what would be downloaded, without downloading |
--download | repeats the last model selection and retrieves failed downloads |
--job | resumes an ongoing download or scraper |
--status | container status, hardware profile, space, and models |
--start, --stop, --restart, --logs, --shell | container management |
--update | updates ComfyUI and custom nodes and rebuilds the image |
--rebuild | rebuilds the image from scratch |
--clean-models | proposes deleting models that are too heavy for this hardware |
--clean-workflows, --clean-cache | empties the workflows folder or the Hugging Face cache |
--uninstall | removes container and image; data only if confirmed |
What calibration does, in detail
- Prerequisites: verify Docker, the NVIDIA driver, the NVIDIA Container Toolkit, and ensure Docker actually sees the GPU; install whatever is missing.
- Hardware profile: reads VRAM, card architecture (from compute capability), RAM, and processor, then chooses the memory profile, calculation precision (forced FP16 or native BF16/FP8), how to use SageAttention, RAM management between jobs, and the filter for models to download.
- Docker Image: CUDA 12.6 with cuDNN, PyTorch 2.10, ComfyUI, and over a hundred custom nodes (WanVideoWrapper, VideoHelperSuite, GGUF, KJNodes, Impact Pack, IPAdapter, ControlNet, MMAudio, LTX-Video, SeedVR2, Frame Interpolation, rgthree, Easy-Use, Crystools, ComfyUI-Manager…).
- Fixes: small adapters for functions that libraries have removed, extensions with broken imports disabled instead of blocking startup, and files that some extensions expect at startup copied to their correct locations.
- Startup: SageAttention compiled for your card, workflow checks (broken ones are discarded, Windows-style paths are corrected), recovery of generated image history after a restart, and model compatibility links.
- Verification: at the end of startup, the script checks how many extensions were loaded and lists those that failed. On the test machine: 122 out of 122.
FAQ
Can I use it on a remote PC? Yes: the script is run on the machine with the GPU and the interface can be opened from any browser on the network. ComfyUI does not have a login: if you want to access it from the Internet, place an authenticated proxy in front of it and set BIND_ADDR=127.0.0.1.
The container restarts on its own or stops halfway through a video. Check ./setup-comfyui.sh --logs. An exit code 137 means system memory is exhausted: with low RAM, set RAM_PROFILE=lowram in the .env. A cudaErrorLaunchFailure error (exit 139) halfway through generation, typical of MultiGPU/DisTorch2 nodes on 12 GB cards, can be avoided with SAFE_CUDA_MODE=1: it works, but makes everything about ten times slower, which is why it is disabled by default.
A downloaded workflow says that some models or nodes are missing. For models, check logs/workflow-analysis.txt after the scraper, or try --models <categoria> --full. For nodes, ComfyUI-Manager (in the interface menu) installs the missing ones.
How much space is actually needed? The Docker image takes up about 50 GB (during the first build, about 100 GB are required; at the end, the script offers to clear the build cache). Models depend on what you choose: from 6 GB for audio only to about 120 GB for all base sets. --status tells you how much you are using.
Can I keep the models on another disk or use the ones I already have? Yes: MODELS_DIR in the .env can point to any folder, including an existing library. Existing files are recognized and will not be re-downloaded.
License and acknowledgments
The script is distributed under the MIT license. Use it, modify it, share it.
It would not exist without ComfyUI, the authors of the custom nodes it installs, and those who publish free models and workflows on Hugging Face and CivitAI: the credit for the images and videos belongs to them; the script simply coordinates them with your graphics card. ComfyUI and the mentioned model names belong to their respective owners; this is an independent project.
If it saved you a few weeks of trial and error, you can support the project.
What do you think?
Selected comments
A selection of the comments we received, published with their authors' permission. The average counts every rating.



