MrForExample / ComfyUI-3D-Pack

An extensive node suite that enables ComfyUI to process 3D inputs (Mesh & UV Texture, etc) using cutting edge algorithms (3DGS, NeRF, etc.)
MIT License
2.19k stars 219 forks source link

cl.exe not found in default Visual Studio installation path #259

Open grandparodeo opened 1 month ago

grandparodeo commented 1 month ago

This one is really stumping me. All of the nodes appear to be loading correctly, but I get this error when the workflow tries to load the model:

Error occurred when executing [Comfy3D] Load SF3D Model:

cl.exe not found in default Visual Studio installation path

File "D:\ComfyUI_windows_portable\ComfyUI\execution.py", line 152, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\ComfyUI_windows_portable\ComfyUI\execution.py", line 82, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\ComfyUI_windows_portable\ComfyUI\execution.py", line 75, in map_node_over_list results.append(getattr(obj, func)(*slice_dict(input_data_all, i))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\nodes.py", line 1969, in load_SF3D sf3d_model = SF3D.from_pretrained( ^^^^^^^^^^^^^^^^^^^^^ File "D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\Gen_3D_Modules\StableFast3D\sf3d\system.py", line 78, in from_pretrained model = cls(cfg) ^^^^^^^^ File "D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\Gen_3D_Modules\StableFast3D\sf3d\models\utils.py", line 29, in init self.configure(args, **kwargs) File "D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\Gen_3D_Modules\StableFast3D\sf3d\system.py", line 128, in configure self.baker = TextureBaker() ^^^^^^^^^^^^^^ File "D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\Gen_3D_Modules\StableFast3D\sf3d\texture_baker.py", line 13, in init self.baker = slangtorch.loadModule( ^^^^^^^^^^^^^^^^^^^^^^ File "D:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\slangtorch\slangtorch.py", line 652, in loadModule rawModule = _loadModule(fileName, moduleName, buildDir, options, sourceDir=outputFolder, verbose=verbose, includePaths=includePaths, dryRun=False) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\slangtorch\slangtorch.py", line 571, in _loadModule slangLib, metadata = compileAndLoadModule( ^^^^^^^^^^^^^^^^^^^^^ File "D:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\slangtorch\slangtorch.py", line 460, in compileAndLoadModule slangLib = _compileAndLoadModule(metadata, sources, moduleName, buildDir, slangSourceDir, verbose) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\slangtorch\slangtorch.py", line 480, in _compileAndLoadModule _add_msvc_to_env_var() File "D:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\slangtorch\slangtorch.py", line 112, in _add_msvc_to_env_var path_to_add = find_cl() ^^^^^^^^^ File "D:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\slangtorch\slangtorch.py", line 103, in find_cl raise ValueError("cl.exe not found in default Visual Studio installation path")

CambridgeComputing commented 1 month ago

I found a bug a bug in slangtorch.py. Replace line 96 with the below code, restart ComfyUI, and try again:

result = subprocess.run([vswhere_path, '-latest', '-products', '*', '-property', 'installationPath'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)

Looking at your error, the file you're looking for is D:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\slangtorch\slangtorch.py Let me know if that fixes it for you too!

Styraco commented 3 days ago

I had exactly the same problem, which I finally managed to solve. I had exactly the same error message and the terminal returned the same lines and files.

The problem was with Visual Studio 2022. 3D-Pack and stable-fast-3D require Visual Studio 2022 to run. But it's only Visual Studio 2022 up to version 17.9.X. 3D-pack and stable-fast-3D seem not to be compatible with Visual Studio 2022 version 17.1X (the most recent ones). More precisely, it's not the module itself that's incompatible, but the “Ninja” dependency which stable-fast-3D uses during its installation (this dependency : https://pypi.org/project/ninja/ )

To solve the problem, I had to uninstall Visual Studio 2022 and reinstall Visual Studio 2022 version 17.9.7 from this page: https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-history#updating-your-installation-to-a-specific-release

Please note that I have reinstalled Visual Studio 2022 version 17.9.7 and the corresponding Building Tools (both can be found on the previous page).

Then I did a clean reinstall of Comfyui, 3D-Pack and stable-fast-3D

I hope this solves your problem.