Setting Up ComfyUI with GPU Support on Windows 10
Installing Python 3.10.11
Download the official Python 3.10.11 installer for Windows (64-bit) named something like python-3.10.11-amd64.exe. Run the installer using custom installation options and set your desired installation path.
Add both the main Python directory and the Scripts subfolder to the system PATH environment variable. Confirm the installation by running the following in CMD:
python --version
Installing CUDA 12.1
Updating GPU Drivers
Ensure your NVIDIA drivers are updated to at least version 12.1. Check your current driver vertion via the NVIDIA Control Panel and update if necessary using the official NVIDIA driver download page.
Installing CUDA Toolkit
Download CUDA 12.1 from the official CUDA Toolkit page, ensuring compatibility with your system. Install using either default or custom settings — the installer will handle environment variables automatically.
Verify the installation by running:
nvcc --version
Installing PyTorch with CUDA Support
Download the following packages from the official PyTorch website:
- torch
- torchaudio
- torchvision
Look for versions labeled cu121-cp310 compatible with CUDA 12.1 and Python 3.10. Install them in this order using pip:
pip install torch_package_name.whl
pip install torchaudio_package_name.whl
pip install torchvision_package_name.whl
Verify the correct installation using:
pip list | findstr torch
Confirm installation in Python:
python
>>> import torch
>>> torch.__version__
Installing xFormers
Install the compatible version of xFormers using:
pip install xformers==0.0.23
Ensure the version is compatible with your current setup. If PyTorch reverts to a CPU-only version, reinstall the correct CUDA-compatible version from the earlier step.
Running the ComfyUI Project
Clone the ComfyUI repository from GitHub or download the ZIP archive. Modify the requirements.txt file by commenting out any lines that may overwrite your installed versions of PyTorch or torchvision.
Install the remaining dependencies using:
pip install -r requirements.txt
If torch packages are downgraded, reinstall the correct versions manually.
Launch the application using GPU acceleration with:
python main.py --use-split-cross-attention --windows-standalone-build
To run on CPU instead, append --cpu to the command.