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.16k stars 212 forks source link

Problems with StableFast3d #249

Open Murble99 opened 1 month ago

Murble99 commented 1 month ago

I have used this for TripoSR and CRM and just saw StableFast3d and wanted to try. When I first tried it, on the "Load SF3D Model" node it came up with the error along the lines of, "cl.exe could not be found". I realized I forgot to enable Desktop Development C++. I did that and now I get this:

Error occurred when executing [Comfy3D] Load SF3D Model:

Error building extension '_slangtorch_texture_baker_44136fa355b3678a': [1/3] C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\bin\nvcc --generate-dependencies-with-compile --dependency-output texture_baker_cuda.cuda.o.d -Xcudafe --diag_suppress=dll_interface_conflict_dllexport_assumed -Xcudafe --diag_suppress=dll_interface_conflict_none_assumed -Xcudafe --diag_suppress=field_without_dll_interface -Xcudafe --diag_suppress=base_class_has_different_dll_interface -Xcompiler /EHsc -Xcompiler /wd4068 -Xcompiler /wd4067 -Xcompiler /wd4624 -Xcompiler /wd4190 -Xcompiler /wd4018 -Xcompiler /wd4275 -Xcompiler /wd4267 -Xcompiler /wd4244 -Xcompiler /wd4251 -Xcompiler /wd4819 -Xcompiler /MD -DTORCH_EXTENSION_NAME=_slangtorch_texture_baker_44136fa355b3678a -DTORCH_API_INCLUDE_EXTENSION_H -IE:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\Gen_3D_Modules\StableFast3D\sf3d -IE:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\include -IE:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\include\torch\csrc\api\include -IE:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\include\TH -IE:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\include" -IE:\ComfyUI_windows_portable\python_embeded\Include -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_89,code=compute_89 -gencode=arch=compute_89,code=sm_89 -std=c++17 --std=c++17 -U__CUDA_NO_HALF_OPERATORS__ -U__CUDA_NO_HALF_CONVERSIONS__ -U__CUDA_NO_HALF2_OPERATORS__ -U__CUDA_NO_BFLOAT16_CONVERSIONS__ -DSLANG_CUDA_ENABLE_HALF=1 -c E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\Gen_3D_Modules\StableFast3D\sf3d\.slangtorch_cache\texture_baker\44136fa355b3678a\texture_baker_cuda.cu -o texture_baker_cuda.cuda.o
FAILED: texture_baker_cuda.cuda.o
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\bin\nvcc --generate-dependencies-with-compile --dependency-output texture_baker_cuda.cuda.o.d -Xcudafe --diag_suppress=dll_interface_conflict_dllexport_assumed -Xcudafe --diag_suppress=dll_interface_conflict_none_assumed -Xcudafe --diag_suppress=field_without_dll_interface -Xcudafe --diag_suppress=base_class_has_different_dll_interface -Xcompiler /EHsc -Xcompiler /wd4068 -Xcompiler /wd4067 -Xcompiler /wd4624 -Xcompiler /wd4190 -Xcompiler /wd4018 -Xcompiler /wd4275 -Xcompiler /wd4267 -Xcompiler /wd4244 -Xcompiler /wd4251 -Xcompiler /wd4819 -Xcompiler /MD -DTORCH_EXTENSION_NAME=_slangtorch_texture_baker_44136fa355b3678a -DTORCH_API_INCLUDE_EXTENSION_H -IE:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\Gen_3D_Modules\StableFast3D\sf3d -IE:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\include -IE:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\include\torch\csrc\api\include -IE:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\include\TH -IE:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\include" -IE:\ComfyUI_windows_portable\python_embeded\Include -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_89,code=compute_89 -gencode=arch=compute_89,code=sm_89 -std=c++17 --std=c++17 -U__CUDA_NO_HALF_OPERATORS__ -U__CUDA_NO_HALF_CONVERSIONS__ -U__CUDA_NO_HALF2_OPERATORS__ -U__CUDA_NO_BFLOAT16_CONVERSIONS__ -DSLANG_CUDA_ENABLE_HALF=1 -c E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\Gen_3D_Modules\StableFast3D\sf3d\.slangtorch_cache\texture_baker\44136fa355b3678a\texture_baker_cuda.cu -o texture_baker_cuda.cuda.o
cl : Command line warning D9025 : overriding '/D__CUDA_NO_HALF_OPERATORS__' with '/U__CUDA_NO_HALF_OPERATORS__'
cl : Command line warning D9025 : overriding '/D__CUDA_NO_HALF_CONVERSIONS__' with '/U__CUDA_NO_HALF_CONVERSIONS__'
cl : Command line warning D9025 : overriding '/D__CUDA_NO_HALF2_OPERATORS__' with '/U__CUDA_NO_HALF2_OPERATORS__'
cl : Command line warning D9025 : overriding '/D__CUDA_NO_BFLOAT16_CONVERSIONS__' with '/U__CUDA_NO_BFLOAT16_CONVERSIONS__'
texture_baker_cuda.cu
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\include\crt/host_config.h(153): fatal error C1189: #error: -- unsupported Microsoft Visual Studio version! Only the versions between 2017 and 2022 (inclusive) are supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk.

texture_baker_cuda.cu

[2/3] cl /showIncludes -DTORCH_EXTENSION_NAME=_slangtorch_texture_baker_44136fa355b3678a -DTORCH_API_INCLUDE_EXTENSION_H -IE:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\Gen_3D_Modules\StableFast3D\sf3d -IE:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\include -IE:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\include\torch\csrc\api\include -IE:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\include\TH -IE:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\include" -IE:\ComfyUI_windows_portable\python_embeded\Include -D_GLIBCXX_USE_CXX11_ABI=0 /MD /wd4819 /wd4251 /wd4244 /wd4267 /wd4275 /wd4018 /wd4190 /wd4624 /wd4067 /wd4068 /EHsc /std:c++17 /std:c++17 -c E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\Gen_3D_Modules\StableFast3D\sf3d\.slangtorch_cache\texture_baker\44136fa355b3678a\texture_baker.cpp /Fotexture_baker.o
Microsoft (R) C/C++ Optimizing Compiler Version 19.40.33813 for x64
Copyright (C) Microsoft Corporation. All rights reserved.

