Skip to content

SageAttention install error with torch #1396

Closed

Description

@Saberloki27

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

Activity

  1. Mets3D commented on Sep 23, 2025

    @Mets3D

    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)
    
  2. PzVI commented on Sep 24, 2025

    @PzVI

    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)
    `

  3. mohnjiles commented on Oct 19, 2025

    @mohnjiles
    Member

    This should be fixed in the latest v2.15.2

  4. Nakasara1 commented on Nov 20, 2025

    @Nakasara1

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions