ComfyUI --use-sage-attention: No module named 'triton' (fix)

With --use-sage-attention, ComfyUI crashes at startup with ModuleNotFoundError: No module named 'triton' when the sageattention package is installed but Triton is not. We reproduced it on v0.37.0 and fixed it.

1. The error

ComfyUI v0.37.0 (CPython 3.11, torch 2.9.0) started with --use-sage-attention, with the PyPI sageattention 1.0.6 package installed but no triton. ComfyUI exits (code 1) before the server starts (traceback shortened):

Traceback (most recent call last):
  ...
  File "ComfyUI/comfy/ldm/hunyuan3dv2_1/hunyuandit.py", line 5, in <module>
    from comfy.ldm.modules.attention import optimized_attention
  File "ComfyUI/comfy/ldm/modules/attention.py", line 35, in <module>
    raise e
  File "ComfyUI/comfy/ldm/modules/attention.py", line 27, in <module>
    from sageattention import sageattn
  File "venv/lib/python3.11/site-packages/sageattention/__init__.py", line 1, in <module>
    from .core import sageattn, sageattn_varlen
  File "venv/lib/python3.11/site-packages/sageattention/core.py", line 2, in <module>
    import triton
ModuleNotFoundError: No module named 'triton'

sageattention 1.0.6 is pure Python with Triton kernels, and its core.py imports triton on line 2. ComfyUI's comfy/ldm/modules/attention.py catches the ImportError, but only prints its friendly hint when the missing module is sageattention itself; for any other missing module (here triton) it re-raises. Without sageattention at all, the same flag gives the hint and exit code 255 instead:

[ERROR] 

To use the `--use-sage-attention` feature, the `sageattention` package must be installed first.
command:
	venv/bin/python -m pip install sageattention

2. Fix: install Triton into ComfyUI's Python

Linux (x86_64 or aarch64):

python -m pip install triton

Here that installed triton 3.8.0 and the next start logged:

[INFO] Using sage attention

(exit code 0). On Linux x86_64, torch's CUDA wheels from PyPI already depend on a pinned Triton (torch 2.9.0 declares triton==3.5.0), so a missing triton usually means a CPU-only or custom-index torch; installing the version your torch pins is the safest choice. Run python -m pip show torch to check.

Windows: the official triton project publishes Linux wheels only, so pip install triton finds nothing. The Windows port is the separate triton-windows package (python -m pip install triton-windows; on the portable build use python_embeded\python.exe -m pip install triton-windows); follow its README to pick the release that matches your torch version. Or drop --use-sage-attention from your launch command (for example run_nvidia_gpu.bat) to start with the default attention.

Sage attention also needs a supported NVIDIA GPU at run time; our test used --cpu --quick-test-for-ci, which only checks that startup and imports succeed.

Related: ComfyUI: No module named 'yaml' (wrong Python) · ComfyUI: No module named 'soundfile' · ComfyUI: No module named 'torchaudio' · pip install flash-attn: No module named 'torch'

Frequently asked questions

Why does ComfyUI say sageattention must be installed when it is installed?

It does not: that hint only appears when sageattention itself is missing. If sageattention is installed but triton is not, ComfyUI re-raises the triton ImportError and exits.

How do I install triton on Windows for ComfyUI?

The official triton package has no Windows wheels; install the separate triton-windows package matching your torch version, or remove --use-sage-attention.

Written with AI assistance. Measured on 2026-10-24 on Linux, CPython 3.11.17: ComfyUI v0.37.0, torch 2.9.0+cpu, sageattention 1.0.6, without and with triton 3.8.0, using main.py --cpu --quick-test-for-ci --use-sage-attention. Output pasted unedited except shortened paths and a trimmed traceback. PlainTables is our extension; ComfyUI, SageAttention and Triton are free.