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.42k stars 246 forks source link

Texture baker .slang not found #317

Open trackme518 opened 2 months ago

trackme518 commented 2 months ago

Hi, i am getting this error: [WinError 3] The system cannot find the path specified: 'C:\\Users\\glass hell\\Documents\\ComfyUI_windows_portable\\hell\\Documents\\ComfyUI_windows_portable\\ComfyUI\\custom_nodes\\ComfyUI-3D-Pack\\Gen_3D_Modules\\StableFast3D\\sf3d\\texture_baker.slang'

In the terminal I can see that:

 File "<frozen genericpath>", line 55, in getmtime
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\glass hell\\Documents\\ComfyUI_windows_portable\\hell\\Documents\\ComfyUI_windows_portable\\ComfyUI\\custom_nodes\\ComfyUI-3D-Pack\\Gen_3D_Modules\\StableFast3D\\sf3d\\texture_baker.slang'

This is on windows 11 + cuda 12.1 + torch 2.4.0 with newest wheels. And the texture_baker.slang file exists in the given path - I am attaching the file: texture_baker.zip

trackme518 commented 2 months ago

I have modified the texture_baker.py to self.baker = slangtorch.loadModule("texture_baker.slang") omitting the dirpath which resolved the issue but then ended in compilation error Compilation failed with error 4294967295

dedoogong commented 4 weeks ago

same here, I got same error on both windows and ubuntu cuda 12.1 , torch 2.4.0

Ken1171 commented 3 weeks ago

I am having a similar issue with texture baker related to a missing "slang.h" file. This is on Win10 + cuda 12.1 + torch 2.4.0 installed just today.

This is the error message I get:

M:\envs\3DPack\ComfyUI\custom_nodes\ComfyUI-3D-Pack\Gen_3D_Modules\StableFast3D\sf3d.slangtorch_cache\texture_baker\b9c103f6b206b8e5\texture_baker.cpp(476): fatal error C1083: Cannot open include file: 'slang.h': No such file or directory ninja: build stopped: subcommand failed.

NeuroLord commented 2 weeks ago

Ken1171

Did you get a handle on it?

Ken1171 commented 2 weeks ago

Ken1171

Did you get a handle on it?

Thanks for asking. From the entire 3D Pack collection, I could only get 1 of the generation methods to work. I have installed from wheels instead of Git, since it's precompiled - or so I thought. The errors I get are related to the Visual Studio 2022 version, claiming it to be incompatible. I suspect that's because my VS2022 version is installing on the x86 path, meaning it's a 32-bits compiler. I assume it wants the 64-bits version, but the free VS version doesn't have that. I am guessing here, but that's what I think it is.

NeuroLord commented 2 weeks ago

Ken1171

Did you get a handle on it?

Thanks for asking. From the entire 3D Pack collection, I could only get 1 of the generation methods to work. I have installed from wheels instead of Git, since it's precompiled - or so I thought. The errors I get are related to the Visual Studio 2022 version, claiming it to be incompatible. I suspect that's because my VS2022 version is installing on the x86 path, meaning it's a 32-bits compiler. I assume it wants the 64-bits version, but the free VS version doesn't have that. I am guessing here, but that's what I think it is.

I doubt the reason you said, as I had SF3D running in my old environment. After creating a new one I started getting this error, although the VS version is absolutely unchanged.

I have installed from wheels instead of Git

And what do you mean by that? Did you install wheels from this repository instead of the source code?

Ken1171 commented 2 weeks ago

Ken1171

Did you get a handle on it?

Thanks for asking. From the entire 3D Pack collection, I could only get 1 of the generation methods to work. I have installed from wheels instead of Git, since it's precompiled - or so I thought. The errors I get are related to the Visual Studio 2022 version, claiming it to be incompatible. I suspect that's because my VS2022 version is installing on the x86 path, meaning it's a 32-bits compiler. I assume it wants the 64-bits version, but the free VS version doesn't have that. I am guessing here, but that's what I think it is.

I doubt the reason you said, as I had SF3D running in my old environment. After creating a new one I started getting this error, although the VS version is absolutely unchanged.

I have installed from wheels instead of Git

And what do you mean by that? Did you install wheels from this repository instead of the source code?

