Automated installation scripts for ComfyUI on Linux and Windows systems that handle everything from Python environment setup to custom node installation. These scripts provide a streamlined, dependency-conflict-free installation process with full control over package versions and installation steps.
- Automated Environment Setup: Installs pyenv, Python, and creates an isolated virtual environment
- Version Control: Pin specific versions of ComfyUI, PyTorch, NumPy, Transformers, and other critical packages
- GPU Acceleration: Supports CUDA 13.0, CUDA 12.8, CUDA 12.6, ROCm 7.1, and CPU-only installations
- Performance Optimization: Includes optional Nunchaku, Flash Attention, and Sage Attention
- Custom Node Collection: Automatically clones and configures 30+ popular custom nodes
- Selective Installation: Choose which components to install via interactive menu
- Smart Dependency Management: Prevents version conflicts by enforcing package versions
- Symlink Support: Centralize models and outputs across multiple installations
- Shell Integration: Adds convenient aliases (
comfyui,envact) to your shell - Multiple Shell Support: Auto-detects and configures bash, zsh, and fish shells
- Operating System: Linux (Ubuntu, Debian, Fedora, Arch, openSUSE, etc.)
- Permissions: Sudo access for installing system dependencies
- Disk Space: ~10-20GB for full installation (varies with custom nodes)
- GPU (optional): NVIDIA GPU with CUDA support for acceleration features
- Git: For cloning repositories
- Operating System: Windows 10 or Windows 11
- PowerShell: Version 5.1+ (included with Windows 10/11) or PowerShell 7+
- Disk Space: ~10-20GB for full installation
- GPU (optional): NVIDIA GPU with CUDA support for acceleration features
- Git: Git for Windows installed and in PATH (download)
- Visual Studio Build Tools (optional): Required only if building packages from source (e.g., flash-attn)
# Download the script
git clone https://github.com/yourusername/ComfyUI-Installation-Script-for-Linux.git
cd ComfyUI-Installation-Script-for-Linux
# Make executable
chmod +x install_comfy_env.sh
# Run the script
./install_comfy_env.sh# Download the script
git clone https://github.com/yourusername/ComfyUI-Installation-Script-for-Linux.git
cd ComfyUI-Installation-Script-for-Linux
# Allow script execution (if not already enabled)
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
# Run the script
.\install_comfy_env_win.ps1Note: The Windows script uses directory junctions (similar to symlinks) which work without Administrator privileges. If you need true symlinks, run PowerShell as Administrator.
The script will display your configuration and prompt you to select which installation steps to run.
Before running the script, you can customize these variables at the top of install_comfy_env.sh (Linux) or install_comfy_env_win.ps1 (Windows):
PYTHON_VERSION="3.12.10" # Python version (3.10.x, 3.11.x, 3.12.x, 3.13.x, 3.14.x recommended)
VENV_PATH="/mnt/daten/AI/comfy_env" # Virtual environment location
PYENV_ROOT="${PYENV_ROOT:-$HOME/.pyenv}" # pyenv installation directoryWindows equivalent:
$PYTHON_VERSION = "3.12.10"β venv path defaults to$BASE_PATH\comfy_env(e.g.D:\AI\comfy_env)
Recommended Python versions: 3.10.x, 3.11.x, 3.12.x, 3.13.x, 3.14.x have prebuilt wheels for PyTorch, Nunchaku, and Flash Attention. Other versions will require compilation from source.
PYTORCH_VERSION="2.9" # PyTorch major.minor for wheel URLs
PYTORCH_FULL_VERSION="2.9.1+cu128" # Full version string
PYTORCH_INDEX_URL="https://download.pytorch.org/whl/cu128" # Wheel repositoryAvailable options:
- CUDA 13.0:
cu130(latest) - CUDA 12.8:
cu128(default) - CUDA 12.6:
cu126 - ROCm 7.1:
rocm7.1(AMD GPUs) - CPU only:
cpu(no GPU)
Example CUDA 13.0 configuration:
PYTORCH_FULL_VERSION="2.9.1+cu130"
PYTORCH_INDEX_URL="https://download.pytorch.org/whl/cu130"Example ROCm 7.1 configuration (AMD GPUs):
PYTORCH_FULL_VERSION="2.9.1+rocm7.1"
PYTORCH_INDEX_URL="https://download.pytorch.org/whl/rocm7.1"Example CPU configuration:
PYTORCH_FULL_VERSION="2.9.1+cpu"
PYTORCH_INDEX_URL="https://download.pytorch.org/whl/cpu"NUMPY_VERSION="2.2.6" # NumPy version (2.2.x for PyTorch 2.9+)
TRANSFORMERS_VERSION="4.57.3" # Transformers (4.57+ for Qwen3-VL/Mistral3)
COMFYUI_FRONTEND_VERSION="1.39.11" # ComfyUI frontend (installed in venv's site-packages)These versions are enforced at the end of installation to override any conflicting dependencies from custom nodes.
COMFYUI_PARENT_DIR="/mnt/daten/AI" # Parent directory for ComfyUI
COMFYUI_DIR_NAME="ComfyUI" # Folder name
COMFYUI_VERSION="" # ComfyUI version (tag, branch, or commit SHA)Windows equivalent:
$BASE_PATH = "D:\AI"β ComfyUI clones toD:\AI\ComfyUI
ComfyUI will be cloned to: ${COMFYUI_PARENT_DIR}/${COMFYUI_DIR_NAME}
Version Selection:
- Leave
COMFYUI_VERSION=""(empty) to clone the latest version from the default branch - Set to a specific tag:
COMFYUI_VERSION="v0.2.0"(use tags from the ComfyUI releases) - Set to a branch name:
COMFYUI_VERSION="master"orCOMFYUI_VERSION="dev" - Set to a commit SHA:
COMFYUI_VERSION="abc123def456"
Examples:
COMFYUI_VERSION="" # Latest version (default)
COMFYUI_VERSION="v0.2.0" # Specific release tag
COMFYUI_VERSION="master" # Master branch
COMFYUI_VERSION="abc123" # Specific commitMultiple ComfyUI Installations:
To install multiple versions of ComfyUI side-by-side, simply change COMFYUI_DIR_NAME when running the script again:
# First installation
COMFYUI_DIR_NAME="ComfyUI" # Creates /mnt/daten/AI/ComfyUI
# Second installation (different version)
COMFYUI_DIR_NAME="ComfyUI_v0.2.0" # Creates /mnt/daten/AI/ComfyUI_v0.2.0
COMFYUI_VERSION="v0.2.0"When CREATE_SYMLINKS=true, all installations will share:
- Models (via
USER_MODELS_PATH) - Output (via
USER_OUTPUT_PATH) - Custom nodes (via
USER_CUSTOM_NODES_PATH)
This allows you to test different ComfyUI versions without duplicating your models and custom nodes.
CREATE_SYMLINKS=true # Enable/disable symlink creation
USER_MODELS_PATH="/mnt/daten/AI/models" # Centralized models directory
USER_OUTPUT_PATH="/mnt/daten/AI/output" # Centralized output directory
USER_CUSTOM_NODES_PATH="/mnt/daten/AI/custom_nodes" # Centralized custom_nodes directoryWindows equivalent:
$CREATE_SYMLINKS = $trueβ paths default toD:\AI\models,D:\AI\output,D:\AI\custom_nodes(uses directory junctions instead of symlinks)
Symlinks allow you to:
- Share models across multiple ComfyUI installations
- Share custom nodes across multiple ComfyUI installations (useful when testing different ComfyUI versions)
- Store models on a different drive/partition
- Keep outputs in a centralized location
Set CREATE_SYMLINKS=false to use default ComfyUI/models, ComfyUI/output, and ComfyUI/custom_nodes directories.
Tip β directories outside
BASE_PATH: By default,USER_MODELS_PATH,USER_OUTPUT_PATH, andUSER_CUSTOM_NODES_PATHare derived fromBASE_PATH. You can point any of them to a completely different location β for example a larger disk β by editing the "Derived Paths" section in the script:Linux:
USER_MODELS_PATH="/mnt/ssd2/models" # Models on a fast SSD USER_OUTPUT_PATH="/home/$USER/comfyui_output" # Output in home directoryWindows:
$USER_MODELS_PATH = "E:\models" # Models on drive E: $USER_OUTPUT_PATH = "C:\Users\$env:USERNAME\comfyui_out" # Output in user profileThe script creates the target directories automatically and symlinks/junctions them into the ComfyUI tree.
INSTALL_NUNCHAKU=true # Nunchaku acceleration (requires NVIDIA GPU)Set to false to skip Nunchaku installation if you don't have an NVIDIA GPU or don't need this optimization.
The script is divided into 11 steps that you can run selectively:
- Python Environment - pyenv, Python version, virtual environment
- PyTorch - PyTorch, torchvision, torchaudio with CUDA/CPU support
- Nunchaku - Acceleration library (optional, NVIDIA GPU only)
- Face Recognition - facexlib, insightface, onnxruntime-gpu, facenet_pytorch
- ComfyUI Core - ComfyUI base installation and requirements
- Custom Nodes - 30+ popular custom nodes (see list below)
- Custom Node Dependencies - Install requirements for all custom nodes
- Performance Libraries - llama-cpp-python, flash-attn, sageattention
- Upgrade/Pin Packages - Upgrade specific packages to latest compatible versions
- Enforce Versions - Force exact versions of PyTorch, NumPy, Transformers, ComfyUI Frontend
- Shell Aliases - Add
comfyuiandenvactaliases to shell config
- ComfyUI_SmartLML - Smart Language Model Loader
- ComfyUI_Eclipse - Extended toolkit
- ComfyUI-Manager - Node manager
- ComfyUI-Crystools-MonitorOnly - System monitoring
- ComfyUI-Custom-Scripts - UI enhancements
- rgthree-comfy - Workflow utilities
- ComfyUI-Easy-Use - Simplified nodes
- ComfyUI_essentials - Essential utilities
- ComfyUI_essentials_mb - Additional essentials
- ComfyUI-GGUF - GGUF model support
- ComfyUI-nunchaku - Nunchaku integration
- ComfyUI-TeaCache - Caching optimizations
- ComfyUI_Patches_ll - Performance patches
- ComfyUI-Advanced-ControlNet - Advanced ControlNet features
- comfyui_controlnet_aux - ControlNet preprocessors
- ComfyUI-Impact-Pack - Image enhancement suite
- ComfyUI_LayerStyle - Layer effects
- ComfyUI_LayerStyle_Advance - Advanced layer effects
- ComfyUI-Detail-Daemon - Detail enhancement
- ComfyUI-KJNodes - Various utilities
- Comfyui_TTP_Toolset - Additional tools
- ComfyUI-Raffle - Random generation
- sd-dynamic-thresholding - Dynamic thresholding
- was-node-suite-comfyui - WAS toolkit
- ComfyUI-Florence2 - Florence2 model support
- ComfyUI-SUPIR - Super resolution
- ComfyUI_BiRefNet_ll - Background removal
- ComfyUI_PuLID_Flux_ll - Face ID for Flux
- ComfyUI-ReActor - Face swapping
- ComfyUI-VideoHelperSuite - Video utilities
- ComfyUI-Frame-Interpolation - Video frame interpolation
- ComfyUI-GIMM-VFI - Video frame interpolation
- ComfyUI-WanVideoWrapper - Video processing
- RES4LYF - Resolution presets
- comfy_mtb - MTB's custom nodes
Run the script and select steps interactively:
./install_comfy_env.shYou'll see a menu:
Select installation steps (enter numbers separated by spaces, or 'a' for all):
1) Python environment (pyenv + venv)
2) PyTorch and base dependencies
...
a) All steps (default)
Your selection [a]:
Examples:
a- Install everything (default)1 2 5- Only setup Python, PyTorch, and ComfyUI core6 7- Only clone and setup custom nodes (if you already have ComfyUI)10- Only enforce package versions (useful after manual package changes)
After installation, you have several options:
Option 1: Launcher script (recommended)
/mnt/daten/AI/start_comfyui.shOption 2: Shell alias (if Step 11 was run)
comfyuiOption 3: Manual
source /mnt/daten/AI/comfy_env/bin/activate
cd /mnt/daten/AI/ComfyUI
python main.pyOption 1: Double-click launcher
D:\AI\start_comfyui.bat
Option 2: PowerShell launcher
D:\AI\start_comfyui.ps1Option 3: PowerShell alias (if Step 11 was run, after reloading profile)
comfyuiOption 4: Manual
& "D:\AI\comfy_env\Scripts\Activate.ps1"
cd "D:\AI\ComfyUI"
python main.py# If aliases are configured (Step 11)
envact
# Or manually
source /mnt/daten/AI/comfy_env/bin/activateTo add/remove custom nodes, edit the [6/10] Clone Custom Nodes section around line 550:
# Add your custom node:
clone_if_missing "https://github.com/yourusername/your-custom-node.git"
# Remove a node by commenting it out or deleting the line:
# clone_if_missing "https://github.com/some/node-you-dont-want.git"Then run:
./install_comfy_env.shAnd select steps 6 7 to update custom nodes and their dependencies.
If pyenv dependencies fail to install, you may need to manually install build dependencies for your distribution:
Ubuntu/Debian:
sudo apt-get update
sudo apt-get install build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev curl git \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-devFedora:
sudo dnf install make gcc patch zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel tk-devel libffi-devel xz-devel libuuid-devel gdbm-libs libnsl2These require:
- NVIDIA GPU
- CUDA 12.6+ or compatible version
- Prebuilt wheels for your Python version
If you don't have an NVIDIA GPU, set INSTALL_NUNCHAKU=false and skip step 3.
If a custom node installs incompatible package versions, run step 10 to enforce configured versions:
./install_comfy_env.sh # Select step 10 onlyAfter step 11, you need to reload your shell configuration:
# For bash
source ~/.bashrc
# For zsh
source ~/.zshrc
# For fish
source ~/.config/fish/config.fish
# Or just restart your terminalAfter step 11, reload your PowerShell profile:
. $PROFILE
# Or just restart PowerShellIf you get a script execution error:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUserClose and reopen PowerShell. If still not found, ensure these are in your PATH:
%USERPROFILE%\.pyenv\pyenv-win\bin%USERPROFILE%\.pyenv\pyenv-win\shims
Flash Attention rarely has prebuilt Windows wheels. You can either:
- Skip it (it's optional β ComfyUI works fine without it)
- Install Visual Studio Build Tools and compile from source
- Use Sage Attention as an alternative
The full installation requires 10-20GB. To reduce space:
- Skip custom nodes (don't run step 6-7)
- Remove unused custom nodes manually from
custom_nodes/directory - Use symlinks to store models on a different drive
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes:
- Add new custom nodes to the installation list
- Update package versions
- Add support for new Linux distributions
- Improve error handling
- Test your changes on a fresh system if possible
- Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
When reporting issues, please include:
- Your Linux distribution and version
- Python version being installed
- Full error output
- Which installation step failed
This script is provided as-is for the ComfyUI community. Feel free to modify and distribute.
- ComfyUI - The amazing stable diffusion GUI
- pyenv - Python version management (Linux)
- pyenv-win - Python version management (Windows)
- All the custom node developers for their incredible work
If you encounter issues:
- Check the Troubleshooting section
- Search existing Issues
- Open a new issue with detailed information
Happy ComfyUI-ing! π¨