The message
UserWarning: 1Torch was not compiled with flash attention. (Triggered internally at …\aten\src\ATen\native\transformers\cuda\sdp_utils.cpp:263.)
Affects: ComfyUI, AUTOMATIC1111 Stable Diffusion WebUI, Stable Diffusion WebUI Forge, TextGen (text-generation-webui), F5-TTS, Python
Why is this happening?
PyTorch knows three Attention paths: FlashAttention-2, Memory-Efficient Attention, and a general C++ variant, and it automatically chooses the best available one. The official Windows packages from PyTorch currently do not include FlashAttention-2; the issue is still unresolved in PyTorch. That is why the warning appears, but the program keeps calculating with one of the other variants.
How to fix it
- If the program keeps running after the warning and produces results, you can ignore it. It is a warning, not an error.
- Setting the environment variable
USE_FLASH_ATTENTION=1does not remove the warning. It only works if you build PyTorch yourself from source. - Even a nightly version of PyTorch did not remove the warning on Windows in the reports.
- You only need to take action if, instead of the warning, you get
RuntimeError: Torch was not compiled with flash attention.and the program aborts. In that case, the program is forcing FlashAttention only. Turn off this setting so PyTorch is allowed to fall back to the other variants. - If you get the RuntimeError with an unofficial PyTorch package (for example from conda-forge), install the official package according to the guide on pytorch.org.
Better not: Do not build PyTorch yourself from source just to get rid of this warning.
Set up from scratch again
If it still doesn’t work after that, a fresh setup step by step often helps:
- Set up and maintain ComfyUI on Windows
Desktop or Portable, where the models belong, sharing models with other programs, safely installing custom nodes, updates, startup options … - Your First Image with ComfyUI
Install Comfy Desktop, learn the interface, and create your first AI image with FLUX.2 [small] 4B or Z-Image Turbo. - Your First AI Video with LTX in ComfyUI
Use LTX-2.3 in ComfyUI to create short videos with sound from text or an image. Template, files, settings, and license.
Terms for this
Similar errors
- RuntimeError: CUDA error: an illegal memory access was encountered – the graphics card accessed invalid memory
- No matching distribution found for torch (wrong Python version)
- 'python' is not recognized or opens the Microsoft Store
- ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied – pip cannot modify a file
- ImportError: DLL load failed while importing …: The specified module could not be found – a Python package is missing a Windows DLL
Sources
- https://discuss.pytorch.org/t/flash-attention-compilation-warning/196692
- https://github.com/pytorch/pytorch/issues/108175
- https://docs.pytorch.org/docs/2.14/generated/torch.nn.functional.scaled_dot_product_attention.html
- https://discuss.pytorch.org/t/runtime-error-when-using-flash-attention/177535
Checked on Oct 27, 2026. Didn't help? Ask in the forum and name the graphics card, program, and the full message.