Step-by-Step Guide Series: ComfyUI - Installing SageAttention 2

14
Step-by-Step Guide Series: ComfyUI - Installing SageAttention 2

Step-by-Step Guide Series:
Windows ComfyUI - Installing SageAttention 2

Foreword :

English is not my mother tongue, so I apologize for any errors. Do not hesitate to send me messages if you find any.

This guide is intended to be as simple as possible, and certain terms will be simplified.

Purpose of this guide :

The aim of this guide is to describe step by step how to install SageAttention2 on the portable version of ComfyUI.

Why do you want to do this? :

Simply put, Sageattention will enable you to greatly reduce the time needed to generate video with WAN2.1, for example.

You can find out more about how it works on the dedicated Github page: https://github.com/thu-ml/SageAttention

Overview of performance gains on a 4090.

Prerequisites :

Warning: Updating ComfyUI is not enough! The embedded python version must be 3.12, which is never updated via ComfyUI manager, for example.

To check your Python version, open a terminal in the “ComfyUI_windows_portable\python_embeded” folder and type “.\python.exe --version”.

If you don't see 3.12.9, you need to re-download ComfyUI portable.

If you've been using my automated intalation script version 1.2 or higher, then you've already got the right version.

CUDA :

For cuda, just run the installer and leave the default options.

Once installation is complete, check that two new entries have been added to your environment variables:

Python :

Launch the installer, check both boxes and click "Install Now":

Click on "Disable path length limit" :

Click on "Close" :

Microsoft Visual Studio Build Tools :

Launch the installe, check boxes like this and click on "install while downloading" :

Once finished, reopen the environment variables and add a new system entry:

Variable name : cl.exe

Variable value : C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.43.34808\bin\Hostx86\x64\

Triton :

The portable version of python doesn't have all the necessary libraries, so you'll have to add them manually.

Download this : link

Unzip it :

Warning: depending on your windows security settings, the zip may be locked. You need to right-click on the zip, then select “property”, and check whether an “unlock” box is present in the bottom right-hand corner. If so, check it and apply before unzipping.

Copy both folders into “ComfyUI_windows_portable\python_embeded” :

Now download triton and put it in the folder :

Open a terminal in this folder and run :

.\python.exe -s -m pip install .\triton-3.2.0-cp312-cp312-win_amd64.whl

Sageattention2 :

Finally, we move on to the installation of sageattention.

Open a terminal in “ComfyUI_windows_portable\python_embeded” and clone sageattention repo :

git clone https://github.com/thu-ml/SageAttention.git

Move to the downloaded folder and launch the installation:

cd .\SageAttention\ 
..\python.exe -s -m pip install -e .

Wait until you get your hand back :

If all went well, you've finally made it!

How to use it :

After all that, perhaps you'd like to know how to activate this in ComfyUI?

You have two choices:

  • Use it only on certain workflows,

  • Run comfy directly with sageattention.

To activate it from a workflow:

In all my WAN2.1 workflows you will find the “Sage Attention” node:

You can now set it to sageattn triton :

To enable it when starting ComfyUI:

Edit the file "run_nvidia_gpu" :

Add "--use-sage-attention" at the end of the first line and save :

Start ComfyUI with this modified script.

If the modification worked well, you will be able to observe this line appear when starting ComfyUI.

This guide is now complete. If you have any questions or suggestions, don't hesitate to post a comment.

If you have any problems, please be as specific as possible so that I can help you.

14

Comments

Thanks for your guide. On the visual studio install, so this have to be installed on any PC that I use comfyui porttable on? and also, you have selected windows 11 SDK 10.0 ----.. but I have windows 10. Should I select the windows 11 option, or a windows 10 one? Thanks

UmeAiRT's Avatar

I must confess that I don't have a Windows 10 computer to be able to try it out, but intuitively I'd say install the version for Windows 10. Let me know if it works so that other users can take advantage of it.

i had already downloaded the win11 version before I saw your reply. I used your installer and followed all your steps here. It seems to be working, and it seems to be working faster than my prior installation. Thanks!