It's hard for me to tell, but I noticed the error mentions incorrect VS version. I have the latest VS2022, so I assumed the Python setup may not be compatible with it. Maybe it expects from older VS2022 version?

It's also worth mentioning that the nVidia CUDA Toolkit has also complained about not finding a compatible VS version, even though I have the latest VS20222 installed with the C++ Build Tools enabled. I also suspect that both the Toolkit and 3D Pack are expecting a specific Windows environment variable for the VS2022 compiler, but they don't tell me which one they want. That would explain the "no compatible VS version found".

Yes, I have installed from the wheels using the recommended repository from the GitLab page. Since the errors are about not being able to integrate with the VS2022 compiler, I thought the wheels could come pre-compiled, but nope, still trying to compile and failing during some of these 3D Pack installations. Only 1 of the 3D generations has worked for me. The rest fails to compile during installation.

Nickardson commented 2 weeks ago

@Ken1171

M:\envs\3DPack\ComfyUI\custom_nodes\ComfyUI-3D-Pack\Gen_3D_Modules\StableFast3D\sf3d.slangtorch_cache\texture_baker\b9c103f6b206b8e5\texture_baker.cpp(476): fatal error C1083: Cannot open include file: 'slang.h': No such file or directory ninja: build stopped: subcommand failed.

I ran into this error and was able to resolve it by reverting slangtorch to an older version as I believe they're deprecating the C interface in newer versions:

pip install -v "slangtorch==1.2.6"

I also got cl.exe not found in default Visual Studio installation path and had to point slangtorch towards the right C++ build tools. Rather than reinstalling VS Build Tools to make it the latest install, I fixed where it looked for MSVC by applying a hacky change to venv\Lib\site-packages\slangtorch\slangtorch.py to manually specify my build tools directory (yours may differ):

#...
def find_cl():
    custom_path = 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.41.34120\\bin\\Hostx64\\x64'
    if os.path.exists(custom_path):
        return custom_path
    else:
        raise ValueError("Custom cl.exe path was added but not found")
#...
Ken1171 commented 2 weeks ago
if os.path.exists(custom_path):
        return custom_path
    else:
        raise ValueError("Custom cl.exe path was added but not found")

Thanks for the info! I have followed your steps, and noticed the CL.EXE path in your code is identical to mine, meaning you and I have the same VS2022 installation, down the version number. I have this path added to Windows PATH environment variable, so I can type it in a command line from anywhere, but as you figured, slangtorch is NOT using it. I have hardcoded the CL.exe path like you did, but STILL get the error (see below) about "unsupported Microsoft Visual Studio version! Only the versions between 2017 and 2022 (inclusive) are supported!". We both know we have VS2022 installed and CL is accessible, but 3D Pack can't detect it, even if I hardcode the path to the C++ compiler as you suggested.

Apparently, the error occurs at the slangtorch JIT compiler when it evokes _run_ninja_build. It's the same with most other 3D Pack workflows. There is a chance that solving this one solves it for all others.

ERROR MESSAGE BELOW:

File "M:\envs\3DPack\Lib\site-packages\slangtorch\slangtorch.py", line 506, in _compileAndLoadModule return jit_compile( ^^^^^^^^^^^^ File "M:\envs\3DPack\Lib\site-packages\slangtorch\util\compile.py", line 71, in jit_compile _write_ninja_file_and_build_library( File "M:\envs\3DPack\Lib\site-packages\torch\utils\cpp_extension.py", line 1834, in _write_ninja_file_and_build_library _run_ninja_build( File "M:\envs\3DPack\Lib\site-packages\torch\utils\cpp_extension.py", line 2121, in _run_ninja_build

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 -IM:\envs\3DPack\ComfyUI\custom_nodes\ComfyUI-3D-Pack\Gen_3D_Modules\StableFast3D\sf3d -IM:\envs\3DPack\Lib\site-packages\torch\include -IM:\envs\3DPack\Lib\site-packages\torch\include\torch\csrc\api\include -IM:\envs\3DPack\Lib\site-packages\torch\include\TH -IM:\envs\3DPack\Lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\include" -IM:\envs\3DPack\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 M:\envs\3DPack\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.41.34123 for x64 Copyright (C) Microsoft Corporation. All rights reserved.

ninja: build stopped: subcommand failed.