StabilityMatrix icon indicating copy to clipboard operation
StabilityMatrix copied to clipboard

SageAttention install error with torch

Open Saberloki27 opened this issue 1 year ago • 4 comments

Package

Package Commands > Install Triton and SageAttention

When did the issue occur?

Installing the Package

What GPU / hardware type are you using?

rtx 4090

What happened?

Installing triton and sageattention on comfyui with Package Commands.

I have torch 2.8.0+cu129 in the Python Packages and comfyui is functioning properly.

pip list result in the venv is "torch 2.8.0+cu129".

The install fail with the following error:

ModuleNotFoundError: No module named 'torch'

Console output

Downloading Python libraries Downloading SageAttention Cloning into 'J:\Stability Matrix\Data\Packages\ComfyUI\SageAttention'... Installing SageAttention Using Python 3.10.11 environment at: venv error: The build backend returned an error Caused by: Call to setuptools.build_meta:__legacy__.build_wheel failed (exit code: 1)

[stderr] Traceback (most recent call last): File "", line 14, in File "J:\Stability Matrix\Data\Assets\uv\cache\builds-v0.tmpK7VuVS\lib\site-packages\setuptools\build_meta.py", line 331, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=[]) File "J:\Stability Matrix\Data\Assets\uv\cache\builds-v0.tmpK7VuVS\lib\site-packages\setuptools\build_meta.py", line 301, in _get_build_requires self.run_setup() File "J:\Stability Matrix\Data\Assets\uv\cache\builds-v0.tmpK7VuVS\lib\site-packages\setuptools\build_meta.py", line 512, in run_setup super().run_setup(setup_script=setup_script) File "J:\Stability Matrix\Data\Assets\uv\cache\builds-v0.tmpK7VuVS\lib\site-packages\setuptools\build_meta.py", line 317, in run_setup exec(code, locals()) File "", line 24, in ModuleNotFoundError: No module named 'torch'

hint: This error likely indicates that file:///J:/Stability%20Matrix/Data/Packages/ComfyUI/SageAttention depends on torch, but doesn't declare it as a build dependency. If file:///J:/Stability%20Matrix/Data/Packages/ComfyUI/SageAttention is a first-party package, consider adding torch to its build-system.requires. Otherwise, uv pip install torch into the environment and re-run with --no-build-isolation. Error: StabilityMatrix.Core.Exceptions.ProcessException: pip install failed with code 2: 'Using Python 3.10.11 environment at: venv\nerror: The build backend returned an error\n Caused by: Call to setuptools.build_meta:__legacy__.build_wheel failed (exit code: 1)\n\n[stderr]\nTraceback (most recent call last):\n File "", line 14, in \n File "J:\Stability Matrix\Data\Assets\uv\cache\builds-v0.tmpK7VuVS\lib\site-packages\setuptools\build_meta.py", line 331, in get_requires_for_build_wheel\n return self._get_build_requires(config_settings, requirements=[])\n File "J:\Stability Matrix\Data\Assets\uv\cache\builds-v0.tmpK7VuVS\lib\site-packages\setuptools\build_meta.py", line 301, in _get_build_requires\n self.run_setup()\n File "J:\Stability Matrix\Data\Assets\uv\cache\builds-v0.tmpK7VuVS\lib\site-packages\setuptools\build_meta.py", line 512, in run_setup\n super().run_setup(setup_script=setup_script)\n File "J:\Stability Matrix\Data\Assets\uv\cache\builds-v0.tmpK7VuVS\lib\site-packages\setuptools\build_meta.py", line 317, in run_setup\n exec(code, locals())\n File "", line 24, in \nModuleNotFoundError: No module named 'torch'\n\nhint: This error likely indicates that file:///J:/Stability%20Matrix/Data/Packages/ComfyUI/SageAttention depends on torch, but doesn't declare it as a build dependency. If file:///J:/Stability%20Matrix/Data/Packages/ComfyUI/SageAttention is a first-party package, consider adding torch to its build-system.requires. Otherwise, uv pip install torch into the environment and re-run with --no-build-isolation.\n' at StabilityMatrix.Core.Python.UvVenvRunner.PipInstall(ProcessArgs args, Action1 outputDataReceived) at StabilityMatrix.Core.Models.PackageModification.InstallSageAttentionStep.ExecuteAsync(IProgress1 progress) at StabilityMatrix.Core.Models.PackageModification.InstallSageAttentionStep.ExecuteAsync(IProgress1 progress) at StabilityMatrix.Core.Models.PackageModification.PackageModificationRunner.ExecuteSteps(IEnumerable1 steps)

