LogoWonderful Launcher
  • Home
  • Pricing
  • Docs
  • Download

Install SageAttention in Windows ComfyUI

Partially verifiedHigh riskTested on Windows 10, Windows 11 | portable | Python verify the actual ComfyUI runtime | CUDA verify torch.version.cuda | Torch match the installed PyTorch minor versionEstimated time 20-60 minutes

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-attention

The safer order is:

  1. Check whether the GPU is suitable for the current Triton/SageAttention path.
  2. Find the exact Python used by ComfyUI.
  3. Save current package versions.
  4. Confirm PyTorch and torch.version.cuda.
  5. Install a triton-windows version that matches PyTorch.
  6. Verify import triton.
  7. Choose a trusted SageAttention install source.
  8. Verify SageAttention import and a minimal CUDA kernel call.
  9. Enable SageAttention in ComfyUI only after verification.

Step 1: check the GPU first

Run:

nvidia-smi

Find the GPU model.

Current Windows Triton/SageAttention guidance roughly breaks down like this:

GPUPractical guidance
RTX 50 series BlackwellRequires newer PyTorch, Triton, and CUDA builds. Avoid old tutorials.
RTX 40 series AdaUsually a good target for the current Triton Windows path.
RTX 30 series AmpereUsually usable, but some FP8 paths have extra limits.
RTX 20 / GTX 16 series TuringNewer Triton support may be reduced; compatibility is more complex.
GTX 10 series Pascal or olderDo 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 --version

All later commands should continue to use:

.\python_embeded\python.exe -s -m pip

Do 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 --version

Confirm 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 sageattention

Manual 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 sageattention

WARNING: 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: False

stop. 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-windows

The 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 versionTriton minor version
PyTorch 2.4 / 2.5Triton 3.1
PyTorch 2.6Triton 3.2
PyTorch 2.7Triton 3.3
PyTorch 2.8Triton 3.4
PyTorch 2.9Triton 3.5
PyTorch 2.10 / 2.11Triton 3.6
PyTorch 2.12 / 2.13Triton 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
libs

The 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:

  • triton-lang/triton-windows

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 sageattention

As of July 18, 2026:

  • the public PyPI sageattention page shows 1.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 sageattention

Use the Portable interpreter if you are using ComfyUI Portable:

.\python_embeded\python.exe -s -m pip index versions sageattention

Route 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-isolation

For Portable:

.\python_embeded\python.exe -s -m pip install "sageattention==2.2.0" --no-build-isolation

Only 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.whl

usually encodes:

Wheel tagMeaning
2.2.0SageAttention version
cu128CUDA 12.8 build
torch2.7.1PyTorch 2.7.1
cp312CPython 3.12
win_amd6464-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:

  • SageAttention official GitHub repository

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.py

or:

python .\test_sageattention.py

Expected output includes:

Finite: True
SageAttention CUDA test OK

Do 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
auto

to:

sageattn
sageattention
SageAttention

Only add the global launch flag when you explicitly want ComfyUI to use SageAttention globally:

--use-sage-attention

Do not combine multiple mutually exclusive attention backend flags.


Done means five checks passed

You are done only when:

  1. Triton imports in the exact Python used by ComfyUI.
  2. SageAttention is installed in that same Python.
  3. from sageattention import sageattn works.
  4. The minimal CUDA test prints Finite: True.
  5. 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-attention

Switch the workflow backend back to:

sdpa
comfy
torch
auto

Then uninstall SageAttention:

.\python_embeded\python.exe -s -m pip uninstall sageattention -y

or:

python -m pip uninstall sageattention -y

Do 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

  • SageAttention official GitHub repository
  • SageAttention PyPI page
  • Triton Windows current project
  • triton-windows PyPI page
  • ComfyUI command-line arguments

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 packages

Did this fix your issue?

Your answer helps prioritize verified ComfyUI repairs.

Table of Contents

The correct order
Step 1: check the GPU first
Step 2: confirm the exact Python
Windows ComfyUI Portable
Manual install or venv
Step 3: save the current environment
Windows Portable
Manual venv
Step 4: confirm PyTorch and CUDA
Windows Portable
Manual venv
Step 5: install the matching Triton Windows package
PyTorch 2.7
PyTorch 2.8
PyTorch 2.9
Step 6: for ComfyUI Portable, check include and libs
Windows Portable
Step 7: verify Triton
Windows Portable
Manual venv
Step 8: choose the SageAttention source
Route A: PyPI SageAttention V1
Route B: official SageAttention 2.2.0 command
Route C: prebuilt Windows wheel
Route D: source build
Step 9: verify SageAttention
Windows Portable
Manual venv
Step 10: run a minimal CUDA test
Step 11: enable it in ComfyUI last
Done means five checks passed
Safe rollback
Related guides
Source references