comfyui Windows Installation with Conda and venv Tutorial
In the previous chapter, we introduced the native installation of ComfyUI directly on a Windows system. While this method is simple and direct, installing ComfyUI and its dependencies in an isolated Python environment is generally the recommended practice. Using environment isolation tools like Conda or venv can effectively manage project dependencies, avoid library version conflicts between different projects, and keep the system environment clean. This chapter will guide you on how to use Conda or venv to create isolated Python environments and install ComfyUI within them.

Why Use Conda or venv?
Environment Isolation: Conda and venv allow you to create an independent Python environment for ComfyUI. This means that ComfyUI and its dependencies will be installed in this isolated environment, without conflicting with existing Python packages or dependencies of other projects on your system.
Dependency Management: With environment management tools, you can easily track and manage the dependencies of the ComfyUI project. This makes project migration, reproduction, and collaboration more convenient.
System Cleanliness: Isolating project dependencies in independent environments keeps your system Python environment clean and avoids potential issues caused by installing too many project dependencies.
Conda and venv are both popular Python environment management tools. Conda is more powerful and can manage various packages including Python versions, while venv is a lightweight virtual environment tool that comes with Python and focuses more on Python package isolation. You can choose either one based on your needs.
I. Preparation
(1) Hardware and Software Requirements
Same as the native installation tutorial, please refer to the I. Preparation section in the previous chapter to ensure your hardware and software meet the basic requirements of ComfyUI. Pay special attention to:
Python Version: Python 3.10 is still required. However, if you choose to use Conda, you do not need to pre-install system Python. Conda can install a specified version of Python for you.
Git Tool: Git tool is still required to clone the ComfyUI project.
(2) Install Conda (If you haven't already)
If you choose to use Conda and haven't installed it yet, please install Miniconda or Anaconda first. Miniconda is a lightweight version of Conda that only includes Conda, Python, and essential packages. It is smaller and Miniconda is recommended.
Miniconda Download: Visit the Miniconda official website and download the Miniconda installer according to your Windows system version (32-bit or 64-bit).
Anaconda Download: If you need a more comprehensive Python environment and pre-installed scientific computing packages, you can choose to install Anaconda. Visit the Anaconda official website to download the installer.
After downloading, run the installer and follow the prompts for installation. During the installation process, it is recommended to check "Add Anaconda3 to my PATH environment variable" or "Register Anaconda3 as my default Python 3.x" option to conveniently use conda commands in the command line. (Note: In some cases, automatically adding to PATH may cause conflicts. If you encounter problems, you can manually configure the PATH environment variable later.)
II. Create Conda Environment (If you choose Conda)
Open Anaconda Prompt or PowerShell: After installing Conda, find "Anaconda Prompt" or "PowerShell (Anaconda3)" in the Windows Start Menu and open it. This will open a command-line terminal that is pre-configured with the Conda environment.
Create Conda Environment: In the command line, enter the following command to create a Conda environment named comfyui_env and specify Python version 3.10:
conda create -n comfyui_env python=3.10
content_copydownload
Use code with caution.Bash
Press Enter to execute the command. Conda will download and install Python 3.10 and some essential packages into the new environment. During the installation process, if prompted to proceed (Proceed [y/n]?), enter y and press Enter.
Activate Conda Environment: After the environment is created, use the following command to activate the comfyui_env environment:
conda activate comfyui_env
After successful activation, you will see the environment name (comfyui_env) before the command line prompt, indicating that you are now in the Conda environment.
III. Create venv Environment (If you choose venv)
If you choose to use venv, you need to ensure that Python 3.10 is already installed on your system (as described in the previous chapter).
Open Command Prompt or PowerShell: Open Windows "Command Prompt" or "PowerShell".
Create venv Environment: Navigate to the directory where you want to store the ComfyUI project (e.g., C:\). Then enter the following command to create a venv environment named comfyui_env. This will create a folder named comfyui_env in the current directory and create the files needed for the virtual environment inside it:
python -m venv comfyui_env
Activate venv Environment:
Depending on your command-line tool, use the following command to activate the comfyui_env environment:
Command Prompt (cmd.exe):
comfyui_env\Scripts\activate.bat
PowerShell:
comfyui_env\Scripts\Activate.ps1
After successful activation, you will see the environment name (comfyui_env) before the command line prompt, indicating that you are now in the venv environment.
IV. Download ComfyUI (Within the Environment)
Important: Make sure you have activated the Conda environment (comfyui_env) or venv environment (comfyui_env) before proceeding with the following steps. You should see (comfyui_env) before your command prompt.
Clone ComfyUI Project: In the activated environment, use the git clone command to download the ComfyUI project. For example, to clone ComfyUI to the C:\ComfyUI directory:
git clone https://github.com/comfyanonymous/ComfyUI.git C:\ComfyUI
As with native installation, the cloning time depends on your network speed, please be patient.
V. Install Dependencies (Within the Environment)
Enter ComfyUI Project Directory: In the activated environment, use the cd command to enter the ComfyUI project directory:
cd C:\ComfyUI
Install Python Dependency Packages: Run the pip command to install the Python dependency packages required by ComfyUI. Make sure to run this command in the activated environment.
pip install -r requirements.txt
pip will download and install the dependency packages into your currently activated Conda or venv environment without affecting system-wide or other environment Python packages. The installation process may take some time, please ensure a stable network connection.
VI. Launch ComfyUI (Within the Environment)
Launch ComfyUI: In the activated environment and ComfyUI project directory, find the launch_windows.bat file and double-click to run it. The system will automatically launch ComfyUI and open the ComfyUI user interface in your browser.
Access ComfyUI Interface: If the browser does not open automatically, manually enter http://127.0.0.1:8188 in your browser address bar to access the ComfyUI interface.
At this point, you have successfully completed the ComfyUI installation on your Windows system using Conda or venv. You can now run ComfyUI in an isolated environment and start creating AI-generated images. If you encounter any problems during use, you can refer to the ComfyUI official documentation, community forums, or seek help from experienced users.
Conclusion
Installing ComfyUI using Conda or venv, although slightly more steps are involved, offers significant benefits: environment isolation, clearer dependency management, and a cleaner system environment. This is a highly recommended installation method for long-term ComfyUI use, especially for developers who need to install multiple Python projects. Choosing Conda or venv depends on your personal preferences and needs. Conda is more feature-rich, while venv is more lightweight. Regardless of your choice, using environment isolation tools will provide better security for your ComfyUI experience.