Version

2.15.0

What Operating System are you using?

Windows

Saberloki27 avatar Sep 23 '25 13:09 Saberloki27

I get a different error with the same action, of trying to install triton+sage for comfyui:

Using Python 3.12.10 environment at: venv
error: The build backend returned an error
  Caused by: Call to `setuptools.build_meta:__legacy__.build_wheel` failed (exit code: 1)

[stderr]
Traceback (most recent call last):
  File "<string>", line 8, in <module>
  File "F:\StableDiffusion\Programs\StabilityMatrix\Data\Assets\uv\cache\builds-v0\.tmpRG3FMK\Lib\site-packages\setuptools\__init__.py", line 23, in <module>
    from . import logging, monkey
  File "F:\StableDiffusion\Programs\StabilityMatrix\Data\Assets\uv\cache\builds-v0\.tmpRG3FMK\Lib\site-packages\setuptools\logging.py", line 5, in <module>
    from . import monkey
  File "F:\StableDiffusion\Programs\StabilityMatrix\Data\Assets\uv\cache\builds-v0\.tmpRG3FMK\Lib\site-packages\setuptools\monkey.py", line 13, in <module>
    import distutils.filelist
ModuleNotFoundError: No module named 'distutils'

hint: `distutils` was removed from the standard library in Python 3.12. Consider adding a constraint to avoid building a package that depends on `distutils`.
Error: StabilityMatrix.Core.Exceptions.ProcessException: pip install failed with code 2: 'Using Python 3.12.10 environment at: venv\nerror: The build backend returned an error\n  Caused by: Call to `setuptools.build_meta:__legacy__.build_wheel` failed (exit code: 1)\n\n[stderr]\nTraceback (most recent call last):\n  File "<string>", line 8, in <module>\n  File "F:\StableDiffusion\Programs\StabilityMatrix\Data\Assets\uv\cache\builds-v0\.tmpRG3FMK\Lib\site-packages\setuptools\__init__.py", line 23, in <module>\n    from . import logging, monkey\n  File "F:\StableDiffusion\Programs\StabilityMatrix\Data\Assets\uv\cache\builds-v0\.tmpRG3FMK\Lib\site-packages\setuptools\logging.py", line 5, in <module>\n    from . import monkey\n  File "F:\StableDiffusion\Programs\StabilityMatrix\Data\Assets\uv\cache\builds-v0\.tmpRG3FMK\Lib\site-packages\setuptools\monkey.py", line 13, in <module>\n    import distutils.filelist\nModuleNotFoundError: No module named 'distutils'\n\nhint: `distutils` was removed from the standard library in Python 3.12. Consider adding a constraint to avoid building a package that depends on `distutils`.\n'
   at StabilityMatrix.Core.Python.UvVenvRunner.PipInstall(ProcessArgs args, Action`1 outputDataReceived)
   at StabilityMatrix.Core.Models.PackageModification.InstallSageAttentionStep.ExecuteAsync(IProgress`1 progress)
   at StabilityMatrix.Core.Models.PackageModification.InstallSageAttentionStep.ExecuteAsync(IProgress`1 progress)
   at StabilityMatrix.Core.Models.PackageModification.PackageModificationRunner.ExecuteSteps(IEnumerable`1 steps)

Mets3D avatar Sep 23 '25 20:09 Mets3D

the same problem

rtx 3060 windows 10

