ComfyUI icon indicating copy to clipboard operation
ComfyUI copied to clipboard

RuntimeError: Failed to find C compiler. Please specify via CC environment variable.

Open tiptinker opened this issue 2 years ago • 7 comments

Your question

It's about the TorchCompileModel node.

backend='inductor' raised:
RuntimeError: Failed to find C compiler. Please specify via CC environment variable.

image

image

What should I do to the system PATH?

Logs

No response

Other

No response

tiptinker avatar Oct 11 '24 10:10 tiptinker

Unfortunately, that feature is only guaranteed to work on Linux.

ltdrdata avatar Oct 11 '24 16:10 ltdrdata

You need to set both the path to your VS installation and the C compiler path.

For example:

The CC environment variable set to (with cl.exe at the end):

C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\bin\Hostx64\x64\cl.exe

In your PATH environment variable include (no cl.exe at the end):

C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\bin\Hostx64\x64

This fixed it for me.

andypotato avatar Feb 28 '25 02:02 andypotato

I had the same problem. I wanted to ask where I should go to change the path. I'm sorry, but I don't understand some computer things very well, and I would appreciate your help.

Lyao0915 avatar Mar 10 '25 10:03 Lyao0915

@Lyao0915 you need to go to the environment variables settings on Windows. Open the start menu and just type "env" - This should bring up a link to your settings

In your settings you will find two different configurations. One for your current user account, one for the system wide variables. I suggest you update the one for your user account settings. In the list of user variables double click the one called "PATH". Then add the path to your VC compiler to the list of values. After you added the PATH, you can create a new environment variable called "CC" and add the path to the compiler binary.

Your path is most likely different from mine, so you need to check the correct path for your system. Don't just copy mine!

andypotato avatar Mar 10 '25 11:03 andypotato

Thanks so much!!!!!!!!!!!!!!! it works!!!!!!!!!!!!!!! That helps a lot!!!!!

Lyao0915 avatar Mar 10 '25 12:03 Lyao0915

Image Image

Im a comfyui and python newbie so sorry for the dumb questions but you guys seem to have the solution but when I try and update system environment variables the way Andypotato decscribed very well, I still manage to screw it up. I pasted some pics of my error message from ComfyUI and screenshot of environment settings. I made sure my path to VC was correct, then added a new environment variable called "CC" and pasted the path the cl.exe(from VC directory). Still getting this error. Triton, Cuda, etc all seem to be installed correctly and load fine. Not sure what Im missing...any help would be hugely appreciated!!! First post at github! definitely will be posting and reading up on latest here, seems like a great resource!

piajartist avatar Apr 04 '25 08:04 piajartist

Image Image

Im a comfyui and python newbie so sorry for the dumb questions but you guys seem to have the solution but when I try and update system environment variables the way Andypotato decscribed very well, I still manage to screw it up. I pasted some pics of my error message from ComfyUI and screenshot of environment settings. I made sure my path to VC was correct, then added a new environment variable called "CC" and pasted the path the cl.exe(from VC directory). Still getting this error. Triton, Cuda, etc all seem to be installed correctly and load fine. Not sure what Im missing...any help would be hugely appreciated!!! First post at github! definitely will be posting and reading up on latest here, seems like a great resource!

I had a same issues and i did the same thing as you did. And it worked. Only thing i additionally do is, download and install the microsoft visual studio 2022. You might need to update comfyui and all dependicies using the script inside the comfyui portable update folder. Maybe it might help.

BaranZs avatar Oct 23 '25 12:10 BaranZs