Installing ComfyUI on Windows 11 Using Conda: Simple Setup

Every powerful AI tool requires a stable and well-configured environment to function effectively. Installing and managing dependencies can be daunting, especially when dealing with GPU optimizations or complex Python packages. That’s why using conda for environment management makes installing ComfyUI on Windows 11 straightforward and reliable.

In this article, we explore the benefits of using conda for ComfyUI installation and provide a step-by-step guide to set up a lightweight image generation model, enabling you to get started quickly and efficiently.

Pre-requirements

The following techniques and tools will be utilized in this article:

  • Operating System: Windows 11
  • Package Manager: Anaconda (for environment and dependency management)
  • Command Line Interface: Anaconda Prompt or Windows Command Shell
  • Git: For cloning the ComfyUI repository
  • Optional Hardware: Nvidia GPU with CUDA support for accelerated processing
  • Storage: Sufficient disk space for models and outputs (recommended at least 1TB)

Step 1: Install Anaconda

Download and install Anaconda for Windows 11. This platform helps manage Python versions and packages, allowing creation of fully isolated environments.

Step 2: Create and Activate the Virtual Environment

Open Anaconda Prompt and run:

> conda create -n comfyui python=3.10
> conda activate comfyui

This creates a fully isolated environment for ComfyUI. The environment includes its own separate Python interpreter and package installations, completely independent from the system Python or other conda environments. This isolation ensures that libraries and dependencies inside this environment do not interfere with or get affected by packages outside of it, allowing you to manage project-specific dependencies cleanly and avoid version conflicts.

Step 3: Clone the ComfyUI Repository

Navigate to the folder where you want to install ComfyUI and run:

> git clone https://github.com/comfyanonymous/ComfyUI
> cd ComfyUI

Step 4: Install Dependencies

Install required packages using pip in the activated environment:

> pip install -r requirements.txt

Optionally, install PyTorch with CUDA support via conda for GPU acceleration. In my case for an Nvidia RTX 2070 Super 8 GB GPU, I had to use the following pip command to ensure compatibility with CUDA 12.8:

> pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128

This command specifically installs PyTorch versions optimized for CUDA 12.8, ensuring proper GPU acceleration on your system with an RTX 2070 Super.

Step 5: Run ComfyUI

Start the interface by running:

> python main.py

Open the ComfyUI interface in your web browser http://127.0.0.1:8188.

Step 6: Create a Batch File to Launch ComfyUI Automatically

To simplify launching your environment and opening the ComfyUI interface, you can create a batch file:

  1. Open Notepad and paste the following:
@echo off
REM Initialize conda (adjust the path if needed)
call "%USERPROFILE%\anaconda3\Scripts\activate.bat" comfyui

REM Start ComfyUI
python main.py

REM Wait a few seconds for the server to start
timeout /t 3

REM Open the ComfyUI web interface in your browser
start http://127.0.0.1:8188
  1. Save this file as start_comfyui.bat inside your ComfyUI folder.
  2. Double-click to launch:
    This will activate the conda environment, start the ComfyUI server, and open the web interface in your default browser.

Troubleshooting Tip

If you encounter installation errors, make sure to check your GPU drivers and CUDA version. Consult ComfyUI documentation and PyTorch’s Get Started guide for compatibility instructions.

Advantages of Using Conda

  • Complete Environment Isolation: Each environment includes its own Python interpreter and packages.
  • Simplified Dependency Management: Handles binary dependencies like CUDA and compilers.
  • GPU Support: Easy installation of GPU-accelerated libraries.
  • Cross-Platform Consistency: Works the same across Windows, macOS, and Linux.
  • Multiple Environment Management: Run multiple isolated projects without conflict.