`Installing Triton Using Python 3.10.11 environment at: venv Resolved 2 packages in 578ms Installed 2 packages in 2.49s

  • setuptools==80.9.0
  • triton-windows==3.4.0.post20 Downloading Python libraries Download complete! Extracting Python libraries include\internal\pycore_ucnhash.h Downloading SageAttention Cloning into 'D:\AI\StabilityMatrix\Packages\ComfyUI0360\SageAttention'... Installing SageAttention Using Python 3.10.11 environment at: venv error: The build backend returned an error Caused by: Call to setuptools.build_meta:__legacy__.build_wheel failed (exit code: 1)

[stderr] Traceback (most recent call last): File "", line 14, in File "D:\AI\StabilityMatrix\Assets\uv\cache\builds-v0.tmpwrgZdZ\lib\site-packages\setuptools\build_meta.py", line 331, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=[]) File "D:\AI\StabilityMatrix\Assets\uv\cache\builds-v0.tmpwrgZdZ\lib\site-packages\setuptools\build_meta.py", line 301, in _get_build_requires self.run_setup() File "D:\AI\StabilityMatrix\Assets\uv\cache\builds-v0.tmpwrgZdZ\lib\site-packages\setuptools\build_meta.py", line 512, in run_setup super().run_setup(setup_script=setup_script) File "D:\AI\StabilityMatrix\Assets\uv\cache\builds-v0.tmpwrgZdZ\lib\site-packages\setuptools\build_meta.py", line 317, in run_setup exec(code, locals()) File "", line 24, in ModuleNotFoundError: No module named 'torch'

hint: This error likely indicates that file:///D:/AI/StabilityMatrix/Packages/ComfyUI0360/SageAttention depends on torch, but doesn't declare it as a build dependency. If file:///D:/AI/StabilityMatrix/Packages/ComfyUI0360/SageAttention is a first-party package, consider adding torch to its build-system.requires. Otherwise, uv pip install torch into the environment and re-run with --no-build-isolation. Error: StabilityMatrix.Core.Exceptions.ProcessException: pip install failed with code 2: 'Using Python 3.10.11 environment at: venv\nerror: The build backend returned an error\n Caused by: Call to setuptools.build_meta:__legacy__.build_wheel failed (exit code: 1)\n\n[stderr]\nTraceback (most recent call last):\n File "", line 14, in \n File "D:\AI\StabilityMatrix\Assets\uv\cache\builds-v0.tmpwrgZdZ\lib\site-packages\setuptools\build_meta.py", line 331, in get_requires_for_build_wheel\n return self._get_build_requires(config_settings, requirements=[])\n File "D:\AI\StabilityMatrix\Assets\uv\cache\builds-v0.tmpwrgZdZ\lib\site-packages\setuptools\build_meta.py", line 301, in _get_build_requires\n self.run_setup()\n File "D:\AI\StabilityMatrix\Assets\uv\cache\builds-v0.tmpwrgZdZ\lib\site-packages\setuptools\build_meta.py", line 512, in run_setup\n super().run_setup(setup_script=setup_script)\n File "D:\AI\StabilityMatrix\Assets\uv\cache\builds-v0.tmpwrgZdZ\lib\site-packages\setuptools\build_meta.py", line 317, in run_setup\n exec(code, locals())\n File "", line 24, in \nModuleNotFoundError: No module named 'torch'\n\nhint: This error likely indicates that file:///D:/AI/StabilityMatrix/Packages/ComfyUI0360/SageAttention depends on torch, but doesn't declare it as a build dependency. If file:///D:/AI/StabilityMatrix/Packages/ComfyUI0360/SageAttention is a first-party package, consider adding torch to its build-system.requires. Otherwise, uv pip install torch into the environment and re-run with --no-build-isolation.\n' at StabilityMatrix.Core.Python.UvVenvRunner.PipInstall(ProcessArgs args, Action1 outputDataReceived) at StabilityMatrix.Core.Models.PackageModification.InstallSageAttentionStep.ExecuteAsync(IProgress1 progress) at StabilityMatrix.Core.Models.PackageModification.InstallSageAttentionStep.ExecuteAsync(IProgress1 progress) at StabilityMatrix.Core.Models.PackageModification.PackageModificationRunner.ExecuteSteps(IEnumerable1 steps) `

PzVI avatar Sep 24 '25 15:09 PzVI

This should be fixed in the latest v2.15.2

mohnjiles avatar Oct 19 '25 18:10 mohnjiles

same problem here, sageattention 1.0.6 seemed to "work" but i was not sure. i had troubles with qwen models when using it and i could never update it from stability matrix extension menu. always error message.

when uninstalling it and trying to install, i get the same error, no "torch" installed, but also 2.8.0+cu129 and mostly working normally.

Nakasara1 avatar Nov 20 '25 19:11 Nakasara1