UmeAiRT's Avatar

Thank you for your feedback. SageAttention is a bit complicated to install, so I've tried to make it as simple as possible.

Yeah I tried to install it yesterday and failed, so I really appreciate your guide.

paladinkratos678's Avatar

Guide - well written and gets you to the goal. Only problem I had was due to the lack I didn't realize my comfyui version was out of date. Keep up the good work.

UmeAiRT's Avatar

Thank you for your feedback

CaulShivers's Avatar

Can I just use normal ComfyUi version instead of ComfyUI portable? as long as I got the right python version? and how much sage decreases generation time? it takes me about 600 seconds on default settings with your workflow. It's great btw, finally getting some good results from compared to other workflows

UmeAiRT's Avatar

Yes, the classic version of ComfyUI also works very well, but to simplify the guide I've explained mainly for the protable version. Speed gains depend very much on the graphics card used. For exemple another user with a 3090TI have ~24s/it on 480 Q8 GGUF with sageattention.

AIStudio80's Avatar

very easy setup. thanks for instructions

Thanks so much for this guide!! Finally got sageattention working!

kirbyhi5's Avatar

Hello. I followed an older guide for using Sage Attention. Your method has some additional changes and doesn't mention using the "--use-sage-attention" flag in the run_nvidia_gpu.bat. Is that the same as using the Sage Attention node or is it something else? I'm a bit confused.

UmeAiRT's Avatar

Thank you for your feedback. I added some explanations at the end of the guide ^^
This guide was made to maximize compatibility, some people may succeed without doing everything but I try to directly address the most common problems.

radian871's Avatar

my cl.exe is in program files, not program files x86 - i checked (chatgpt) and its meant to be here and not in x86 - have i done something wrong and if so please help!

UmeAiRT's Avatar

The installation folder is selected at the bottom right of the Microsoft Visual Studio Build Tool installation window. However, if you have checked everything correctly, you will normally have the cl.exe. Just remember to modify the path in the environment variable according to yours.

radian871's Avatar

