Install SageAttention in Windows ComfyUI
When a Windows ComfyUI workflow truly requires SageAttention, confirm the GPU, Python, PyTorch CUDA build, Triton version, install source, verification path, and rollback steps.
Use this guide only when the workflow really requires SageAttention and you already confirmed that switching the workflow to sdpa, comfy, torch, or auto is not enough.
If you only see this during startup:
Warning: Could not load sageattention: No module named 'sageattention'but ComfyUI and the workflow still generate images or video, do not install from this page yet. Start with the triage page:
ComfyUI ModuleNotFoundError: No module named 'sageattention' Fix
Know the risk before installing
SageAttention is not a base ComfyUI dependency. It is an optional attention acceleration backend.
On Windows, a failed install can turn a simple No module named warning into Triton, compiler, CUDA, or DLL errors. Save the current environment first and change one component at a time.
The correct order
Do not start by adding:
--use-sage-attentionThe safer order is:
- Check whether the GPU is suitable for the current Triton/SageAttention path.
- Find the exact Python used by ComfyUI.
- Save current package versions.
- Confirm PyTorch and
torch.version.cuda. - Install a
triton-windowsversion that matches PyTorch. - Verify
import triton. - Choose a trusted SageAttention install source.
- Verify SageAttention import and a minimal CUDA kernel call.
- Enable SageAttention in ComfyUI only after verification.
Step 1: check the GPU first
Run:
nvidia-smiFind the GPU model.
Current Windows Triton/SageAttention guidance roughly breaks down like this:
| GPU | Practical guidance |
|---|---|
| RTX 50 series Blackwell | Requires newer PyTorch, Triton, and CUDA builds. Avoid old tutorials. |
| RTX 40 series Ada | Usually a good target for the current Triton Windows path. |
| RTX 30 series Ampere | Usually usable, but some FP8 paths have extra limits. |
| RTX 20 / GTX 16 series Turing | Newer Triton support may be reduced; compatibility is more complex. |
| GTX 10 series Pascal or older | Do not chase SageAttention first. Use SDPA/Comfy. |
The current SageAttention project baseline also includes Python 3.9+, PyTorch 2.3+, Triton 3.0+, and CUDA requirements that vary by GPU architecture.
Unsupported SageAttention does not mean ComfyUI is unusable
If the GPU is not a good SageAttention target, that only means you should avoid this optional backend. Most workflows can still run with sdpa, comfy, or torch.
Step 2: confirm the exact Python
The most common Windows failure is installing into system Python while ComfyUI uses a different interpreter.
Windows ComfyUI Portable
Open PowerShell in ComfyUI_windows_portable:
.\python_embeded\python.exe -s -c "import sys; print(sys.executable)"
.\python_embeded\python.exe -s --versionAll later commands should continue to use:
.\python_embeded\python.exe -s -m pipDo not use bare pip or bare python.
Manual install or venv
Activate the venv that starts ComfyUI:
python -c "import sys; print(sys.executable)"
python --versionConfirm that it is not system Python, Conda, or Windows Store Python.
Step 3: save the current environment
Windows Portable
.\python_embeded\python.exe -s -m pip freeze > sageattention-before.txt
.\python_embeded\python.exe -s -m pip show torch
.\python_embeded\python.exe -s -m pip show triton
.\python_embeded\python.exe -s -m pip show triton-windows
.\python_embeded\python.exe -s -m pip show sageattentionManual venv
python -m pip freeze > sageattention-before.txt
python -m pip show torch
python -m pip show triton
python -m pip show triton-windows
python -m pip show sageattentionWARNING: Package(s) not found is not automatically an error. It may simply mean the package is not installed yet.
Keep sageattention-before.txt for rollback.
Step 4: confirm PyTorch and CUDA
Windows Portable
.\python_embeded\python.exe -s -c "import torch; print('Torch:', torch.__version__); print('Torch CUDA:', torch.version.cuda); print('CUDA available:', torch.cuda.is_available()); print('GPU:', torch.cuda.get_device_name(0) if torch.cuda.is_available() else 'None')"Manual venv
python -c "import torch; print('Torch:', torch.__version__); print('Torch CUDA:', torch.version.cuda); print('CUDA available:', torch.cuda.is_available()); print('GPU:', torch.cuda.get_device_name(0) if torch.cuda.is_available() else 'None')"If this prints:
CUDA available: Falsestop. Fix PyTorch/CUDA first. SageAttention cannot solve a broken CUDA PyTorch runtime.
Use torch.version.cuda for compatibility
The CUDA Version at the top of nvidia-smi is the maximum CUDA level supported by the driver. It is not the CUDA build used by the current PyTorch package.
When choosing compatible packages, use torch.version.cuda and the full torch.__version__.
Step 5: install the matching Triton Windows package
Do not blindly run:
pip install -U triton-windowsThe newest Triton build may not match your PyTorch minor version.
Use the current triton-windows documentation as the source of truth. The main pattern is:
| PyTorch minor version | Triton minor version |
|---|---|
| PyTorch 2.4 / 2.5 | Triton 3.1 |
| PyTorch 2.6 | Triton 3.2 |
| PyTorch 2.7 | Triton 3.3 |
| PyTorch 2.8 | Triton 3.4 |
| PyTorch 2.9 | Triton 3.5 |
| PyTorch 2.10 / 2.11 | Triton 3.6 |
| PyTorch 2.12 / 2.13 | Triton 3.7 |
Examples:
PyTorch 2.7
.\python_embeded\python.exe -s -m pip install -U "triton-windows>=3.3,<3.4"or in a venv:
python -m pip install -U "triton-windows>=3.3,<3.4"PyTorch 2.8
.\python_embeded\python.exe -s -m pip install -U "triton-windows>=3.4,<3.5"or:
python -m pip install -U "triton-windows>=3.4,<3.5"PyTorch 2.9
.\python_embeded\python.exe -s -m pip install -U "triton-windows>=3.5,<3.6"or:
python -m pip install -U "triton-windows>=3.5,<3.6"Do not mix the wrong triton packages
On Windows, the distribution package is usually triton-windows, but Python still imports triton.
If python -m pip show triton shows a separate package you previously installed, record its version first and follow the official Triton Windows guidance before uninstalling or mixing packages.
Step 6: for ComfyUI Portable, check include and libs
Some Triton/SageAttention build paths need Python development files:
include
libsThe folder is libs, not Python's normal Lib folder.
Windows Portable
.\python_embeded\python.exe -s -c "import os, sysconfig; p=sysconfig.get_paths().get('include'); print('Include:', p); print('Exists:', os.path.exists(p)); print('Python.h:', os.path.exists(os.path.join(p, 'Python.h')) if p else False)"If Python.h is missing, do not copy files from a random Python version. Follow the current Triton Windows docs for your exact Python minor version:
Python 3.11, 3.12, and 3.13 development files are not interchangeable.
Step 7: verify Triton
Windows Portable
.\python_embeded\python.exe -s -m pip show triton-windows
.\python_embeded\python.exe -s -c "import triton; print('Triton:', triton.__version__)"Manual venv
python -m pip show triton-windows
python -c "import triton; print('Triton:', triton.__version__)"Both commands must pass before you continue.
Step 8: choose the SageAttention source
Do not reduce this step to:
pip install sageattentionAs of July 18, 2026:
- the public PyPI
sageattentionpage shows1.0.6; - the official SageAttention GitHub documentation includes a SageAttention 2.2.0 install command;
- Windows users may also find third-party prebuilt wheels.
Check what your current package index can see:
python -m pip index versions sageattentionUse the Portable interpreter if you are using ComfyUI Portable:
.\python_embeded\python.exe -s -m pip index versions sageattentionRoute A: PyPI SageAttention V1
Use this only when your workflow explicitly supports SageAttention V1:
.\python_embeded\python.exe -s -m pip install "sageattention==1.0.6"or:
python -m pip install "sageattention==1.0.6"Route B: official SageAttention 2.2.0 command
The official repository currently shows this install form:
python -m pip install "sageattention==2.2.0" --no-build-isolationFor Portable:
.\python_embeded\python.exe -s -m pip install "sageattention==2.2.0" --no-build-isolationOnly use this if your package index actually exposes that version. If pip says no matching distribution was found, do not remove the version pin and blindly install whatever is available.
Route C: prebuilt Windows wheel
A wheel name such as:
sageattention-2.2.0+cu128torch2.7.1-cp312-cp312-win_amd64.whlusually encodes:
| Wheel tag | Meaning |
|---|---|
2.2.0 | SageAttention version |
cu128 | CUDA 12.8 build |
torch2.7.1 | PyTorch 2.7.1 |
cp312 | CPython 3.12 |
win_amd64 | 64-bit Windows |
Install only if the tags match your actual runtime:
.\python_embeded\python.exe -s -m pip install "C:\full\path\sageattention-file.whl"or:
python -m pip install "C:\full\path\sageattention-file.whl"Do not rename a wheel to bypass platform checks.
Route D: source build
Source builds are for users who can handle Visual Studio Build Tools, CUDA tooling, NVCC, Python development files, PyTorch C++/CUDA extensions, caches, and GPU architecture flags.
For normal troubleshooting, prefer SDPA/Comfy or a matching trusted wheel. If you must build from source, follow the current official repository only:
Step 9: verify SageAttention
Windows Portable
.\python_embeded\python.exe -s -m pip show sageattention
.\python_embeded\python.exe -s -c "import sageattention; print('Package:', sageattention.__file__); from sageattention import sageattn; print('SageAttention import OK')"Manual venv
python -m pip show sageattention
python -c "import sageattention; print('Package:', sageattention.__file__); from sageattention import sageattn; print('SageAttention import OK')"The package location and sageattention.__file__ should both belong to the ComfyUI runtime.
Step 10: run a minimal CUDA test
Create test_sageattention.py in the ComfyUI root:
import torch
from sageattention import sageattn
if not torch.cuda.is_available():
raise RuntimeError("PyTorch CUDA is not available")
q = torch.randn(
1,
2,
128,
64,
device="cuda",
dtype=torch.float16,
)
output = sageattn(
q,
q,
q,
tensor_layout="HND",
is_causal=False,
)
print("GPU:", torch.cuda.get_device_name(0))
print("Output shape:", tuple(output.shape))
print("Finite:", torch.isfinite(output).all().item())
print("SageAttention CUDA test OK")Run it:
.\python_embeded\python.exe -s .\test_sageattention.pyor:
python .\test_sageattention.pyExpected output includes:
Finite: True
SageAttention CUDA test OKDo not name the test file triton.py or torch.py
If the script is named triton.py, torch.py, or sageattention.py, Python may import your file instead of the real package.
Step 11: enable it in ComfyUI last
After import and CUDA verification, restart ComfyUI.
Prefer node-level backend selection first:
sdpa
comfy
torch
autoto:
sageattn
sageattention
SageAttentionOnly add the global launch flag when you explicitly want ComfyUI to use SageAttention globally:
--use-sage-attentionDo not combine multiple mutually exclusive attention backend flags.
Done means five checks passed
You are done only when:
- Triton imports in the exact Python used by ComfyUI.
- SageAttention is installed in that same Python.
from sageattention import sageattnworks.- The minimal CUDA test prints
Finite: True. - The original workflow starts sampling or continues without a fatal SageAttention traceback.
pip install alone is not the finish line.
Safe rollback
Disable SageAttention first:
--use-sage-attentionSwitch the workflow backend back to:
sdpa
comfy
torch
autoThen uninstall SageAttention:
.\python_embeded\python.exe -s -m pip uninstall sageattention -yor:
python -m pip uninstall sageattention -yDo not blindly uninstall triton-windows if it existed before this repair. Compare against sageattention-before.txt first.
Only clear caches such as .triton\cache or torchinductor_* after a toolchain change and only when stale cache errors continue.
Related guides
- No module named 'sageattention' triage
- Triton missing or unavailable in ComfyUI
- ComfyUI dependency conflicts
- ComfyUI plugin import failed
- GPU compatibility
Source references
Start free with Wonderful Launcher if this affects your real ComfyUI environment. It keeps launcher-native repair, task logs, and runtime checks in one place; credits are only for image generation and metered tools.
Download Wonderful LauncherSee credit packagesDid this fix your issue?
Your answer helps prioritize verified ComfyUI repairs.