ninja: build stopped: subcommand failed.

File "E:\ComfyUI_windows_portable\ComfyUI\execution.py", line 152, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\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 "E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-0246\utils.py", line 381, in new_func
res_value = old_func(*final_args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\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 "E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\nodes.py", line 1969, in load_SF3D
sf3d_model = SF3D.from_pretrained(
^^^^^^^^^^^^^^^^^^^^^
File "E:\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 "E:\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 "E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\Gen_3D_Modules\StableFast3D\sf3d\system.py", line 128, in configure
self.baker = TextureBaker()
^^^^^^^^^^^^^^
File "E:\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 "E:\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 "E:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\slangtorch\slangtorch.py", line 571, in _loadModule
slangLib, metadata = compileAndLoadModule(
^^^^^^^^^^^^^^^^^^^^^
File "E:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\slangtorch\slangtorch.py", line 460, in compileAndLoadModule
slangLib = _compileAndLoadModule(metadata, sources, moduleName, buildDir, slangSourceDir, verbose)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\slangtorch\slangtorch.py", line 501, in _compileAndLoadModule
return jit_compile(
^^^^^^^^^^^^
File "E:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\slangtorch\util\compile.py", line 71, in jit_compile
_write_ninja_file_and_build_library(
File "E:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\utils\cpp_extension.py", line 1832, in _write_ninja_file_and_build_library
_run_ninja_build(
File "E:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\utils\cpp_extension.py", line 2123, in _run_ninja_build
raise RuntimeError(message) from e

I have no idea where to go to from here. Each of the other methods work, so I'll stick to those, but I'd like to give this a go. I saw this line, and I am using Visual Studio Build Tools 2022, so I am currently repairing that to see if it fixes it. C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\include\crt/host_config.h(153): fatal error C1189: #error: -- unsupported Microsoft Visual Studio version! Only the versions between 2017 and 2022 (inclusive) are supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk.

Murble99 commented 1 month ago

After repairing and just redownloading VS Build Tools 2022, it is back to saying "cl.exe not found in default Visual Studio installation path" and I don't want to mess it up again.

rezponze commented 1 month ago

I have the same issue. No clue what to do.

Duodecimus commented 1 month ago

fatal error C1189: #error: -- unsupported Microsoft Visual Studio version! Only the versions between 2017 and 2022 (inclusive) are supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk.

While I didn't have it with 3dPack, I've gotten similar errors to this. Typically I found it was caused by the build.ninja being generated requiring C++17, but for some godforsaken reason the visual studio installer not populating whatever list that checks against with the value. iirc my list only came with 'C++latest' or something similar.

I never figured out how to get those flags. I ended up having to edit the build.ninja and replace C++17 with C++latest, and build it directly(as running comfy again will regenerate the build file and erase your edits), and then install the built folder with pip.

More than likely this will cause further compilation errors, as it is a clear sign that your C++ environment isn't setup right. I had to add a number of build.ninja -I include lines as well.

ben-g0 commented 1 month ago

After repairing and just redownloading VS Build Tools 2022, it is back to saying "cl.exe not found in default Visual Studio installation path" and I don't want to mess it up again.

I've noticed on my machine that if both the Visual Studio build tools and Visual Studio itself are installed, it can show that "cl.exe not found" message if Visual Studio does not have the "C++ for desktop development" package installed. It seems to detect the Visual Studio install and looks for cl.exe there instead of in the build tools install, but Visual Studio won't have cl.exe if the C++ for desktop development extension isn't installed.

However, now it gets stuck at "Only the versions between 2017 and 2022 (inclusive) are supported!", even though I have version 2022 installed of both the build tools and Visual Studio.

EDIT: Did some more research. It seems like the "unsupported Microsoft Visual Studio version! Only the versions between 2017 and 2022 (inclusive) are supported! ..." error is caused by a combination of an inconsistency in the internal version numbering from Visual Studio 17.9 to 17.10, and CUDA not accounting for this inconsistency until CUDA 12.5. ComfyUI portable however still seems to use CUDA 12.1 at the time of writing. Apparently, installing Visual Studio 17.9.2 or earlier (older versions are available here, but you'd need to uninstall your current Visual Studio install first) may work, but it's getting late here, so I'll try that tomorrow.

cczw2010 commented 1 month ago

try this https://github.com/Stability-AI/stable-fast-3d/issues/14 https://zenn.dev/safubuki/articles/turtle-20240803-stable-fast

jaykup1 commented 1 month ago

slangtorch.py is doing "vswhere.exe -latest -property installationPath" and not seeing any. It needs Visual Studio Community.

Installed "Visual Studio Community 2022 with C++ with MSVC v142" BUT compiling had errors so I had to install "Visual Studio Community 2019 with C++ MSVC v142" and now it works.

Install Visual Studio Community 2019

Envyana commented 1 month ago

slangtorch.py is doing "vswhere.exe -latest -property installationPath" and not seeing any. It needs Visual Studio Community.

Installed "Visual Studio Community 2022 with C++ with MSVC v142" BUT compiling had errors so I had to install "Visual Studio Community 2019 with C++ MSVC v142" and now it works.

Install Visual Studio Community 2019

it worked but I found a new problem after installing visualcode 2019 "RecursionError: maximum recursion depth exceeded when calling a Python object" I don't know what it means