For the installation of ComfyUI, it is mainly divided into several steps:

  1. Create a virtual environment(avoid polluting the system-level Python environment)
  2. Clone the ComfyUI code repository
  3. Install dependencies
  4. Start ComfyUI

You can also refer to ComfyUI CLI to install ComfyUI, it is a command line tool that can easily install ComfyUI and manage its dependencies.

Create a virtual environment

Independent virtual environments are necessary because ComfyUI’s dependencies may conflict with other dependencies on the system, and it can also avoid polluting the system-level Python environment.

Install Miniconda. This will help you install the correct versions of Python and other libraries needed by ComfyUI.

Create an environment with Conda.

conda create -n comfyenv
conda activate comfyenv

Clone the ComfyUI code repository

You need to ensure that you have installed Git on your system. First, you need to open the terminal (command line), then clone the code repository.

If you have not installed Microsoft Visual C++ Redistributable, please install it here.
git clone git@github.com:comfyanonymous/ComfyUI.git

Install GPU and ComfyUI dependencies

1

Install GPU dependencies

Install GPU Dependencies

2

Install ComfyUI dependencies

cd ComfyUI
pip install -r requirements.txt
3

Start ComfyUI

Start the application

cd ComfyUI
python main.py

How to update ComfyUI

1

pull the latest code

Use the command line to enter the installation path of ComfyUI, then pull the latest code.

cd <installation path>/ComfyUI
git pull
2

install the dependencies

Use the command line to enter the installation path of ComfyUI, then install the dependencies.

You need to ensure that the current Python environment is the ComfyUI virtual environment, otherwise the dependencies will be installed to the system-level Python environment, polluting the system-level Python environment.

    pip install -r requirements.txt

Adding Extra Model Paths

If you want to manage your model files outside of ComfyUI/models, you may have the following reasons:

  • You have multiple ComfyUI instances and want them to share model files to save disk space
  • You have different types of GUI programs (such as WebUI) and want them to use the same model files
  • Model files cannot be recognized or found

We provide a way to add extra model search paths via the extra_model_paths.yaml configuration file

Open Config File

For the ComfyUI version such as portable and manual, you can find an example file named extra_model_paths.yaml.example in the root directory of ComfyUI:

ComfyUI/extra_model_paths.yaml.example

Copy and rename it to extra_model_paths.yaml for use. Keep it in ComfyUI’s root directory at ComfyUI/extra_model_paths.yaml. You can also find the config example file here

If the file does not exist, you can create it yourself with any text editor.

Example Structure

Suppose you want to add the following model paths to ComfyUI:

📁 YOUR_PATH/
  ├── 📁models/
  |   ├── 📁 lora/
  |   │   └── xxxxx.safetensors
  |   ├── 📁 checkpoints/
  |   │   └── xxxxx.safetensors
  |   ├── 📁 vae/
  |   │   └── xxxxx.safetensors
  |   └── 📁 controlnet/
  |       └── xxxxx.safetensors

Then you can configure the extra_model_paths.yaml file like below to let ComfyUI recognize the model paths on your device:

my_custom_config:
    base_path: YOUR_PATH
    loras: models/loras/
    checkpoints: models/checkpoints/
    vae: models/vae/
    controlnet: models/controlnet/

or

my_custom_config:
    base_path: YOUR_PATH/models/
    loras: loras
    checkpoints: checkpoints
    vae: vae
    controlnet: controlnet

Or you can refer to the default extra_model_paths.yaml.example for more configuration options. After saving, you need to restart ComfyUI for the changes to take effect.

Below is the original config example:

#Rename this to extra_model_paths.yaml and ComfyUI will load it


#config for a1111 ui
#all you have to do is change the base_path to where yours is installed
a111:
    base_path: path/to/stable-diffusion-webui/

    checkpoints: models/Stable-diffusion
    configs: models/Stable-diffusion
    vae: models/VAE
    loras: |
         models/Lora
         models/LyCORIS
    upscale_models: |
                  models/ESRGAN
                  models/RealESRGAN
                  models/SwinIR
    embeddings: embeddings
    hypernetworks: models/hypernetworks
    controlnet: models/ControlNet

#config for comfyui
#your base path should be either an existing comfy install or a central folder where you store all of your models, loras, etc.

#comfyui:
#     base_path: path/to/comfyui/
#     # You can use is_default to mark that these folders should be listed first, and used as the default dirs for eg downloads
#     #is_default: true
#     checkpoints: models/checkpoints/
#     clip: models/clip/
#     clip_vision: models/clip_vision/
#     configs: models/configs/
#     controlnet: models/controlnet/
#     diffusion_models: |
#                  models/diffusion_models
#                  models/unet
#     embeddings: models/embeddings/
#     loras: models/loras/
#     upscale_models: models/upscale_models/
#     vae: models/vae/

#other_ui:
#    base_path: path/to/ui
#    checkpoints: models/checkpoints
#    gligen: models/gligen
#    custom_nodes: path/custom_nodes

For example, if your WebUI is located at D:\stable-diffusion-webui\, you can modify the corresponding configuration to

a111:
    base_path: D:\stable-diffusion-webui\
    checkpoints: models/Stable-diffusion
    configs: models/Stable-diffusion
    vae: models/VAE
    loras: |
         models/Lora
         models/LyCORIS
    upscale_models: |
                  models/ESRGAN
                  models/RealESRGAN
                  models/SwinIR
    embeddings: embeddings
    hypernetworks: models/hypernetworks
    controlnet: models/ControlNet