How to run ComfyUI on an NVIDIA 5090 GPU

These are my short notes on how to run ComfyUI on an NVIDIA 5090 GPU. The Blackwell architecture has been released Q4 2024, and is supported by nightly >= 12.8 pytorch builds.

If you get “CUDA error: no kernel image is available for execution on the device” or “NVIDIA GeForce RTX 5090 with CUDA capability sm_120 is not compatible with the current PyTorch installation. The current PyTorch install supports CUDA capabilities sm_50 sm_60 sm_70 sm_75 sm_80 sm_86 sm_90.” errors on a 5090 GPU, and you ruled out an nvidia driver version mismatch between the nvidia-smi reported CUDA version and your installed pytorch version, then the solution is to use a nightly pytorch build that supports CUDA capability sm_120.

Below are steps to install ComfyUI with the correct pytorch version. A Docker container link is available at the bottom of this page:

  1. Clone the ComfyUI repository: git clone https://github.com/comfyanonymous/ComfyUI.git .
  2. Install pytorch and related packages: . venv/bin/activate && pip install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cu129 onnxruntime-gpu numba diffusers
  3. Install ComfyUI dependencies: . venv/bin/activate && pip install -r requirements.txt
  4. Run ComfyUI: . venv/bin/activate && python main.py --listen 0.0.0.0

Here is a Makefile with all of the above:

all:
        python3.10 -m venv venv
        . venv/bin/activate && pip install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cu129 onnxruntime-gpu numba diffusers
        . venv/bin/activate && pip install  opencv-contrib-python==4.8.1.78 opencv-python==4.8.1.78 opencv-python-headless==4.7.0.72
        . venv/bin/activate && pip install -r requirements.txt
run:
        . venv/bin/activate && python main.py --listen 0.0.0.0

Run make all to install dependencies, and make run to start the webui.

Here is the link to my ComfyUI docker container: https://github.com/fgheorghe/comfyui