Thanks for replying. The path is correct as I copied from the folder locations, and have checked “CMD > CL” / “msbuild version” / “devenv” - which all work fine, it’s just the installation of “..\python.exe -s -m pip install -e .” which shows it failing as not being able to find it under “program files x86” (despite path clearly showing it under program files”

Should I reinstall VS to x86 and then re do the paths? Or am I missing something obvious. Thank you

Show more
UmeAiRT's Avatar

I think the simplest thing would be to uninstall and reinstall the build tools in the correct folder.

radian871's Avatar

Ok will do thanks

radian871's Avatar

ok build tools sorted. this is the error im getting. and by the way thank you for helping me troubleshoot my individual incompetence.

c1xx: fatal error C1083: Cannot open source file: 'csrc/qattn/pybind_sm80.cpp': No such file or directory

i have searched for the file and it DOES exist here: c:\\user...swarm\SwarmUI\dlbackend\comfy\ComfyUI\custom_nodes\SageAttention\csrc\qattn

Tenzan's Avatar

Thank you for the guide. I was able to install sage, but I do not understand the environment variable sections. How do I access that panel?

UmeAiRT's Avatar

I added two images to easily find this panel.

when i changed the startup bat to using sage attention. After doing so i keep getting an error during sampler 1 ending with "returned non-zero exit status 2." After changing it back and disabling sage it runs fine. Do you know why that would be? i followed your steps and installed both trition and sage fine.

Hello,

Thanks for your guide. I follow the steps bu I have an error at the last step (install sage 2):

Preparing metadata (setup.py) ... error

error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.

│ exit code: 1

╰─> [11 lines of output]

Traceback (most recent call last):

File "<string>", line 2, in <module>

File "<pip-setuptools-caller>", line 14, in <module>

File "J:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\__init__.py", line 16, in <module>

import setuptools.version

File "J:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\version.py", line 1, in <module>

import pkg_resources

File "J:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\pkg_resources\__init__.py", line 2191, in <module>

register_finder(pkgutil.ImpImporter, find_on_path)

^^^^^^^^^^^^^^^^^^^

AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?

[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.

error: metadata-generation-failed

Can you help?

Thanks

Show more

Hello, Thank you for your guide. I follow all the steps but I have an error at the last step (install sage 2):

× python setup.py egg_info did not run successfully.

│ exit code: 1

note: This error originates from a subprocess, and is likely not a problem with pip.

error: metadata-generation-failed

Show more

Hello,

I beg your pardon for the multiple messages, I feared that my comment wasn't sent. I dont want to be aggressive.

Thank you again for your guide (even if this sage installation isn't simple)... Thank you again for your efforts to make it as simple as possible. 👍Perhaps I'm too stupid to succeed🥵

Show more
aungkhant0911's Avatar

Everything going fine. But COmfyUI doesn't have Sageatention node. How to get it from within the UI?

UmeAiRT's Avatar

This node is a part of ComfyUI-KJNodes

Boy! You deserve all the props, that actually worked! One thing I might say is that I had to downgrade my setup tools using: python -m pip install "setuptools<=75.8.2" --force-reinstall

UmeAiRT's Avatar

Thank you, this happens if certain custom nodes have already been installed in the past.

boxertwin75593's Avatar

Thanks for this it's very thorough and easy to follow. I made it through to the very last step and got this error, maybe because I'm installing on my d: drive?:

AttributeError: module 'distutils._msvccompiler' has no attribute '_get_vc_env'

[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.

ERROR: Failed building editable for sageattention

Failed to build sageattention

ERROR: Failed to build installable wheels for some pyproject.toml based projects (sageattention)

Show more
UmeAiRT's Avatar

I don't think it's a folder issue because I'm using the D: drive myself. It seems to be the Visual Studio Build Tool, have you checked all the boxes like in the example? You also need to check the environment variables and sometimes restart Windows to take the changes.

gil159's Avatar

Hi ive tried installing sage multiple times from multiple tutorials and each time it fails at the same part "× Building editable for sageattention (pyproject.toml) did not run successfully." see the log i get would appreciate any advice on what im missing here:

" Installing build dependencies ... done

Checking if build backend supports build_editable ... done

Getting requirements to build editable ... done

Preparing editable metadata (pyproject.toml) ... done

Building wheels for collected packages: sageattention

Building editable for sageattention (pyproject.toml) ... error

error: subprocess-exited-with-error

× Building editable for sageattention (pyproject.toml) did not run successfully.

│ exit code: 1

╰─> [184 lines of output]

Detect GPUs with compute capabilities: {'8.9'}

running editable_wheel

creating C:\Users\Gil\AppData\Local\Temp\pip-wheel-i6yuk6do\.tmp-sln5sbbn\sageattention.egg-info

writing C:\Users\Gil\AppData\Local\Temp\pip-wheel-i6yuk6do\.tmp-sln5sbbn\sageattention.egg-info\PKG-INFO

writing dependency_links to C:\Users\Gil\AppData\Local\Temp\pip-wheel-i6yuk6do\.tmp-sln5sbbn\sageattention.egg-info\dependency_links.txt

writing top-level names to C:\Users\Gil\AppData\Local\Temp\pip-wheel-i6yuk6do\.tmp-sln5sbbn\sageattention.egg-info\top_level.txt

writing manifest file 'C:\Users\Gil\AppData\Local\Temp\pip-wheel-i6yuk6do\.tmp-sln5sbbn\sageattention.egg-info\SOURCES.txt'

reading manifest file 'C:\Users\Gil\AppData\Local\Temp\pip-wheel-i6yuk6do\.tmp-sln5sbbn\sageattention.egg-info\SOURCES.txt'

adding license file 'LICENSE'

writing manifest file 'C:\Users\Gil\AppData\Local\Temp\pip-wheel-i6yuk6do\.tmp-sln5sbbn\sageattention.egg-info\SOURCES.txt'

creating 'C:\Users\Gil\AppData\Local\Temp\pip-wheel-i6yuk6do\.tmp-sln5sbbn\sageattention-2.1.1.dist-info'

C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\command\bdist_wheel.py:103: RuntimeWarning: Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect

if get_flag("Py_DEBUG", hasattr(sys, "gettotalrefcount"), warn=(impl == "cp")):

creating C:\Users\Gil\AppData\Local\Temp\pip-wheel-i6yuk6do\.tmp-sln5sbbn\sageattention-2.1.1.dist-info\WHEEL

running build_py

running build_ext

C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\utils\cpp_extension.py:414: UserWarning: Error checking compiler version for cl: [WinError 2] The system cannot find the file specified

warnings.warn(f'Error checking compiler version for {compiler}: {error}')

building 'sageattention._qattn_sm80' extension

creating C:\Users\Gil\AppData\Local\Temp\tmpn9l9o407.build-temp\Release\csrc\qattn

Emitting ninja build file C:\Users\Gil\AppData\Local\Temp\tmpn9l9o407.build-temp\Release\build.ninja...

Compiling objects...

Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)

Traceback (most recent call last):

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\utils\cpp_extension.py", line 2169, in getvc_env

return distutils._msvccompiler._get_vc_env(vc_arch)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

AttributeError: module 'distutils._msvccompiler' has no attribute '_get_vc_env'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\command\editable_wheel.py", line 139, in run

self._create_wheel_file(bdist_wheel)

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\command\editable_wheel.py", line 340, in createwheel_file

files, mapping = self._run_build_commands(dist_name, unpacked, lib, tmp)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\command\editable_wheel.py", line 263, in runbuild_commands

self._run_build_subcommands()

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\command\editable_wheel.py", line 290, in runbuild_subcommands

self.run_command(name)

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\_distutils\cmd.py", line 357, in run_command

self.distribution.run_command(command)

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\dist.py", line 1105, in run_command

super().run_command(command)

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\_distutils\dist.py", line 1021, in run_command

cmd_obj.run()

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\command\build_ext.py", line 99, in run

buildext.run(self)

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 368, in run

self.build_extensions()

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\utils\cpp_extension.py", line 900, in build_extensions

build_ext.build_extensions(self)

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 484, in build_extensions

self._build_extensions_serial()

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 510, in buildextensions_serial

self.build_extension(ext)

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\command\build_ext.py", line 264, in build_extension

buildext.build_extension(self, ext)

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 565, in build_extension

objects = self.compiler.compile(

^^^^^^^^^^^^^^^^^^^^^^

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\utils\cpp_extension.py", line 872, in win_wrap_ninja_compile

writeninja_file_and_compile_objects(

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\utils\cpp_extension.py", line 1869, in writeninja_file_and_compile_objects

runninja_build(

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\utils\cpp_extension.py", line 2187, in runninja_build

vc_env = {k.upper(): v for k, v in getvc_env(plat_spec).items()}

^^^^^^^^^^^^^^^^^^^^^^

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\utils\cpp_extension.py", line 2172, in getvc_env

return msvccompiler.get_vc_env(vc_arch)

^^^^^^^^^^^^^^^^^^^^^^^^^

AttributeError: module 'distutils._msvccompiler' has no attribute '_get_vc_env'

C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\_distutils\dist.py:1021: _DebuggingTips: Problem in editable installation.

!!

********************************************************************************

An error happened while installing sageattention in editable mode.

The following steps are recommended to help debug this problem:

- Try to install the project normally, without using the editable mode.

Does the error still persist?

(If it does, try fixing the problem before attempting the editable mode).

- If you are using binary extensions, make sure you have all OS-level

dependencies installed (e.g. compilers, toolchains, binary libraries, ...).

- Try the latest version of setuptools (maybe the error was already fixed).

- If you (or your project dependencies) are using any setuptools extension

or customization, make sure they support the editable mode.

After following the steps above, if the problem still persists and

you think this is related to how setuptools handles editable installations,

please submit a reproducible example

(see https://stackoverflow.com/help/minimal-reproducible-example) to:

https://github.com/pypa/setuptools/issues

See https://setuptools.pypa.io/en/latest/userguide/development_mode.html for details.

********************************************************************************

!!

cmd_obj.run()

Traceback (most recent call last):

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\utils\cpp_extension.py", line 2169, in getvc_env

return distutils._msvccompiler._get_vc_env(vc_arch)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

AttributeError: module 'distutils._msvccompiler' has no attribute '_get_vc_env'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 389, in <module>

main()

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 373, in main

json_out["return_val"] = hook(**hook_input["kwargs"])

^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 303, in build_editable

return hook(wheel_directory, config_settings, metadata_directory)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\build_meta.py", line 476, in build_editable

return self._build_with_temp_dir(

^^^^^^^^^^^^^^^^^^^^^^^^^^

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\build_meta.py", line 407, in buildwith_temp_dir

self.run_setup()

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\build_meta.py", line 522, in run_setup

super().run_setup(setup_script=setup_script)

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\build_meta.py", line 320, in run_setup

exec(code, locals())

File "<string>", line 175, in <module>

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\__init__.py", line 117, in setup

return distutils.core.setup(**attrs)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\_distutils\core.py", line 186, in setup

return run_commands(dist)

^^^^^^^^^^^^^^^^^^

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\_distutils\core.py", line 202, in run_commands

dist.run_commands()

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\_distutils\dist.py", line 1002, in run_commands

self.run_command(cmd)

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\dist.py", line 1105, in run_command

super().run_command(command)

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\_distutils\dist.py", line 1021, in run_command

cmd_obj.run()

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\command\editable_wheel.py", line 139, in run

self._create_wheel_file(bdist_wheel)

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\command\editable_wheel.py", line 340, in createwheel_file

files, mapping = self._run_build_commands(dist_name, unpacked, lib, tmp)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\command\editable_wheel.py", line 263, in runbuild_commands

self._run_build_subcommands()

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\command\editable_wheel.py", line 290, in runbuild_subcommands

self.run_command(name)

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\_distutils\cmd.py", line 357, in run_command

self.distribution.run_command(command)

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\dist.py", line 1105, in run_command

super().run_command(command)

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\_distutils\dist.py", line 1021, in run_command

cmd_obj.run()

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\command\build_ext.py", line 99, in run

buildext.run(self)

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 368, in run

self.build_extensions()

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\utils\cpp_extension.py", line 900, in build_extensions

build_ext.build_extensions(self)

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 484, in build_extensions

self._build_extensions_serial()

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 510, in buildextensions_serial

self.build_extension(ext)

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\command\build_ext.py", line 264, in build_extension

buildext.build_extension(self, ext)

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 565, in build_extension

objects = self.compiler.compile(

^^^^^^^^^^^^^^^^^^^^^^

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\utils\cpp_extension.py", line 872, in win_wrap_ninja_compile

writeninja_file_and_compile_objects(

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\utils\cpp_extension.py", line 1869, in writeninja_file_and_compile_objects

runninja_build(

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\utils\cpp_extension.py", line 2187, in runninja_build

vc_env = {k.upper(): v for k, v in getvc_env(plat_spec).items()}

^^^^^^^^^^^^^^^^^^^^^^

File "C:\Users\Gil\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\utils\cpp_extension.py", line 2172, in getvc_env

return msvccompiler.get_vc_env(vc_arch)

^^^^^^^^^^^^^^^^^^^^^^^^^

AttributeError: module 'distutils._msvccompiler' has no attribute '_get_vc_env'

[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.

ERROR: Failed building editable for sageattention

Failed to build sageattention

ERROR: Failed to build installable wheels for some pyproject.toml based projects (sageattention)"

Show more

i got the "ERROR: Failed to build installable wheels for some pyproject.toml based projects (sageattention)"

got it fixed by upgrading setuptools

in python_embeded folder do : python.exe -m pip install --upgrade setuptools

Show more
gil159's Avatar

Thanks! that solved it!