Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not run 'texture_baker_cpp::rasterize' with arguments from the 'CUDA' backend. #39

Open
deanvilgel opened this issue Sep 4, 2024 · 63 comments

Comments

@deanvilgel
Copy link

deanvilgel commented Sep 4, 2024

So I been trying so hard with this cuda backend problem, I intalled cuda 12.1, python 3.10, pytorch 2.4.0 and installed all the requirement without error, but when ever i run run.py this error popup

I was installing all the requirements in conda environment, can this be problem?

NotImplementedError: Could not run 'texture_baker_cpp::rasterize' with arguments from the 'CUDA' backend. This could be because the operator doesn't exist for this backend, or was omitted during the selective/custom build process (if using custom build). If you are a Facebook employee using PyTorch on mobile, please visit https://fburl.com/ptmfixes for possible resolutions. 'texture_baker_cpp::rasterize' is only available for these backends: [CPU, Meta, BackendSelect, Python, FuncTorchDynamicLayerBackMode, Functionalize, Named, Conjugate, Negative, ZeroTensor, ADInplaceOrView, AutogradOther, AutogradCPU, AutogradCUDA, AutogradXLA, AutogradMPS, AutogradXPU, AutogradHPU, AutogradLazy, AutogradMeta, Tracer, AutocastCPU, AutocastXPU, AutocastCUDA, FuncTorchBatched, BatchedNestedTensor, FuncTorchVmapMode, Batched, VmapMode, FuncTorchGradWrapper, PythonTLSSnapshot, FuncTorchDynamicLayerFrontMode, PreDispatch, PythonDispatcher].

@jammm
Copy link
Contributor

jammm commented Sep 4, 2024

It appears as if the CUDA extension wasn't compiled. setup.py detects whether your machine supports CUDA or not using torch.cuda.is_available() Did you install the CUDA enabled PyTorch for CUDA 12.1?

It could be the case that conda environment didn't use the CUDA enabled PyTorch, causing torch.cuda.is_available() to return False which prevents the CUDA files from being compiled.

Perhaps you can reinstalling after setting the environment variable USE_CUDA=1 ?

@deanvilgel
Copy link
Author

`import torch, os

print(torch.cuda.is_available())
`
when i ran this code on my environment, it seems to print out true. But since i installed torch on my anaconda environment, I'm not sure setup.py can result same result as this.

`import torch, os

os.environ["USE_CUDA"] = "1"`

i ran this code and did the reinstallationof texture_baker and requirements.txt, which seems to be not working too.

@jammm
Copy link
Contributor

jammm commented Sep 6, 2024

Can you try setting USE_CUDA by running the command export USE_CUDA=1 then pip install ./texture_baker?

@deanvilgel
Copy link
Author

Since I'm using window(maybe i should have mentioned this first. Sorry), I used set instead of export. So I ran

set USE_CUDA=1
pip install ./texture_baker
python run.py demo_files/examples/chair1.png --output-dir output/

but issue persists. maybe this is window related problem?

@jammm
Copy link
Contributor

jammm commented Sep 6, 2024

hmm. Can you try completely deleting the texture_baker/build folder, then re-run the above commands except use pip install -v ./texture_baker (note the -v) ?

Once that's done, share the full output logs of that pip install command here.

@deanvilgel
Copy link
Author

deanvilgel commented Sep 6, 2024

Using pip 24.2 from C:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\lib\site-packages\pip (python 3.10)
Processing c:\users\ersatz-campustown\stable-fast-3d\texture_baker
  Running command python setup.py egg_info
  True
  [<setuptools.extension.Extension('texture_baker._C') at 0x1b54cc48640>]
  running egg_info
  creating C:\Users\ERSATZ-CAMPUSTOWN\AppData\Local\Temp\pip-pip-egg-info-ch6ntkzq\texture_baker.egg-info
  writing C:\Users\ERSATZ-CAMPUSTOWN\AppData\Local\Temp\pip-pip-egg-info-ch6ntkzq\texture_baker.egg-info\PKG-INFO
  writing dependency_links to C:\Users\ERSATZ-CAMPUSTOWN\AppData\Local\Temp\pip-pip-egg-info-ch6ntkzq\texture_baker.egg-info\dependency_links.txt
  writing top-level names to C:\Users\ERSATZ-CAMPUSTOWN\AppData\Local\Temp\pip-pip-egg-info-ch6ntkzq\texture_baker.egg-info\top_level.txt
  writing manifest file 'C:\Users\ERSATZ-CAMPUSTOWN\AppData\Local\Temp\pip-pip-egg-info-ch6ntkzq\texture_baker.egg-info\SOURCES.txt'
  C:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\lib\site-packages\torch\utils\cpp_extension.py:495: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
    warnings.warn(msg.format('we could not find ninja.'))
  reading manifest file 'C:\Users\ERSATZ-CAMPUSTOWN\AppData\Local\Temp\pip-pip-egg-info-ch6ntkzq\texture_baker.egg-info\SOURCES.txt'
  writing manifest file 'C:\Users\ERSATZ-CAMPUSTOWN\AppData\Local\Temp\pip-pip-egg-info-ch6ntkzq\texture_baker.egg-info\SOURCES.txt'
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: texture_baker
  Running command python setup.py bdist_wheel
  True
  [<setuptools.extension.Extension('texture_baker._C') at 0x25c642b98d0>]
  running bdist_wheel
  C:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\lib\site-packages\torch\utils\cpp_extension.py:495: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
    warnings.warn(msg.format('we could not find ninja.'))
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-cpython-310
  creating build\lib.win-amd64-cpython-310\texture_baker
  copying .\texture_baker\baker.py -> build\lib.win-amd64-cpython-310\texture_baker
  copying .\texture_baker\__init__.py -> build\lib.win-amd64-cpython-310\texture_baker
  creating build\lib.win-amd64-cpython-310\texture_baker\csrc
  copying .\texture_baker\csrc\baker.h -> build\lib.win-amd64-cpython-310\texture_baker\csrc     
  copying .\texture_baker\csrc\baker_kernel.metal -> build\lib.win-amd64-cpython-310\texture_baker\csrc
  running build_ext
  C:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\lib\site-packages\torch\utils\cpp_extension.py:380: UserWarning: Error checking compiler version for cl: [WinError 2] 지정된 파일을 찾을  수 없습니다
    warnings.warn(f'Error checking compiler version for {compiler}: {error}')
  building 'texture_baker._C' extension
  creating build\temp.win-amd64-cpython-310
  creating build\temp.win-amd64-cpython-310\Release
  creating build\temp.win-amd64-cpython-310\Release\texture_baker
  creating build\temp.win-amd64-cpython-310\Release\texture_baker\csrc
  "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DTHRUST_IGNORE_CUB_VERSION_CHECK -IC:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\lib\site-packages\torch\include -IC:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\lib\site-packages\torch\include\TH -IC:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\include" -IC:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\include -IC:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\Include "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt" /EHsc /Tptexture_baker\csrc\baker.cpp /Fobuild\temp.win-amd64-cpython-310\Release\texture_baker\csrc\baker.obj /MD /wd4819 /wd4251 /wd4244 /wd4267 /wd4275 /wd4018 /wd4190 /wd4624 /wd4067 /wd4068 /EHsc -O3 -fdiagnostics-color=always -fopenmp -march=native -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 /std:c++17 
  cl : 명령줄 warning D9002 : 알 수 없는 '-O3' 옵션을 무시합니다.
  cl : 명령줄 warning D9002 : 알 수 없는 '-fdiagnostics-color=always' 옵션을 무시합니다.
  cl : 명령줄 warning D9002 : 알 수 없는 '-fopenmp' 옵션을 무시합니다.
  cl : 명령줄 warning D9002 : 알 수 없는 '-march=native' 옵션을 무시합니다.
  baker.cpp
  C:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\lib\site-packages\torch\utils\cpp_extension.py:1965: UserWarning: TORCH_CUDA_ARCH_LIST is not set, all archs for visible cards are included for compilation.
  If this is not desired, please set os.environ['TORCH_CUDA_ARCH_LIST'].
    warnings.warn(
  "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\bin\nvcc" -c texture_baker\csrc\baker_kernel.cu -o build\temp.win-amd64-cpython-310\Release\texture_baker\csrc\baker_kernel.obj -IC:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\lib\site-packages\torch\include -IC:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\lib\site-packages\torch\include\TH -IC:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\include" -IC:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\include -IC:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\Include "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt" -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 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -O3 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 -std=c++17 --use-local-env
  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.
  baker_kernel.cu
  error: command 'C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v12.1\\bin\\nvcc.exe' failed with exit code 2
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> See above for output.

  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: 'C:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\python.exe' -u -c '       
  exec(compile('"'"''"'"''"'"'
  # This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py
  #
  # - It imports setuptools before invoking setup.py, to enable projects that directly
  #   import from `distutils.core` to work with newer packaging standards.
  # - It provides a clear error message when setuptools is not installed.
  # - It sets `sys.argv[0]` to the underlying `setup.py`, when invoking `setup.py` so
  #   setuptools doesn'"'"'t think the script is `-c`. This avoids the following warning:        
  #     manifest_maker: standard file '"'"'-c'"'"' not found".
  # - It generates a shim setup.py, for handling setup.cfg-only projects.
  import os, sys, tokenize

  try:
      import setuptools
  except ImportError as error:
      print(
          "ERROR: Can not execute `setup.py` since setuptools is not available in "
          "the build environment.",
          file=sys.stderr,
      )
      sys.exit(1)

  __file__ = %r
  sys.argv[0] = __file__

  if os.path.exists(__file__):
      filename = __file__
      with tokenize.open(__file__) as f:
          setup_py_code = f.read()
  else:
      filename = "<auto-generated setuptools caller>"
      setup_py_code = "from setuptools import setup; setup()"

  exec(compile(setup_py_code, filename, "exec"))
  '"'"''"'"''"'"' % ('"'"'C:\\Users\\ERSATZ-CAMPUSTOWN\\stable-fast-3d\\texture_baker\\setup.py'"'"',), "<pip-setuptools-caller>", "exec"))' bdist_wheel -d 'C:\Users\ERSATZ-CAMPUSTOWN\AppData\Local\Temp\pip-wheel-gg2o7kzh'
  cwd: C:\Users\ERSATZ-CAMPUSTOWN\stable-fast-3d\texture_baker\\
  Building wheel for texture_baker (setup.py) ... error
  ERROR: Failed building wheel for texture_baker
  Running setup.py clean for texture_baker
  Running command python setup.py clean
  True
  [<setuptools.extension.Extension('texture_baker._C') at 0x1c255979900>]
  running clean
  removing 'build\temp.win-amd64-cpython-310' (and everything under it)
  removing 'build\lib.win-amd64-cpython-310' (and everything under it)
  'build\bdist.win-amd64' does not exist -- can't clean it
  'build\scripts-3.10' does not exist -- can't clean it
  removing 'build'
Failed to build texture_baker
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (texture_baker)

here is the full log. thks for your help

@deanvilgel
Copy link
Author

Ok, I see this error log now.

#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.
  baker_kernel.cu

but i installed and unintalled visual code redist 2022 like 5times, but didn't fix the issue.

I downloaded the vs redist from here.

is there option i need to bare upon or is there other version that i don't know?

@jammm
Copy link
Contributor

jammm commented Sep 6, 2024

Thanks for posting the logs! The issue is likely that you need to install visual studio, not just the redist.
Install visual studio from https://visualstudio.microsoft.com/downloads/ (community version should work fine)

Note that this was mentioned in the README under installation https://github.com/Stability-AI/stable-fast-3d?tab=readme-ov-file#installation
For Windows (experimental): Visual Studio 2022

@deanvilgel
Copy link
Author

actually, visual studio 2022 community version is already installed in my computer. (yes i read readme. no offense). is there some hidden option that i should turn on?

@jammm
Copy link
Contributor

jammm commented Sep 6, 2024

Ah okay, my bad!
Generally when installing Visual Studio was the Desktop development with C++ option checked?
If yes, then I'm not sure what the issue is exactly. How about you retry the above commands but using the Developer Command prompt for VS 2022? It should be available when you search it on the start menu.

@deanvilgel
Copy link
Author

deanvilgel commented Sep 6, 2024

Building wheels for collected packages: texture_baker
  Building wheel for texture_baker (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [54 lines of output]
      [<setuptools.extension.Extension('texture_baker._C') at 0x23c7b9fd8d0>]
      running bdist_wheel
      running build
      running build_py
      creating build\lib.win32-cpython-310
      creating build\lib.win32-cpython-310\texture_baker
      copying .\texture_baker\baker.py -> build\lib.win32-cpython-310\texture_baker
      copying .\texture_baker\__init__.py -> build\lib.win32-cpython-310\texture_baker
      creating build\lib.win32-cpython-310\texture_baker\csrc
      copying .\texture_baker\csrc\baker.h -> build\lib.win32-cpython-310\texture_baker\csrc
      copying .\texture_baker\csrc\baker_kernel.metal -> build\lib.win32-cpython-310\texture_baker\csrc
      running build_ext
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\ERSATZ-CAMPUSTOWN\stable-fast-3d\texture_baker\setup.py", line 109, in <module>
          setup(
        File "C:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\lib\site-packages\setuptools\__init__.py", line 104, in setup
          return distutils.core.setup(**attrs)
        File "C:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\lib\site-packages\setuptools\_distutils\core.py", line 184, in setup
          return run_commands(dist)
        File "C:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\lib\site-packages\setuptools\_distutils\core.py", line 200, in run_commands
          dist.run_commands()
        File "C:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\lib\site-packages\setuptools\_distutils\dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "C:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\lib\site-packages\setuptools\dist.py", line 967, in run_command
          super().run_command(command)
        File "C:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
          cmd_obj.run()
        File "C:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\lib\site-packages\wheel\bdist_wheel.py", line 368, in run
          self.run_command("build")
        File "C:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\lib\site-packages\setuptools\_distutils\cmd.py", line 316, in run_command
          self.distribution.run_command(command)
        File "C:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\lib\site-packages\setuptools\dist.py", line 967, in run_command
          super().run_command(command)
        File "C:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
          cmd_obj.run()
        File "C:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\lib\site-packages\setuptools\_distutils\command\build.py", line 132, in run
          self.run_command(cmd_name)
        File "C:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\lib\site-packages\setuptools\_distutils\cmd.py", line 316, in run_command
          self.distribution.run_command(command)
        File "C:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\lib\site-packages\setuptools\dist.py", line 967, in run_command
          super().run_command(command)
        File "C:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
          cmd_obj.run()
        File "C:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\lib\site-packages\setuptools\command\build_ext.py", line 91, in run
          _build_ext.run(self)
        File "C:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 359, in run
          self.build_extensions()
        File "C:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\lib\site-packages\torch\utils\cpp_extension.py", line 504, in build_extensions
          compiler_name, compiler_version = self._check_abi()
        File "C:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\lib\site-packages\torch\utils\cpp_extension.py", line 896, in _check_abi
          raise UserWarning(msg)
      UserWarning: It seems that the VC environment is activated but DISTUTILS_USE_SDK is not set.This may lead to multiple activations of the VC env.Please set `DISTUTILS_USE_SDK=1` and try again.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for texture_baker
  Running setup.py clean for texture_baker
Failed to build texture_baker
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (texture_baker)

Okay new kind of error pops up when using Developer Command prompt for VS 2022. I don't know i should be happy or not. (I reinstalled vs community edition with Desktop development with C++. which was no use when using conda environment. and I'm pretty sure i checked this option was on when i initially installed. )
I tryed set DISTUTILS_USE_SDK=1 and runned {conda python path } -r requirements.txt but it was no use. I'm doupting there might be problem when setting os environment variables.

maybe tomorrow I will try setting this with resetting conda environment one more time, but when it does not work I will try setting this up in Colab. Thank you sincerely for your help.

@jammm
Copy link
Contributor

jammm commented Sep 6, 2024

Sounds good. It could be conda related, not sure. I've tested it to be working fine without Conda. Perhaps in the future you can try using normal python+pytorch (CUDA 12.1/12.4) with VS2022 installation with a venv if needed.

@sinaiyuc
Copy link

sinaiyuc commented Sep 6, 2024

Hello! I also have this same issue:

NotImplementedError: Could not run 'texture_baker_cpp::rasterize' with arguments from the 'CUDA' backend. This could be because the operator doesn't exist for this backend, or was omitted during the selective/custom build process (if using custom build). If you are a Facebook employee using PyTorch on mobile, please visit https://fburl.com/ptmfixes for possible resolutions. 'texture_baker_cpp::rasterize' is only available for these backends: [CPU, Meta, BackendSelect, Python, FuncTorchDynamicLayerBackMode, Functionalize, Named, Conjugate, Negative, ZeroTensor, ADInplaceOrView, AutogradOther, AutogradCPU, AutogradCUDA, AutogradXLA, AutogradMPS, AutogradXPU, AutogradHPU, AutogradLazy, AutogradMeta, Tracer, AutocastCPU, AutocastCUDA, FuncTorchBatched, BatchedNestedTensor, FuncTorchVmapMode, Batched, VmapMode, FuncTorchGradWrapper, PythonTLSSnapshot, FuncTorchDynamicLayerFrontMode, PreDispatch, PythonDispatcher].

I tried the same steps above and get the following error when building TextureBaker:

`Building wheels for collected packages: texture_baker
Building wheel for texture_baker (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [54 lines of output]
[<setuptools.extension.Extension('texture_baker.C') at 0x1d9d7535cc0>]
running bdist_wheel
running build
running build_py
creating build\lib.win32-cpython-310
creating build\lib.win32-cpython-310\texture_baker
copying .\texture_baker\baker.py -> build\lib.win32-cpython-310\texture_baker
copying .\texture_baker_init
.py -> build\lib.win32-cpython-310\texture_baker
creating build\lib.win32-cpython-310\texture_baker\csrc
copying .\texture_baker\csrc\baker.h -> build\lib.win32-cpython-310\texture_baker\csrc
copying .\texture_baker\csrc\baker_kernel.metal -> build\lib.win32-cpython-310\texture_baker\csrc
running build_ext
Traceback (most recent call last):
File "", line 2, in
File "", line 34, in
File "F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\setup.py", line 109, in
setup(
File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools_init_.py", line 104, in setup
return distutils.core.setup(**attrs)
File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools_distutils\core.py", line 184, in setup
return run_commands(dist)
File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools_distutils\core.py", line 200, in run_commands
dist.run_commands()
File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools_distutils\dist.py", line 969, in run_commands
self.run_command(cmd)
File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\dist.py", line 967, in run_command
super().run_command(command)
File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools_distutils\dist.py", line 988, in run_command
cmd_obj.run()
File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\wheel\bdist_wheel.py", line 364, in run
self.run_command("build")
File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools_distutils\cmd.py", line 316, in run_command
self.distribution.run_command(command)
File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\dist.py", line 967, in run_command
super().run_command(command)
File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools_distutils\dist.py", line 988, in run_command
cmd_obj.run()
File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools_distutils\command\build.py", line 132, in run
self.run_command(cmd_name)
File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools_distutils\cmd.py", line 316, in run_command
self.distribution.run_command(command)
File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\dist.py", line 967, in run_command
super().run_command(command)
File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools_distutils\dist.py", line 988, in run_command
cmd_obj.run()
File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\command\build_ext.py", line 91, in run
_build_ext.run(self)
File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools_distutils\command\build_ext.py", line 359, in run
self.build_extensions()
File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\torch\utils\cpp_extension.py", line 508, in build_extensions
compiler_name, compiler_version = self._check_abi()
File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\torch\utils\cpp_extension.py", line 900, in _check_abi
raise UserWarning(msg)
UserWarning: It seems that the VC environment is activated but DISTUTILS_USE_SDK is not set.This may lead to multiple activations of the VC env.Please set DISTUTILS_USE_SDK=1 and try again.
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for texture_baker
Running setup.py clean for texture_baker
Failed to build texture_baker
ERROR: Could not build wheels for texture_baker, which is required to install pyproject.toml-based projects'

Please let me know how to continue!

Thanks!

I am on a windows machine with a 2080 and VS2022 installed. I did this inside of the Visual Studio 2022 Developer Command Prompt v17.11.2

@jammm
Copy link
Contributor

jammm commented Sep 6, 2024

@sinaiyuc can you try after setting DISTUTILS_USE_SDK=1 environment variable?

@sinaiyuc
Copy link

sinaiyuc commented Sep 6, 2024

Quick update, I set DISTUTILS_USE_SDK=1 and now I get the following error:

Building wheels for collected packages: texture_baker
Building wheel for texture_baker (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [93 lines of output]
[<setuptools.extension.Extension('texture_baker.C') at 0x26149735cc0>]
running bdist_wheel
running build
running build_py
creating build\lib.win32-cpython-310
creating build\lib.win32-cpython-310\texture_baker
copying .\texture_baker\baker.py -> build\lib.win32-cpython-310\texture_baker
copying .\texture_baker_init
.py -> build\lib.win32-cpython-310\texture_baker
creating build\lib.win32-cpython-310\texture_baker\csrc
copying .\texture_baker\csrc\baker.h -> build\lib.win32-cpython-310\texture_baker\csrc
copying .\texture_baker\csrc\baker_kernel.metal -> build\lib.win32-cpython-310\texture_baker\csrc
running build_ext
building 'texture_baker._C' extension
creating F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\build\temp.win32-cpython-310
creating F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\build\temp.win32-cpython-310\Release
creating F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\build\temp.win32-cpython-310\Release\texture_baker
creating F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\build\temp.win32-cpython-310\Release\texture_baker\csrc
Emitting ninja build file F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\build\temp.win32-cpython-310\Release\build.ninja...
Compiling objects...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
[1/1] cl /showIncludes /nologo /O2 /W3 /GL /DNDEBUG /MD /MD /wd4819 /wd4251 /wd4244 /wd4267 /wd4275 /wd4018 /wd4190 /wd4624 /wd4067 /wd4068 /EHsc -IC:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\torch\include -IC:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\torch\include\torch\csrc\api\include -IC:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\torch\include\TH -IC:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\torch\include\THC "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\Include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" -c F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\texture_baker\csrc\baker.cpp /FoF:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\build\temp.win32-cpython-310\Release\texture_baker\csrc\baker.obj -O3 -fdiagnostics-color=always -fopenmp -march=native -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 /std:c++17
FAILED: F:/ComfyFresh/ComfyUI/custom_nodes/stable-fast-3d/texture_baker/build/temp.win32-cpython-310/Release/texture_baker/csrc/baker.obj
cl /showIncludes /nologo /O2 /W3 /GL /DNDEBUG /MD /MD /wd4819 /wd4251 /wd4244 /wd4267 /wd4275 /wd4018 /wd4190 /wd4624 /wd4067 /wd4068 /EHsc -IC:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\torch\include -IC:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\torch\include\torch\csrc\api\include -IC:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\torch\include\TH -IC:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\torch\include\THC "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\Include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" -c F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\texture_baker\csrc\baker.cpp /FoF:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\build\temp.win32-cpython-310\Release\texture_baker\csrc\baker.obj -O3 -fdiagnostics-color=always -fopenmp -march=native -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 /std:c++17
cl : Command line warning D9002 : ignoring unknown option '-O3'
cl : Command line warning D9002 : ignoring unknown option '-fdiagnostics-color=always'
cl : Command line warning D9002 : ignoring unknown option '-fopenmp'
cl : Command line warning D9002 : ignoring unknown option '-march=native'
C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\torch\include\c10/util/safe_numerics.h(23): error C3861: '_addcarry_u64': identifier not found
F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\texture_baker\csrc\baker.cpp(96): error C2181: illegal else without matching if
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\torch\utils\cpp_extension.py", line 2107, in _run_ninja_build
subprocess.run(
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 526, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

  The above exception was the direct cause of the following exception:

  Traceback (most recent call last):
    File "<string>", line 2, in <module>
    File "<pip-setuptools-caller>", line 34, in <module>
    File "F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\setup.py", line 109, in <module>
      setup(
    File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\__init__.py", line 104, in setup
      return distutils.core.setup(**attrs)
    File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\_distutils\core.py", line 184, in setup
      return run_commands(dist)
    File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\_distutils\core.py", line 200, in run_commands
      dist.run_commands()
    File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\_distutils\dist.py", line 969, in run_commands
      self.run_command(cmd)
    File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\dist.py", line 967, in run_command
      super().run_command(command)
    File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
      cmd_obj.run()
    File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\wheel\bdist_wheel.py", line 364, in run
      self.run_command("build")
    File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\_distutils\cmd.py", line 316, in run_command
      self.distribution.run_command(command)
    File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\dist.py", line 967, in run_command
      super().run_command(command)
    File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
      cmd_obj.run()
    File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\_distutils\command\build.py", line 132, in run
      self.run_command(cmd_name)
    File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\_distutils\cmd.py", line 316, in run_command
      self.distribution.run_command(command)
    File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\dist.py", line 967, in run_command
      super().run_command(command)
    File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
      cmd_obj.run()
    File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\command\build_ext.py", line 91, in run
      _build_ext.run(self)
    File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\_distutils\command\build_ext.py", line 359, in run
      self.build_extensions()
    File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\torch\utils\cpp_extension.py", line 870, in build_extensions
      build_ext.build_extensions(self)
    File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\_distutils\command\build_ext.py", line 479, in build_extensions
      self._build_extensions_serial()
    File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\_distutils\command\build_ext.py", line 505, in _build_extensions_serial
      self.build_extension(ext)
    File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\command\build_ext.py", line 252, in build_extension
      _build_ext.build_extension(self, ext)
    File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\_distutils\command\build_ext.py", line 560, in build_extension
      objects = self.compiler.compile(
    File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\torch\utils\cpp_extension.py", line 842, in win_wrap_ninja_compile
      _write_ninja_file_and_compile_objects(
    File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\torch\utils\cpp_extension.py", line 1783, in _write_ninja_file_and_compile_objects
      _run_ninja_build(
    File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\torch\utils\cpp_extension.py", line 2123, in _run_ninja_build
      raise RuntimeError(message) from e
  RuntimeError: Error compiling objects for extension
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for texture_baker
Running setup.py clean for texture_baker
Failed to build texture_baker

@priamai
Copy link

priamai commented Sep 6, 2024

Ubuntu user here.
I have the same problem.
CUDA version: 12.2
Python version: 3.10.12
Torch version: 2.4.1
Ubuntu: 20.04

Python 3.10.12 (main, Jul 29 2024, 16:56:48) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
p>>> print(torch.cuda.is_available())
True

Yes I recompiled also the texture_baker:

$ python run.py demo_files/examples/chair1.png --output-dir output/
Device used:  cuda
/datadrive/stable-fast-3d/sf3d/models/network.py:22: FutureWarning: `torch.cuda.amp.custom_fwd(args...)` is deprecated. Please use `torch.amp.custom_fwd(args..., device_type='cuda')` instead.
  return decorator_with_args(*args, **kwargs)(fn)
/home/priamai/.pyenv/versions/3d/lib/python3.10/site-packages/open_clip/factory.py:128: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
  checkpoint = torch.load(checkpoint_path, map_location=map_location)
  0%|                                                                                                                                                                                                                                                          | 0/1 [00:00<?, ?it/s]After Remesh 9880 19760
/datadrive/stable-fast-3d/sf3d/box_uv_unwrap.py:524: UserWarning: Using torch.cross without specifying the dim arg is deprecated.
Please either pass the dim explicitly or simply use torch.linalg.cross.
The default value of dim will change to agree with that of linalg.cross in a future release. (Triggered internally at ../aten/src/ATen/native/Cross.cpp:62.)
  torch.cross(main_axis, seconday_axis), dim=-1, eps=1e-6
  0%|                                                                                                                                                                                                                                                          | 0/1 [00:01<?, ?it/s]
Traceback (most recent call last):
  File "/datadrive/stable-fast-3d/run.py", line 122, in <module>
    mesh, glob_dict = model.run_image(
  File "/datadrive/stable-fast-3d/sf3d/system.py", line 277, in run_image
    meshes, global_dict = self.generate_mesh(
  File "/datadrive/stable-fast-3d/sf3d/system.py", line 360, in generate_mesh
    rast = self.baker.rasterize(
  File "/home/priamai/.pyenv/versions/3d/lib/python3.10/site-packages/texture_baker/baker.py", line 28, in rasterize
    return torch.ops.texture_baker_cpp.rasterize(
  File "/home/priamai/.pyenv/versions/3d/lib/python3.10/site-packages/torch/_ops.py", line 1061, in __call__
    return self_._op(*args, **(kwargs or {}))
NotImplementedError: Could not run 'texture_baker_cpp::rasterize' with arguments from the 'CUDA' backend. This could be because the operator doesn't exist for this backend, or was omitted during the selective/custom build process (if using custom build). If you are a Facebook employee using PyTorch on mobile, please visit https://fburl.com/ptmfixes for possible resolutions. 'texture_baker_cpp::rasterize' is only available for these backends: [CPU, Meta, BackendSelect, Python, FuncTorchDynamicLayerBackMode, Functionalize, Named, Conjugate, Negative, ZeroTensor, ADInplaceOrView, AutogradOther, AutogradCPU, AutogradCUDA, AutogradXLA, AutogradMPS, AutogradXPU, AutogradHPU, AutogradLazy, AutogradMeta, Tracer, AutocastCPU, AutocastXPU, AutocastCUDA, FuncTorchBatched, BatchedNestedTensor, FuncTorchVmapMode, Batched, VmapMode, FuncTorchGradWrapper, PythonTLSSnapshot, FuncTorchDynamicLayerFrontMode, PreDispatch, PythonDispatcher].

CPU: registered at texture_baker/csrc/baker.cpp:561 [kernel]
Meta: registered at ../aten/src/ATen/core/MetaFallbackKernel.cpp:23 [backend fallback]
BackendSelect: fallthrough registered at ../aten/src/ATen/core/BackendSelectFallbackKernel.cpp:3 [backend fallback]
Python: registered at ../aten/src/ATen/core/PythonFallbackKernel.cpp:153 [backend fallback]
FuncTorchDynamicLayerBackMode: registered at ../aten/src/ATen/functorch/DynamicLayer.cpp:497 [backend fallback]
Functionalize: registered at ../aten/src/ATen/FunctionalizeFallbackKernel.cpp:349 [backend fallback]
Named: registered at ../aten/src/ATen/core/NamedRegistrations.cpp:7 [backend fallback]
Conjugate: registered at ../aten/src/ATen/ConjugateFallback.cpp:17 [backend fallback]
Negative: registered at ../aten/src/ATen/native/NegateFallback.cpp:18 [backend fallback]
ZeroTensor: registered at ../aten/src/ATen/ZeroTensorFallback.cpp:86 [backend fallback]
ADInplaceOrView: fallthrough registered at ../aten/src/ATen/core/VariableFallbackKernel.cpp:86 [backend fallback]
AutogradOther: registered at ../aten/src/ATen/core/VariableFallbackKernel.cpp:53 [backend fallback]
AutogradCPU: registered at ../aten/src/ATen/core/VariableFallbackKernel.cpp:57 [backend fallback]
AutogradCUDA: registered at ../aten/src/ATen/core/VariableFallbackKernel.cpp:65 [backend fallback]
AutogradXLA: registered at ../aten/src/ATen/core/VariableFallbackKernel.cpp:69 [backend fallback]
AutogradMPS: registered at ../aten/src/ATen/core/VariableFallbackKernel.cpp:77 [backend fallback]
AutogradXPU: registered at ../aten/src/ATen/core/VariableFallbackKernel.cpp:61 [backend fallback]
AutogradHPU: registered at ../aten/src/ATen/core/VariableFallbackKernel.cpp:90 [backend fallback]
AutogradLazy: registered at ../aten/src/ATen/core/VariableFallbackKernel.cpp:73 [backend fallback]
AutogradMeta: registered at ../aten/src/ATen/core/VariableFallbackKernel.cpp:81 [backend fallback]
Tracer: registered at ../torch/csrc/autograd/TraceTypeManual.cpp:297 [backend fallback]
AutocastCPU: fallthrough registered at ../aten/src/ATen/autocast_mode.cpp:209 [backend fallback]
AutocastXPU: fallthrough registered at ../aten/src/ATen/autocast_mode.cpp:351 [backend fallback]
AutocastCUDA: fallthrough registered at ../aten/src/ATen/autocast_mode.cpp:165 [backend fallback]
FuncTorchBatched: registered at ../aten/src/ATen/functorch/LegacyBatchingRegistrations.cpp:731 [backend fallback]
BatchedNestedTensor: registered at ../aten/src/ATen/functorch/LegacyBatchingRegistrations.cpp:758 [backend fallback]
FuncTorchVmapMode: fallthrough registered at ../aten/src/ATen/functorch/VmapModeRegistrations.cpp:27 [backend fallback]
Batched: registered at ../aten/src/ATen/LegacyBatchingRegistrations.cpp:1075 [backend fallback]
VmapMode: fallthrough registered at ../aten/src/ATen/VmapModeRegistrations.cpp:33 [backend fallback]
FuncTorchGradWrapper: registered at ../aten/src/ATen/functorch/TensorWrapper.cpp:207 [backend fallback]
PythonTLSSnapshot: registered at ../aten/src/ATen/core/PythonFallbackKernel.cpp:161 [backend fallback]
FuncTorchDynamicLayerFrontMode: registered at ../aten/src/ATen/functorch/DynamicLayer.cpp:493 [backend fallback]
PreDispatch: registered at ../aten/src/ATen/core/PythonFallbackKernel.cpp:165 [backend fallback]
PythonDispatcher: registered at ../aten/src/ATen/core/PythonFallbackKernel.cpp:157 [backend fallback]

Texture baker install:

Processing ./texture_baker
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: texture_baker
  Building wheel for texture_baker (setup.py) ... done
  Created wheel for texture_baker: filename=texture_baker-0.0.1-cp310-cp310-linux_x86_64.whl size=2939729 sha256=e0f5f1a9c5ab1451ec90c6845d9823fb47746239f43c7a11b2c6df6a876d9807
  Stored in directory: /tmp/pip-ephem-wheel-cache-3txkh8ao/wheels/1f/ef/c3/1275bf52702b6616ca38306fd443fec7e6386e250a4513ebdf
Successfully built texture_baker
Installing collected packages: texture_baker
  Attempting uninstall: texture_baker
    Found existing installation: texture_baker 0.0.1
    Uninstalling texture_baker-0.0.1:
      Successfully uninstalled texture_baker-0.0.1
Successfully installed texture_baker-0.0.1

@jammm
Copy link
Contributor

jammm commented Sep 6, 2024

@priamai try export USE_CUDA=1 then pip install -v ./texture_baker

@jammm
Copy link
Contributor

jammm commented Sep 6, 2024

@sinaiyuc try using x64 Native Tools Command Prompt for VS 2022 instead. @deanvilgel I suggest you try this as well. The non-x64 command prompt was probably trying to compile in 32 bit mode.

make sure to set DISTUTILS_USE_SDK=1 as well.

@priamai
Copy link

priamai commented Sep 6, 2024

@priamai try export USE_CUDA=1 then pip install -v ./texture_baker

That's exactly what I did.

@jammm
Copy link
Contributor

jammm commented Sep 6, 2024

@priamai okay. Can you delete the texture_baker/build folder, then try again with pip install -v ./texture_baker and share the build logs?

@sinaiyuc
Copy link

sinaiyuc commented Sep 6, 2024

Progress! Still not fixed though. Update below:

It looks like texture_baker was successfully installed.

pip install -v ./texture_baker
Using pip 24.0 from C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip (python 3.10)
Processing f:\comfyfresh\comfyui\custom_nodes\stable-fast-3d\texture_baker
Running command python setup.py egg_info
[<setuptools.extension.Extension('texture_baker._C') at 0x1c608a35cf0>]
running egg_info
creating C:\Users\Teh1P\AppData\Local\Temp\pip-pip-egg-info-p5odq3og\texture_baker.egg-info
writing C:\Users\Teh1P\AppData\Local\Temp\pip-pip-egg-info-p5odq3og\texture_baker.egg-info\PKG-INFO
writing dependency_links to C:\Users\Teh1P\AppData\Local\Temp\pip-pip-egg-info-p5odq3og\texture_baker.egg-info\dependency_links.txt
writing top-level names to C:\Users\Teh1P\AppData\Local\Temp\pip-pip-egg-info-p5odq3og\texture_baker.egg-info\top_level.txt
writing manifest file 'C:\Users\Teh1P\AppData\Local\Temp\pip-pip-egg-info-p5odq3og\texture_baker.egg-info\SOURCES.txt'
reading manifest file 'C:\Users\Teh1P\AppData\Local\Temp\pip-pip-egg-info-p5odq3og\texture_baker.egg-info\SOURCES.txt'
writing manifest file 'C:\Users\Teh1P\AppData\Local\Temp\pip-pip-egg-info-p5odq3og\texture_baker.egg-info\SOURCES.txt'
Preparing metadata (setup.py) ... done
Building wheels for collected packages: texture_baker
Running command python setup.py bdist_wheel
[<setuptools.extension.Extension('texture_baker.C') at 0x1d195235cc0>]
running bdist_wheel
running build
running build_py
copying .\texture_baker\baker.py -> build\lib.win-amd64-cpython-310\texture_baker
copying .\texture_baker_init
.py -> build\lib.win-amd64-cpython-310\texture_baker
copying .\texture_baker\csrc\baker.h -> build\lib.win-amd64-cpython-310\texture_baker\csrc
copying .\texture_baker\csrc\baker_kernel.metal -> build\lib.win-amd64-cpython-310\texture_baker\csrc
running build_ext
building 'texture_baker._C' extension
Emitting ninja build file F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\build\temp.win-amd64-cpython-310\Release\build.ninja...
Compiling objects...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
ninja: no work to do.
"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\bin\HostX64\x64\link.exe" /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\torch\lib "/LIBPATH:C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\libs" "/LIBPATH:C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0" "/LIBPATH:C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\PCbuild\amd64" "/LIBPATH:C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\ATLMFC\lib\x64" "/LIBPATH:C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\um\x64" c10.lib torch.lib torch_cpu.lib torch_python.lib c10.lib torch.lib torch_cpu.lib torch_python.lib /EXPORT:PyInit__C F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\build\temp.win-amd64-cpython-310\Release\texture_baker\csrc\baker.obj /OUT:build\lib.win-amd64-cpython-310\texture_baker_C.cp310-win_amd64.pyd /IMPLIB:F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\build\temp.win-amd64-cpython-310\Release\texture_baker\csrc_C.cp310-win_amd64.lib
Creating library F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\build\temp.win-amd64-cpython-310\Release\texture_baker\csrc_C.cp310-win_amd64.lib and object F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\build\temp.win-amd64-cpython-310\Release\texture_baker\csrc_C.cp310-win_amd64.exp
Generating code
Finished generating code
C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools_distutils\cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!

      ********************************************************************************
      Please avoid running ``setup.py`` directly.
      Instead, use pypa/build, pypa/installer or other
      standards-based tools.

      See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
      ********************************************************************************

!!
self.initialize_options()
installing to build\bdist.win-amd64\wheel
running install
running install_lib
creating build\bdist.win-amd64\wheel
creating build\bdist.win-amd64\wheel\texture_baker
copying build\lib.win-amd64-cpython-310\texture_baker\baker.py -> build\bdist.win-amd64\wheel.\texture_baker
creating build\bdist.win-amd64\wheel\texture_baker\csrc
copying build\lib.win-amd64-cpython-310\texture_baker\csrc\baker.h -> build\bdist.win-amd64\wheel.\texture_baker\csrc
copying build\lib.win-amd64-cpython-310\texture_baker\csrc\baker_kernel.metal -> build\bdist.win-amd64\wheel.\texture_baker\csrc
copying build\lib.win-amd64-cpython-310\texture_baker_C.cp310-win_amd64.pyd -> build\bdist.win-amd64\wheel.\texture_baker
copying build\lib.win-amd64-cpython-310\texture_baker_init_.py -> build\bdist.win-amd64\wheel.\texture_baker
running install_egg_info
running egg_info
writing texture_baker.egg-info\PKG-INFO
writing dependency_links to texture_baker.egg-info\dependency_links.txt
writing top-level names to texture_baker.egg-info\top_level.txt
reading manifest file 'texture_baker.egg-info\SOURCES.txt'
writing manifest file 'texture_baker.egg-info\SOURCES.txt'
Copying texture_baker.egg-info to build\bdist.win-amd64\wheel.\texture_baker-0.0.1-py3.10.egg-info
running install_scripts
C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\wheel\bdist_wheel.py:109: 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 build\bdist.win-amd64\wheel\texture_baker-0.0.1.dist-info\WHEEL
creating 'C:\Users\Teh1P\AppData\Local\Temp\pip-wheel-1vd21yin\texture_baker-0.0.1-cp310-cp310-win_amd64.whl' and adding 'build\bdist.win-amd64\wheel' to it
adding 'texture_baker/_C.cp310-win_amd64.pyd'
adding 'texture_baker/init.py'
adding 'texture_baker/baker.py'
adding 'texture_baker/csrc/baker.h'
adding 'texture_baker/csrc/baker_kernel.metal'
adding 'texture_baker-0.0.1.dist-info/METADATA'
adding 'texture_baker-0.0.1.dist-info/WHEEL'
adding 'texture_baker-0.0.1.dist-info/top_level.txt'
adding 'texture_baker-0.0.1.dist-info/RECORD'
removing build\bdist.win-amd64\wheel
Building wheel for texture_baker (setup.py) ... done
Created wheel for texture_baker: filename=texture_baker-0.0.1-cp310-cp310-win_amd64.whl size=95900 sha256=37179a8c481bc90eb8060a909d246e94c241ab529e1d5eb7dee701e1ac67d806
Stored in directory: C:\Users\Teh1P\AppData\Local\Temp\pip-ephem-wheel-cache-2j33mmps\wheels\cd\44\c8\b0a7aa6fa8ec6cd0779f86612afec238a66f769873b26e9861
Successfully built texture_baker
Installing collected packages: texture_baker
Attempting uninstall: texture_baker
Found existing installation: texture_baker 0.0.1
Uninstalling texture_baker-0.0.1:
Removing file or directory c:\users\teh1p\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages\texture_baker-0.0.1.dist-info
Removing file or directory c:\users\teh1p\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages\texture_baker
Successfully uninstalled texture_baker-0.0.1
Successfully installed texture_baker-0.0.1

BUT! I am still getting the same error. Here is my output:

`Loaded ViT-B-32 model config.
Loading pretrained ViT-B-32 weights (laion2b_s34b_b79k).
Using Mask
triangle
F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\sf3d\models\tokenizers\dinov2.py:266: UserWarning: 1Torch was not compiled with flash attention. (Triggered internally at ..\aten\src\ATen\native\transformers\cuda\sdp_utils.cpp:455.)
context_layer = F.scaled_dot_product_attention(
Triangle reduction: 1.2201073694485114
After Remesh 10152 20344
F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\sf3d\box_uv_unwrap.py:524: UserWarning: Using torch.cross without specifying the dim arg is deprecated.
Please either pass the dim explicitly or simply use torch.linalg.cross.
The default value of dim will change to agree with that of linalg.cross in a future release. (Triggered internally at ..\aten\src\ATen\native\Cross.cpp:66.)
torch.cross(main_axis, seconday_axis), dim=-1, eps=1e-6
!!! Exception during processing!!! Could not run 'texture_baker_cpp::rasterize' with arguments from the 'CUDA' backend. This could be because the operator doesn't exist for this backend, or was omitted during the selective/custom build process (if using custom build). If you are a Facebook employee using PyTorch on mobile, please visit https://fburl.com/ptmfixes for possible resolutions. 'texture_baker_cpp::rasterize' is only available for these backends: [CPU, Meta, BackendSelect, Python, FuncTorchDynamicLayerBackMode, Functionalize, Named, Conjugate, Negative, ZeroTensor, ADInplaceOrView, AutogradOther, AutogradCPU, AutogradCUDA, AutogradXLA, AutogradMPS, AutogradXPU, AutogradHPU, AutogradLazy, AutogradMeta, Tracer, AutocastCPU, AutocastCUDA, FuncTorchBatched, BatchedNestedTensor, FuncTorchVmapMode, Batched, VmapMode, FuncTorchGradWrapper, PythonTLSSnapshot, FuncTorchDynamicLayerFrontMode, PreDispatch, PythonDispatcher].

CPU: registered at F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\texture_baker\csrc\baker.cpp:561 [kernel]
Meta: registered at ..\aten\src\ATen\core\MetaFallbackKernel.cpp:23 [backend fallback]
BackendSelect: fallthrough registered at ..\aten\src\ATen\core\BackendSelectFallbackKernel.cpp:3 [backend fallback]
Python: registered at ..\aten\src\ATen\core\PythonFallbackKernel.cpp:154 [backend fallback]
FuncTorchDynamicLayerBackMode: registered at ..\aten\src\ATen\functorch\DynamicLayer.cpp:497 [backend fallback]
Functionalize: registered at ..\aten\src\ATen\FunctionalizeFallbackKernel.cpp:324 [backend fallback]
Named: registered at ..\aten\src\ATen\core\NamedRegistrations.cpp:7 [backend fallback]
Conjugate: registered at ..\aten\src\ATen\ConjugateFallback.cpp:17 [backend fallback]
Negative: registered at ..\aten\src\ATen\native\NegateFallback.cpp:18 [backend fallback]
ZeroTensor: registered at ..\aten\src\ATen\ZeroTensorFallback.cpp:86 [backend fallback]
ADInplaceOrView: fallthrough registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:86 [backend fallback]
AutogradOther: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:53 [backend fallback]
AutogradCPU: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:57 [backend fallback]
AutogradCUDA: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:65 [backend fallback]
AutogradXLA: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:69 [backend fallback]
AutogradMPS: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:77 [backend fallback]
AutogradXPU: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:61 [backend fallback]
AutogradHPU: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:90 [backend fallback]
AutogradLazy: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:73 [backend fallback]
AutogradMeta: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:81 [backend fallback]
Tracer: registered at ..\torch\csrc\autograd\TraceTypeManual.cpp:297 [backend fallback]
AutocastCPU: fallthrough registered at ..\aten\src\ATen\autocast_mode.cpp:378 [backend fallback]
AutocastCUDA: fallthrough registered at ..\aten\src\ATen\autocast_mode.cpp:244 [backend fallback]
FuncTorchBatched: registered at ..\aten\src\ATen\functorch\LegacyBatchingRegistrations.cpp:731 [backend fallback]
BatchedNestedTensor: registered at ..\aten\src\ATen\functorch\LegacyBatchingRegistrations.cpp:758 [backend fallback]
FuncTorchVmapMode: fallthrough registered at ..\aten\src\ATen\functorch\VmapModeRegistrations.cpp:27 [backend fallback]
Batched: registered at ..\aten\src\ATen\LegacyBatchingRegistrations.cpp:1075 [backend fallback]
VmapMode: fallthrough registered at ..\aten\src\ATen\VmapModeRegistrations.cpp:33 [backend fallback]
FuncTorchGradWrapper: registered at ..\aten\src\ATen\functorch\TensorWrapper.cpp:202 [backend fallback]
PythonTLSSnapshot: registered at ..\aten\src\ATen\core\PythonFallbackKernel.cpp:162 [backend fallback]
FuncTorchDynamicLayerFrontMode: registered at ..\aten\src\ATen\functorch\DynamicLayer.cpp:493 [backend fallback]
PreDispatch: registered at ..\aten\src\ATen\core\PythonFallbackKernel.cpp:166 [backend fallback]
PythonDispatcher: registered at ..\aten\src\ATen\core\PythonFallbackKernel.cpp:158 [backend fallback]

Traceback (most recent call last):
File "F:\ComfyFresh\ComfyUI\execution.py", line 152, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
File "F:\ComfyFresh\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 "F:\ComfyFresh\ComfyUI\execution.py", line 75, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
File "F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d_init_.py", line 132, in predict
mesh, glob_dict = model.run_image(
File "F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\sf3d\system.py", line 277, in run_image
meshes, global_dict = self.generate_mesh(
File "F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\sf3d\system.py", line 360, in generate_mesh
rast = self.baker.rasterize(
File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\texture_baker\baker.py", line 28, in rasterize
return torch.ops.texture_baker_cpp.rasterize(
File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\torch_ops.py", line 854, in call
return self_._op(*args, **(kwargs or {}))
NotImplementedError: Could not run 'texture_baker_cpp::rasterize' with arguments from the 'CUDA' backend. This could be because the operator doesn't exist for this backend, or was omitted during the selective/custom build process (if using custom build). If you are a Facebook employee using PyTorch on mobile, please visit https://fburl.com/ptmfixes for possible resolutions. 'texture_baker_cpp::rasterize' is only available for these backends: [CPU, Meta, BackendSelect, Python, FuncTorchDynamicLayerBackMode, Functionalize, Named, Conjugate, Negative, ZeroTensor, ADInplaceOrView, AutogradOther, AutogradCPU, AutogradCUDA, AutogradXLA, AutogradMPS, AutogradXPU, AutogradHPU, AutogradLazy, AutogradMeta, Tracer, AutocastCPU, AutocastCUDA, FuncTorchBatched, BatchedNestedTensor, FuncTorchVmapMode, Batched, VmapMode, FuncTorchGradWrapper, PythonTLSSnapshot, FuncTorchDynamicLayerFrontMode, PreDispatch, PythonDispatcher].

CPU: registered at F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\texture_baker\csrc\baker.cpp:561 [kernel]
Meta: registered at ..\aten\src\ATen\core\MetaFallbackKernel.cpp:23 [backend fallback]
BackendSelect: fallthrough registered at ..\aten\src\ATen\core\BackendSelectFallbackKernel.cpp:3 [backend fallback]
Python: registered at ..\aten\src\ATen\core\PythonFallbackKernel.cpp:154 [backend fallback]
FuncTorchDynamicLayerBackMode: registered at ..\aten\src\ATen\functorch\DynamicLayer.cpp:497 [backend fallback]
Functionalize: registered at ..\aten\src\ATen\FunctionalizeFallbackKernel.cpp:324 [backend fallback]
Named: registered at ..\aten\src\ATen\core\NamedRegistrations.cpp:7 [backend fallback]
Conjugate: registered at ..\aten\src\ATen\ConjugateFallback.cpp:17 [backend fallback]
Negative: registered at ..\aten\src\ATen\native\NegateFallback.cpp:18 [backend fallback]
ZeroTensor: registered at ..\aten\src\ATen\ZeroTensorFallback.cpp:86 [backend fallback]
ADInplaceOrView: fallthrough registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:86 [backend fallback]
AutogradOther: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:53 [backend fallback]
AutogradCPU: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:57 [backend fallback]
AutogradCUDA: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:65 [backend fallback]
AutogradXLA: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:69 [backend fallback]
AutogradMPS: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:77 [backend fallback]
AutogradXPU: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:61 [backend fallback]
AutogradHPU: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:90 [backend fallback]
AutogradLazy: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:73 [backend fallback]
AutogradMeta: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:81 [backend fallback]
Tracer: registered at ..\torch\csrc\autograd\TraceTypeManual.cpp:297 [backend fallback]
AutocastCPU: fallthrough registered at ..\aten\src\ATen\autocast_mode.cpp:378 [backend fallback]
AutocastCUDA: fallthrough registered at ..\aten\src\ATen\autocast_mode.cpp:244 [backend fallback]
FuncTorchBatched: registered at ..\aten\src\ATen\functorch\LegacyBatchingRegistrations.cpp:731 [backend fallback]
BatchedNestedTensor: registered at ..\aten\src\ATen\functorch\LegacyBatchingRegistrations.cpp:758 [backend fallback]
FuncTorchVmapMode: fallthrough registered at ..\aten\src\ATen\functorch\VmapModeRegistrations.cpp:27 [backend fallback]
Batched: registered at ..\aten\src\ATen\LegacyBatchingRegistrations.cpp:1075 [backend fallback]
VmapMode: fallthrough registered at ..\aten\src\ATen\VmapModeRegistrations.cpp:33 [backend fallback]
FuncTorchGradWrapper: registered at ..\aten\src\ATen\functorch\TensorWrapper.cpp:202 [backend fallback]
PythonTLSSnapshot: registered at ..\aten\src\ATen\core\PythonFallbackKernel.cpp:162 [backend fallback]
FuncTorchDynamicLayerFrontMode: registered at ..\aten\src\ATen\functorch\DynamicLayer.cpp:493 [backend fallback]
PreDispatch: registered at ..\aten\src\ATen\core\PythonFallbackKernel.cpp:166 [backend fallback]
PythonDispatcher: registered at ..\aten\src\ATen\core\PythonFallbackKernel.cpp:158 [backend fallback]
`

@sinaiyuc
Copy link

sinaiyuc commented Sep 6, 2024

@sinaiyuc try using x64 Native Tools Command Prompt for VS 2022 instead. @deanvilgel I suggest you try this as well. The non-x64 command prompt was probably trying to compile in 32 bit mode.

make sure to set DISTUTILS_USE_SDK=1 as well.

This is what I used btw to get texture_baker to install.

@priamai
Copy link

priamai commented Sep 6, 2024

My logs here

priamai@webui8t4:/datadrive/stable-fast-3d$ pip install -v ./texture_baker > compiler.log
  Running command python setup.py egg_info
  [<setuptools.extension.Extension('texture_baker._C') at 0x7ce15c15d150>]
  running egg_info
  creating /tmp/pip-pip-egg-info-5mkbywld/texture_baker.egg-info
  writing /tmp/pip-pip-egg-info-5mkbywld/texture_baker.egg-info/PKG-INFO
  writing dependency_links to /tmp/pip-pip-egg-info-5mkbywld/texture_baker.egg-info/dependency_links.txt
  writing top-level names to /tmp/pip-pip-egg-info-5mkbywld/texture_baker.egg-info/top_level.txt
  writing manifest file '/tmp/pip-pip-egg-info-5mkbywld/texture_baker.egg-info/SOURCES.txt'
  /home/priamai/.pyenv/versions/3d/lib/python3.10/site-packages/torch/utils/cpp_extension.py:495: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
    warnings.warn(msg.format('we could not find ninja.'))
  reading manifest file '/tmp/pip-pip-egg-info-5mkbywld/texture_baker.egg-info/SOURCES.txt'
  writing manifest file '/tmp/pip-pip-egg-info-5mkbywld/texture_baker.egg-info/SOURCES.txt'
  Running command python setup.py bdist_wheel
  [<setuptools.extension.Extension('texture_baker._C') at 0x7b7ba1a5d120>]
  running bdist_wheel
  /home/priamai/.pyenv/versions/3d/lib/python3.10/site-packages/torch/utils/cpp_extension.py:495: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
    warnings.warn(msg.format('we could not find ninja.'))
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-cpython-310
  creating build/lib.linux-x86_64-cpython-310/texture_baker
  copying ./texture_baker/__init__.py -> build/lib.linux-x86_64-cpython-310/texture_baker
  copying ./texture_baker/baker.py -> build/lib.linux-x86_64-cpython-310/texture_baker
  creating build/lib.linux-x86_64-cpython-310/texture_baker/csrc
  copying ./texture_baker/csrc/baker.h -> build/lib.linux-x86_64-cpython-310/texture_baker/csrc
  copying ./texture_baker/csrc/baker_kernel.metal -> build/lib.linux-x86_64-cpython-310/texture_baker/csrc
  running build_ext
  building 'texture_baker._C' extension
  creating build/temp.linux-x86_64-cpython-310
  creating build/temp.linux-x86_64-cpython-310/texture_baker
  creating build/temp.linux-x86_64-cpython-310/texture_baker/csrc
  x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/home/priamai/.pyenv/versions/3d/lib/python3.10/site-packages/torch/include -I/home/priamai/.pyenv/versions/3d/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/priamai/.pyenv/versions/3d/lib/python3.10/site-packages/torch/include/TH -I/home/priamai/.pyenv/versions/3d/lib/python3.10/site-packages/torch/include/THC -I/home/priamai/.pyenv/versions/3d/include -I/usr/include/python3.10 -c texture_baker/csrc/baker.cpp -o build/temp.linux-x86_64-cpython-310/texture_baker/csrc/baker.o -O3 -fdiagnostics-color=always -fopenmp -march=native -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++17
  texture_baker/csrc/baker.cpp: In member function ‘void texture_baker_cpp::BVH::build(const texture_baker_cpp::tb_float2*, const texture_baker_cpp::tb_int3*, const int64_t&)’:
  texture_baker/csrc/baker.cpp:239:30: warning: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘const int64_t’ {aka ‘const long int’} [-Wsign-compare]
    239 |         for (size_t i = 0; i < num_indices; ++i)
        |                            ~~^~~~~~~~~~~~~
  x86_64-linux-gnu-g++ -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -g -fwrapv -O2 build/temp.linux-x86_64-cpython-310/texture_baker/csrc/baker.o -L/home/priamai/.pyenv/versions/3d/lib/python3.10/site-packages/torch/lib -L/usr/lib/x86_64-linux-gnu -lc10 -ltorch -ltorch_cpu -ltorch_python -lc10 -ltorch -ltorch_cpu -ltorch_python -o build/lib.linux-x86_64-cpython-310/texture_baker/_C.cpython-310-x86_64-linux-gnu.so
  /home/priamai/.pyenv/versions/3d/lib/python3.10/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
  !!

          ********************************************************************************
          Please avoid running ``setup.py`` directly.
          Instead, use pypa/build, pypa/installer or other
          standards-based tools.

          See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
          ********************************************************************************

  !!
    self.initialize_options()
  installing to build/bdist.linux-x86_64/wheel
  running install
  running install_lib
  creating build/bdist.linux-x86_64
  creating build/bdist.linux-x86_64/wheel
  creating build/bdist.linux-x86_64/wheel/texture_baker
  copying build/lib.linux-x86_64-cpython-310/texture_baker/__init__.py -> build/bdist.linux-x86_64/wheel/texture_baker
  copying build/lib.linux-x86_64-cpython-310/texture_baker/baker.py -> build/bdist.linux-x86_64/wheel/texture_baker
  creating build/bdist.linux-x86_64/wheel/texture_baker/csrc
  copying build/lib.linux-x86_64-cpython-310/texture_baker/csrc/baker.h -> build/bdist.linux-x86_64/wheel/texture_baker/csrc
  copying build/lib.linux-x86_64-cpython-310/texture_baker/csrc/baker_kernel.metal -> build/bdist.linux-x86_64/wheel/texture_baker/csrc
  copying build/lib.linux-x86_64-cpython-310/texture_baker/_C.cpython-310-x86_64-linux-gnu.so -> build/bdist.linux-x86_64/wheel/texture_baker
  running install_egg_info
  running egg_info
  writing texture_baker.egg-info/PKG-INFO
  writing dependency_links to texture_baker.egg-info/dependency_links.txt
  writing top-level names to texture_baker.egg-info/top_level.txt
  reading manifest file 'texture_baker.egg-info/SOURCES.txt'
  writing manifest file 'texture_baker.egg-info/SOURCES.txt'
  Copying texture_baker.egg-info to build/bdist.linux-x86_64/wheel/texture_baker-0.0.1-py3.10.egg-info
  running install_scripts
  creating build/bdist.linux-x86_64/wheel/texture_baker-0.0.1.dist-info/WHEEL
  creating '/tmp/pip-wheel-q08wzni1/texture_baker-0.0.1-cp310-cp310-linux_x86_64.whl' and adding 'build/bdist.linux-x86_64/wheel' to it
  adding 'texture_baker/_C.cpython-310-x86_64-linux-gnu.so'
  adding 'texture_baker/__init__.py'
  adding 'texture_baker/baker.py'
  adding 'texture_baker/csrc/baker.h'
  adding 'texture_baker/csrc/baker_kernel.metal'
  adding 'texture_baker-0.0.1.dist-info/METADATA'
  adding 'texture_baker-0.0.1.dist-info/WHEEL'
  adding 'texture_baker-0.0.1.dist-info/top_level.txt'
  adding 'texture_baker-0.0.1.dist-info/RECORD'
  removing build/bdist.linux-x86_64/wheel

@jammm
Copy link
Contributor

jammm commented Sep 6, 2024

@sinaiyuc it doesn't seem like nvcc was invoked while compiling texture baker. Can you delete the texture_baker/build folder and try again with USE_CUDA=1 ?

@jammm
Copy link
Contributor

jammm commented Sep 6, 2024

@priamai for some reason CUDA isn't being detected by setup.py when you do the pip install. I'm not sure why, but it should definitely call CUDAExtension when you set USE_CUDA=1 explicitly.

How about trying USE_CUDA=1 pip install ./texture_baker ?

@sinaiyuc
Copy link

sinaiyuc commented Sep 6, 2024

I deleted the /build folder and re-installed the texture baker. Here are the logs:

pip install -v ./texture_baker
Using pip 24.0 from C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip (python 3.10)
Processing f:\comfyfresh\comfyui\custom_nodes\stable-fast-3d\texture_baker
Running command python setup.py egg_info
[<setuptools.extension.Extension('texture_baker._C') at 0x21b8a535cc0>]
running egg_info
creating C:\Users\Teh1P\AppData\Local\Temp\pip-pip-egg-info-dco3awsc\texture_baker.egg-info
writing C:\Users\Teh1P\AppData\Local\Temp\pip-pip-egg-info-dco3awsc\texture_baker.egg-info\PKG-INFO
writing dependency_links to C:\Users\Teh1P\AppData\Local\Temp\pip-pip-egg-info-dco3awsc\texture_baker.egg-info\dependency_links.txt
writing top-level names to C:\Users\Teh1P\AppData\Local\Temp\pip-pip-egg-info-dco3awsc\texture_baker.egg-info\top_level.txt
writing manifest file 'C:\Users\Teh1P\AppData\Local\Temp\pip-pip-egg-info-dco3awsc\texture_baker.egg-info\SOURCES.txt'
reading manifest file 'C:\Users\Teh1P\AppData\Local\Temp\pip-pip-egg-info-dco3awsc\texture_baker.egg-info\SOURCES.txt'
writing manifest file 'C:\Users\Teh1P\AppData\Local\Temp\pip-pip-egg-info-dco3awsc\texture_baker.egg-info\SOURCES.txt'
Preparing metadata (setup.py) ... done
Building wheels for collected packages: texture_baker
Running command python setup.py bdist_wheel
[<setuptools.extension.Extension('texture_baker.C') at 0x224af935c90>]
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-cpython-310
creating build\lib.win-amd64-cpython-310\texture_baker
copying .\texture_baker\baker.py -> build\lib.win-amd64-cpython-310\texture_baker
copying .\texture_baker_init
.py -> build\lib.win-amd64-cpython-310\texture_baker
creating build\lib.win-amd64-cpython-310\texture_baker\csrc
copying .\texture_baker\csrc\baker.h -> build\lib.win-amd64-cpython-310\texture_baker\csrc
copying .\texture_baker\csrc\baker_kernel.metal -> build\lib.win-amd64-cpython-310\texture_baker\csrc
running build_ext
building 'texture_baker._C' extension
creating F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\build\temp.win-amd64-cpython-310
creating F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\build\temp.win-amd64-cpython-310\Release
creating F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\build\temp.win-amd64-cpython-310\Release\texture_baker
creating F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\build\temp.win-amd64-cpython-310\Release\texture_baker\csrc
Emitting ninja build file F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\build\temp.win-amd64-cpython-310\Release\build.ninja...
Compiling objects...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
[1/1] cl /showIncludes /nologo /O2 /W3 /GL /DNDEBUG /MD /MD /wd4819 /wd4251 /wd4244 /wd4267 /wd4275 /wd4018 /wd4190 /wd4624 /wd4067 /wd4068 /EHsc -IC:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\torch\include -IC:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\torch\include\torch\csrc\api\include -IC:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\torch\include\TH -IC:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\torch\include\THC "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\Include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" -c F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\texture_baker\csrc\baker.cpp /FoF:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\build\temp.win-amd64-cpython-310\Release\texture_baker\csrc\baker.obj -O3 -fdiagnostics-color=always -fopenmp -march=native -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 /std:c++17
cl : Command line warning D9002 : ignoring unknown option '-O3'
cl : Command line warning D9002 : ignoring unknown option '-fdiagnostics-color=always'
cl : Command line warning D9002 : ignoring unknown option '-fopenmp'
cl : Command line warning D9002 : ignoring unknown option '-march=native'
"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\bin\HostX64\x64\link.exe" /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\torch\lib "/LIBPATH:C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\libs" "/LIBPATH:C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0" "/LIBPATH:C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\PCbuild\amd64" "/LIBPATH:C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\ATLMFC\lib\x64" "/LIBPATH:C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\um\x64" c10.lib torch.lib torch_cpu.lib torch_python.lib c10.lib torch.lib torch_cpu.lib torch_python.lib /EXPORT:PyInit__C F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\build\temp.win-amd64-cpython-310\Release\texture_baker\csrc\baker.obj /OUT:build\lib.win-amd64-cpython-310\texture_baker_C.cp310-win_amd64.pyd /IMPLIB:F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\build\temp.win-amd64-cpython-310\Release\texture_baker\csrc_C.cp310-win_amd64.lib
Creating library F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\build\temp.win-amd64-cpython-310\Release\texture_baker\csrc_C.cp310-win_amd64.lib and object F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\build\temp.win-amd64-cpython-310\Release\texture_baker\csrc_C.cp310-win_amd64.exp
Generating code
Finished generating code
C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools_distutils\cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!

      ********************************************************************************
      Please avoid running ``setup.py`` directly.
      Instead, use pypa/build, pypa/installer or other
      standards-based tools.

      See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
      ********************************************************************************

!!
self.initialize_options()
installing to build\bdist.win-amd64\wheel
running install
running install_lib
creating build\bdist.win-amd64
creating build\bdist.win-amd64\wheel
creating build\bdist.win-amd64\wheel\texture_baker
copying build\lib.win-amd64-cpython-310\texture_baker\baker.py -> build\bdist.win-amd64\wheel.\texture_baker
creating build\bdist.win-amd64\wheel\texture_baker\csrc
copying build\lib.win-amd64-cpython-310\texture_baker\csrc\baker.h -> build\bdist.win-amd64\wheel.\texture_baker\csrc
copying build\lib.win-amd64-cpython-310\texture_baker\csrc\baker_kernel.metal -> build\bdist.win-amd64\wheel.\texture_baker\csrc
copying build\lib.win-amd64-cpython-310\texture_baker_C.cp310-win_amd64.pyd -> build\bdist.win-amd64\wheel.\texture_baker
copying build\lib.win-amd64-cpython-310\texture_baker_init_.py -> build\bdist.win-amd64\wheel.\texture_baker
running install_egg_info
running egg_info
writing texture_baker.egg-info\PKG-INFO
writing dependency_links to texture_baker.egg-info\dependency_links.txt
writing top-level names to texture_baker.egg-info\top_level.txt
reading manifest file 'texture_baker.egg-info\SOURCES.txt'
writing manifest file 'texture_baker.egg-info\SOURCES.txt'
Copying texture_baker.egg-info to build\bdist.win-amd64\wheel.\texture_baker-0.0.1-py3.10.egg-info
running install_scripts
C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\wheel\bdist_wheel.py:109: 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 build\bdist.win-amd64\wheel\texture_baker-0.0.1.dist-info\WHEEL
creating 'C:\Users\Teh1P\AppData\Local\Temp\pip-wheel-i5lt67ev\texture_baker-0.0.1-cp310-cp310-win_amd64.whl' and adding 'build\bdist.win-amd64\wheel' to it
adding 'texture_baker/_C.cp310-win_amd64.pyd'
adding 'texture_baker/init.py'
adding 'texture_baker/baker.py'
adding 'texture_baker/csrc/baker.h'
adding 'texture_baker/csrc/baker_kernel.metal'
adding 'texture_baker-0.0.1.dist-info/METADATA'
adding 'texture_baker-0.0.1.dist-info/WHEEL'
adding 'texture_baker-0.0.1.dist-info/top_level.txt'
adding 'texture_baker-0.0.1.dist-info/RECORD'
removing build\bdist.win-amd64\wheel
Building wheel for texture_baker (setup.py) ... done
Created wheel for texture_baker: filename=texture_baker-0.0.1-cp310-cp310-win_amd64.whl size=95899 sha256=e68693fb557d4bd0e96a26712b6fbc77fcd798384b35d3aa46c8840410f0b849
Stored in directory: C:\Users\Teh1P\AppData\Local\Temp\pip-ephem-wheel-cache-geh7i93p\wheels\cd\44\c8\b0a7aa6fa8ec6cd0779f86612afec238a66f769873b26e9861
Successfully built texture_baker
Installing collected packages: texture_baker
Attempting uninstall: texture_baker
Found existing installation: texture_baker 0.0.1
Uninstalling texture_baker-0.0.1:
Removing file or directory c:\users\teh1p\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages\texture_baker-0.0.1.dist-info
Removing file or directory c:\users\teh1p\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages\texture_baker
Successfully uninstalled texture_baker-0.0.1
Successfully installed texture_baker-0.0.1

@sinaiyuc
Copy link

sinaiyuc commented Sep 6, 2024

Although it still failed :(

python run.py demo_files/examples/chair1.png --output-dir output/
Device used: cuda
2024-09-06 12:21:32.2442621 [E:onnxruntime:Default, provider_bridge_ort.cc:1978 onnxruntime::TryGetProviderInfo_TensorRT] D:\a_work\1\s\onnxruntime\core\session\provider_bridge_ort.cc:1637 onnxruntime::ProviderLibrary::Get [ONNXRuntimeError] : 1 : FAIL : LoadLibrary failed with error 126 "" when trying to load "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\onnxruntime\capi\onnxruntime_providers_tensorrt.dll"

*************** EP Error ***************
EP Error D:\a_work\1\s\onnxruntime\python\onnxruntime_pybind_state.cc:490 onnxruntime::python::RegisterTensorRTPluginsAsCustomOps Please install TensorRT libraries as mentioned in the GPU requirements page, make sure they're in the PATH or LD_LIBRARY_PATH, and that your GPU is supported.
when using ['TensorrtExecutionProvider', 'CUDAExecutionProvider', 'CPUExecutionProvider']
Falling back to ['CUDAExecutionProvider', 'CPUExecutionProvider'] and retrying.


2024-09-06 12:21:32.4575931 [E:onnxruntime:Default, provider_bridge_ort.cc:1992 onnxruntime::TryGetProviderInfo_CUDA] D:\a_work\1\s\onnxruntime\core\session\provider_bridge_ort.cc:1637 onnxruntime::ProviderLibrary::Get [ONNXRuntimeError] : 1 : FAIL : LoadLibrary failed with error 126 "" when trying to load "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\onnxruntime\capi\onnxruntime_providers_cuda.dll"

0%| | 0/1 [00:00<?, ?it/s]F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\sf3d\models\tokenizers\dinov2.py:266: UserWarning: 1Torch was not compiled with flash attention. (Triggered internally at ..\aten\src\ATen\native\transformers\cuda\sdp_utils.cpp:455.)
context_layer = F.scaled_dot_product_attention(
After Remesh 9874 19748
F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\sf3d\box_uv_unwrap.py:524: UserWarning: Using torch.cross without specifying the dim arg is deprecated.
Please either pass the dim explicitly or simply use torch.linalg.cross.
The default value of dim will change to agree with that of linalg.cross in a future release. (Triggered internally at ..\aten\src\ATen\native\Cross.cpp:66.)
torch.cross(main_axis, seconday_axis), dim=-1, eps=1e-6
0%| | 0/1 [00:47<?, ?it/s]
Traceback (most recent call last):
File "F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\run.py", line 122, in
mesh, glob_dict = model.run_image(
File "F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\sf3d\system.py", line 277, in run_image
meshes, global_dict = self.generate_mesh(
File "F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\sf3d\system.py", line 360, in generate_mesh
rast = self.baker.rasterize(
File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\texture_baker\baker.py", line 28, in rasterize
return torch.ops.texture_baker_cpp.rasterize(
File "C:\Users\Teh1P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\torch_ops.py", line 854, in call
return self_._op(*args, **(kwargs or {}))
NotImplementedError: Could not run 'texture_baker_cpp::rasterize' with arguments from the 'CUDA' backend. This could be because the operator doesn't exist for this backend, or was omitted during the selective/custom build process (if using custom build). If you are a Facebook employee using PyTorch on mobile, please visit https://fburl.com/ptmfixes for possible resolutions. 'texture_baker_cpp::rasterize' is only available for these backends: [CPU, Meta, BackendSelect, Python, FuncTorchDynamicLayerBackMode, Functionalize, Named, Conjugate, Negative, ZeroTensor, ADInplaceOrView, AutogradOther, AutogradCPU, AutogradCUDA, AutogradXLA, AutogradMPS, AutogradXPU, AutogradHPU, AutogradLazy, AutogradMeta, Tracer, AutocastCPU, AutocastCUDA, FuncTorchBatched, BatchedNestedTensor, FuncTorchVmapMode, Batched, VmapMode, FuncTorchGradWrapper, PythonTLSSnapshot, FuncTorchDynamicLayerFrontMode, PreDispatch, PythonDispatcher].

CPU: registered at F:\ComfyFresh\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\texture_baker\csrc\baker.cpp:561 [kernel]
Meta: registered at ..\aten\src\ATen\core\MetaFallbackKernel.cpp:23 [backend fallback]
BackendSelect: fallthrough registered at ..\aten\src\ATen\core\BackendSelectFallbackKernel.cpp:3 [backend fallback]
Python: registered at ..\aten\src\ATen\core\PythonFallbackKernel.cpp:154 [backend fallback]
FuncTorchDynamicLayerBackMode: registered at ..\aten\src\ATen\functorch\DynamicLayer.cpp:497 [backend fallback]
Functionalize: registered at ..\aten\src\ATen\FunctionalizeFallbackKernel.cpp:324 [backend fallback]
Named: registered at ..\aten\src\ATen\core\NamedRegistrations.cpp:7 [backend fallback]
Conjugate: registered at ..\aten\src\ATen\ConjugateFallback.cpp:17 [backend fallback]
Negative: registered at ..\aten\src\ATen\native\NegateFallback.cpp:18 [backend fallback]
ZeroTensor: registered at ..\aten\src\ATen\ZeroTensorFallback.cpp:86 [backend fallback]
ADInplaceOrView: fallthrough registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:86 [backend fallback]
AutogradOther: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:53 [backend fallback]
AutogradCPU: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:57 [backend fallback]
AutogradCUDA: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:65 [backend fallback]
AutogradXLA: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:69 [backend fallback]
AutogradMPS: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:77 [backend fallback]
AutogradXPU: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:61 [backend fallback]
AutogradHPU: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:90 [backend fallback]
AutogradLazy: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:73 [backend fallback]
AutogradMeta: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:81 [backend fallback]
Tracer: registered at ..\torch\csrc\autograd\TraceTypeManual.cpp:297 [backend fallback]
AutocastCPU: fallthrough registered at ..\aten\src\ATen\autocast_mode.cpp:378 [backend fallback]
AutocastCUDA: fallthrough registered at ..\aten\src\ATen\autocast_mode.cpp:244 [backend fallback]
FuncTorchBatched: registered at ..\aten\src\ATen\functorch\LegacyBatchingRegistrations.cpp:731 [backend fallback]
BatchedNestedTensor: registered at ..\aten\src\ATen\functorch\LegacyBatchingRegistrations.cpp:758 [backend fallback]
FuncTorchVmapMode: fallthrough registered at ..\aten\src\ATen\functorch\VmapModeRegistrations.cpp:27 [backend fallback]
Batched: registered at ..\aten\src\ATen\LegacyBatchingRegistrations.cpp:1075 [backend fallback]
VmapMode: fallthrough registered at ..\aten\src\ATen\VmapModeRegistrations.cpp:33 [backend fallback]
FuncTorchGradWrapper: registered at ..\aten\src\ATen\functorch\TensorWrapper.cpp:202 [backend fallback]
PythonTLSSnapshot: registered at ..\aten\src\ATen\core\PythonFallbackKernel.cpp:162 [backend fallback]
FuncTorchDynamicLayerFrontMode: registered at ..\aten\src\ATen\functorch\DynamicLayer.cpp:493 [backend fallback]
PreDispatch: registered at ..\aten\src\ATen\core\PythonFallbackKernel.cpp:166 [backend fallback]
PythonDispatcher: registered at ..\aten\src\ATen\core\PythonFallbackKernel.cpp:158 [backend fallback]

@jammm
Copy link
Contributor

jammm commented Sep 6, 2024

@sinaiyuc did you set USE_CUDA=1 ?

@sinaiyuc
Copy link

sinaiyuc commented Sep 6, 2024

@jammm
image

Yeah, I set both things before installing ./texture_baker

@jammm
Copy link
Contributor

jammm commented Sep 7, 2024

@sinaiyuc in that case, it should have executed this code
https://github.com/Stability-AI/stable-fast-3d/blob/main/texture_baker/setup.py#L65-L72
It doesn't seem like it is doing that. Somehow python isn't passing USA_CUDA into setup.py. How about forcing use_cuda = True in this line https://github.com/Stability-AI/stable-fast-3d/blob/main/texture_baker/setup.py#L19 and then trying pip install -v ./texture_baker again? Also delete texture_baker/build just in case.

@jammm
Copy link
Contributor

jammm commented Sep 7, 2024

@priamai interesting. I don't think it's pyenv related as CUDA SDK is generally installed outside of pyenv. Is CUDA_HOME set?
How about changing this line to use_cuda=True and try again? https://github.com/Stability-AI/stable-fast-3d/blob/main/texture_baker/setup.py#L19

@priamai
Copy link

priamai commented Sep 7, 2024

@jammm hello good finding, indeed CUDA_HOME is not set, what shall I do to fix it?

@jammm
Copy link
Contributor

jammm commented Sep 7, 2024

@priamai check if CUDA_PATH is set as well. And if not, set CUDA_HOME/CUDA_PATH to the CUDA installation on your machine. For example, in my machine with CUDA 12.3 installed, CUDA_PATH has been set to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.3. On linux the path would be different however, usually /usr/local/cuda-12.x

@deanvilgel
Copy link
Author

C:\Users\ERSATZ-CAMPUSTOWN\stable-fast-3d>C:/Users/ERSATZ-CAMPUSTOWN/anaconda3/envs/stable-fast/python.exe -m pip install -v ./texture_baker
Using pip 24.2 from C:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\lib\site-packages\pip (python 3.10)
Processing c:\users\ersatz-campustown\stable-fast-3d\texture_baker
  Running command python setup.py egg_info
  [<setuptools.extension.Extension('texture_baker._C') at 0x1c298841900>]
  running egg_info
  creating C:\Users\ERSATZ-CAMPUSTOWN\AppData\Local\Temp\pip-pip-egg-info-xva911k3\texture_baker.egg-info
  writing C:\Users\ERSATZ-CAMPUSTOWN\AppData\Local\Temp\pip-pip-egg-info-xva911k3\texture_baker.egg-info\PKG-INFO
  writing dependency_links to C:\Users\ERSATZ-CAMPUSTOWN\AppData\Local\Temp\pip-pip-egg-info-xva911k3\texture_baker.egg-info\dependency_links.txt
  writing top-level names to C:\Users\ERSATZ-CAMPUSTOWN\AppData\Local\Temp\pip-pip-egg-info-xva911k3\texture_baker.egg-info\top_level.txt
  writing manifest file 'C:\Users\ERSATZ-CAMPUSTOWN\AppData\Local\Temp\pip-pip-egg-info-xva911k3\texture_baker.egg-info\SOURCES.txt'
  reading manifest file 'C:\Users\ERSATZ-CAMPUSTOWN\AppData\Local\Temp\pip-pip-egg-info-xva911k3\texture_baker.egg-info\SOURCES.txt'
  writing manifest file 'C:\Users\ERSATZ-CAMPUSTOWN\AppData\Local\Temp\pip-pip-egg-info-xva911k3\texture_baker.egg-info\SOURCES.txt'
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: texture_baker
  Running command python setup.py bdist_wheel
  [<setuptools.extension.Extension('texture_baker._C') at 0x21c467c18d0>]
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-cpython-310
  creating build\lib.win-amd64-cpython-310\texture_baker
  copying .\texture_baker\baker.py -> build\lib.win-amd64-cpython-310\texture_baker
  copying .\texture_baker\__init__.py -> build\lib.win-amd64-cpython-310\texture_baker
  creating build\lib.win-amd64-cpython-310\texture_baker\csrc
  copying .\texture_baker\csrc\baker.h -> build\lib.win-amd64-cpython-310\texture_baker\csrc
  copying .\texture_baker\csrc\baker_kernel.metal -> build\lib.win-amd64-cpython-310\texture_baker\csrc
  running build_ext
  building 'texture_baker._C' extension
  creating C:\Users\ERSATZ-CAMPUSTOWN\stable-fast-3d\texture_baker\build\temp.win-amd64-cpython-310
  creating C:\Users\ERSATZ-CAMPUSTOWN\stable-fast-3d\texture_baker\build\temp.win-amd64-cpython-310\Release
  creating C:\Users\ERSATZ-CAMPUSTOWN\stable-fast-3d\texture_baker\build\temp.win-amd64-cpython-310\Release\texture_baker
  creating C:\Users\ERSATZ-CAMPUSTOWN\stable-fast-3d\texture_baker\build\temp.win-amd64-cpython-310\Release\texture_baker\csrc
  C:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\lib\site-packages\torch\utils\cpp_extension.py:1965: UserWarning: TORCH_CUDA_ARCH_LIST is not set, all archs for visible cards are included for compilation.
  If this is not desired, please set os.environ['TORCH_CUDA_ARCH_LIST'].
    warnings.warn(
  Emitting ninja build file C:\Users\ERSATZ-CAMPUSTOWN\stable-fast-3d\texture_baker\build\temp.win-amd64-cpython-310\Release\build.ninja...
  Compiling objects...
  Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
  1.11.0
  "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\bin\HostX64\x64\link.exe" /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\lib\site-packages\torch\lib "/LIBPATH:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\lib\x64" /LIBPATH:C:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\libs /LIBPATH:C:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast /LIBPATH:C:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\PCbuild\amd64 "/LIBPATH:C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\ATLMFC\lib\x64" "/LIBPATH:C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\\lib\10.0.22621.0\\um\x64" cudart_static.lib c10_cuda.lib c10.lib torch.lib torch_cpu.lib torch_python.lib c10.lib torch.lib torch_cpu.lib torch_python.lib cudart_static.lib c10_cuda.lib torch_cuda.lib /EXPORT:PyInit__C C:\Users\ERSATZ-CAMPUSTOWN\stable-fast-3d\texture_baker\build\temp.win-amd64-cpython-310\Release\texture_baker\csrc\baker.obj C:\Users\ERSATZ-CAMPUSTOWN\stable-fast-3d\texture_baker\build\temp.win-amd64-cpython-310\Release\texture_baker\csrc\baker_kernel.obj /OUT:build\lib.win-amd64-cpython-310\texture_baker\_C.cp310-win_amd64.pyd /IMPLIB:C:\Users\ERSATZ-CAMPUSTOWN\stable-fast-3d\texture_baker\build\temp.win-amd64-cpython-310\Release\texture_baker\csrc\_C.cp310-win_amd64.lib
  LINK : fatal error LNK1181: 'C:\Users\ERSATZ-CAMPUSTOWN\stable-fast-3d\texture_baker\build\temp.win-amd64-cpython-310\Release\texture_baker\csrc\baker.obj' 입력 파일 을 열 수 없습니다.
  error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.41.34120\\bin\\HostX64\\x64\\link.exe' failed with exit code 1181
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> See above for output.

  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: 'C:\Users\ERSATZ-CAMPUSTOWN\anaconda3\envs\stable-fast\python.exe' -u -c '
  exec(compile('"'"''"'"''"'"'
  # This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py
  #
  # - It imports setuptools before invoking setup.py, to enable projects that directly
  #   import from `distutils.core` to work with newer packaging standards.
  # - It provides a clear error message when setuptools is not installed.
  # - It sets `sys.argv[0]` to the underlying `setup.py`, when invoking `setup.py` so
  #   setuptools doesn'"'"'t think the script is `-c`. This avoids the following warning:
  #     manifest_maker: standard file '"'"'-c'"'"' not found".
  # - It generates a shim setup.py, for handling setup.cfg-only projects.
  import os, sys, tokenize

  try:
      import setuptools
  except ImportError as error:
      print(
          "ERROR: Can not execute `setup.py` since setuptools is not available in "
          "the build environment.",
          file=sys.stderr,
      )
      sys.exit(1)

  __file__ = %r
  sys.argv[0] = __file__

  if os.path.exists(__file__):
      filename = __file__
      with tokenize.open(__file__) as f:
          setup_py_code = f.read()
  else:
      filename = "<auto-generated setuptools caller>"
      setup_py_code = "from setuptools import setup; setup()"

  exec(compile(setup_py_code, filename, "exec"))
  '"'"''"'"''"'"' % ('"'"'C:\\Users\\ERSATZ-CAMPUSTOWN\\stable-fast-3d\\texture_baker\\setup.py'"'"',), "<pip-setuptools-caller>", "exec"))' bdist_wheel -d 'C:\Users\ERSATZ-CAMPUSTOWN\AppData\Local\Temp\pip-wheel-6zzip5dk'
  cwd: C:\Users\ERSATZ-CAMPUSTOWN\stable-fast-3d\texture_baker\\
  Building wheel for texture_baker (setup.py) ... error
  ERROR: Failed building wheel for texture_baker
  Running setup.py clean for texture_baker
  Running command python setup.py clean
  [<setuptools.extension.Extension('texture_baker._C') at 0x1e0f7f91900>]
  running clean
  removing 'build\temp.win-amd64-cpython-310' (and everything under it)
  removing 'build\lib.win-amd64-cpython-310' (and everything under it)
  'build\bdist.win-amd64' does not exist -- can't clean it
  'build\scripts-3.10' does not exist -- can't clean it
  removing 'build'
Failed to build texture_baker
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (texture_baker)

im back on problem and there seems to be another error happening.

i reinstalled vs code and set cuda_home and cuda_path, and ran with x64 native tools command.

any quick guess for the problem are welcomed

@deanvilgel
Copy link
Author

Okay I figured it is happening because there is some indents inside path by this link (its kind of frustrating that i took so long finding out the cause).

seams like C:\Users\ERSATZ-CAMPUSTOWN\stable-fast-3d\texture_baker\build\temp.win-amd64-cpython-310\Release\texture_baker\csrc\baker.obj this has no .obj and more path to it with indent. let me know if you know the fix.

damn window suck so much

@jammm
Copy link
Contributor

jammm commented Sep 11, 2024

Okay I figured it is happening because there is some indents inside path by this link (its kind of frustrating that i took so long finding out the cause).

seams like C:\Users\ERSATZ-CAMPUSTOWN\stable-fast-3d\texture_baker\build\temp.win-amd64-cpython-310\Release\texture_baker\csrc\baker.obj this has no .obj and more path to it with indent. let me know if you know the fix.

damn window suck so much

maybe try deleting the build folder and share the build logs with -v again?

@CurrenWong
Copy link

Okay I figured it is happening because there is some indents inside path by this link (its kind of frustrating that i took so long finding out the cause).
seams like C:\Users\ERSATZ-CAMPUSTOWN\stable-fast-3d\texture_baker\build\temp.win-amd64-cpython-310\Release\texture_baker\csrc\baker.obj this has no .obj and more path to it with indent. let me know if you know the fix.
damn window suck so much

maybe try deleting the build folder and share the build logs with -v again?

I got the same issue, please help to check the log. Thanks!


PS C:\Users\ZCHAWAN4\Downloads> pip install ./texture_baker/ --user -v
Using pip 24.2 from C:\Users\ZCHAWAN4\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip (python 3.11)
Processing c:\users\zchawan4\downloads\texture_baker
  Running command python setup.py egg_info
  [<setuptools.extension.Extension('texture_baker._C') at 0x37d19d0>]
  running egg_info
  creating C:\Users\ZCHAWAN4\AppData\Local\Temp\pip-pip-egg-info-_qs8oub1\texture_baker.egg-info
  writing C:\Users\ZCHAWAN4\AppData\Local\Temp\pip-pip-egg-info-_qs8oub1\texture_baker.egg-info\PKG-INFO
  writing dependency_links to C:\Users\ZCHAWAN4\AppData\Local\Temp\pip-pip-egg-info-_qs8oub1\texture_baker.egg-info\dependency_links.txt
  writing top-level names to C:\Users\ZCHAWAN4\AppData\Local\Temp\pip-pip-egg-info-_qs8oub1\texture_baker.egg-info\top_level.txt
  writing manifest file 'C:\Users\ZCHAWAN4\AppData\Local\Temp\pip-pip-egg-info-_qs8oub1\texture_baker.egg-info\SOURCES.txt'
  reading manifest file 'C:\Users\ZCHAWAN4\AppData\Local\Temp\pip-pip-egg-info-_qs8oub1\texture_baker.egg-info\SOURCES.txt'
  writing manifest file 'C:\Users\ZCHAWAN4\AppData\Local\Temp\pip-pip-egg-info-_qs8oub1\texture_baker.egg-info\SOURCES.txt'
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: texture_baker
  Running command python setup.py bdist_wheel
  [<setuptools.extension.Extension('texture_baker._C') at 0x3821a90>]
  running bdist_wheel
  running build
  running build_py
  creating build\lib.win-amd64-cpython-311\texture_baker
  copying .\texture_baker\baker.py -> build\lib.win-amd64-cpython-311\texture_baker
  copying .\texture_baker\__init__.py -> build\lib.win-amd64-cpython-311\texture_baker
  creating build\lib.win-amd64-cpython-311\texture_baker\csrc
  copying .\texture_baker\csrc\baker.h -> build\lib.win-amd64-cpython-311\texture_baker\csrc
  copying .\texture_baker\csrc\baker_kernel.metal -> build\lib.win-amd64-cpython-311\texture_baker\csrc
  running build_ext
  C:\Users\ZCHAWAN4\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\utils\cpp_extension.py:414: UserWarning: The detected CUDA version (12.4) has a minor version mismatch with the version that was used to compile PyTorch (12.1). Most likely this shouldn't be a problem.
    warnings.warn(CUDA_MISMATCH_WARN.format(cuda_str_version, torch.version.cuda))
  building 'texture_baker._C' extension
  creating C:\Users\ZCHAWAN4\Downloads\texture_baker\build\temp.win-amd64-cpython-311\Release\texture_baker\csrc
  C:\Users\ZCHAWAN4\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\utils\cpp_extension.py:1965: UserWarning: TORCH_CUDA_ARCH_LIST is not set, all archs for visible cards are included for compilation.
  If this is not desired, please set os.environ['TORCH_CUDA_ARCH_LIST'].
    warnings.warn(
  Emitting ninja build file C:\Users\ZCHAWAN4\Downloads\texture_baker\build\temp.win-amd64-cpython-311\Release\build.ninja...
  Compiling objects...
  Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
  1.11.1.git.kitware.jobserver-1
  "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\bin\HostX86\x64\link.exe" /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Users\ZCHAWAN4\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\lib "/LIBPATH:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\lib\x64" /LIBPATH:C:\Users\ZCHAWAN4\AppData\Local\Programs\Python\Python311\libs /LIBPATH:C:\Users\ZCHAWAN4\AppData\Local\Programs\Python\Python311 /LIBPATH:C:\Users\ZCHAWAN4\AppData\Local\Programs\Python\Python311\PCbuild\amd64 "/LIBPATH:C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\ATLMFC\lib\x64" "/LIBPATH:C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.22000.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\\lib\10.0.22000.0\\um\x64" cudart_static.lib c10_cuda.lib c10.lib torch.lib torch_cpu.lib torch_python.lib c10.lib torch.lib torch_cpu.lib torch_python.lib cudart_static.lib c10_cuda.lib torch_cuda.lib /EXPORT:PyInit__C C:\Users\ZCHAWAN4\Downloads\texture_baker\build\temp.win-amd64-cpython-311\Release\texture_baker\csrc\baker.obj C:\Users\ZCHAWAN4\Downloads\texture_baker\build\temp.win-amd64-cpython-311\Release\texture_baker\csrc\baker_kernel.obj /OUT:build\lib.win-amd64-cpython-311\texture_baker\_C.cp311-win_amd64.pyd /IMPLIB:C:\Users\ZCHAWAN4\Downloads\texture_baker\build\temp.win-amd64-cpython-311\Release\texture_baker\csrc\_C.cp311-win_amd64.lib
  LINK : fatal error LNK1181: 无法打开输入文件“C:\Users\ZCHAWAN4\Downloads\texture_baker\build\temp.win-amd64-cpython-311\Release\texture_baker\csrc\baker.obj”
  error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.36.32532\\bin\\HostX86\\x64\\link.exe' failed with exit code 1181
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> See above for output.

  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: 'C:\Users\ZCHAWAN4\AppData\Local\Programs\Python\Python311\python.exe' -u -c '
  exec(compile('"'"''"'"''"'"'
  # This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py
  #
  # - It imports setuptools before invoking setup.py, to enable projects that directly
  #   import from `distutils.core` to work with newer packaging standards.
  # - It provides a clear error message when setuptools is not installed.
  # - It sets `sys.argv[0]` to the underlying `setup.py`, when invoking `setup.py` so
  #   setuptools doesn'"'"'t think the script is `-c`. This avoids the following warning:
  #     manifest_maker: standard file '"'"'-c'"'"' not found".
  # - It generates a shim setup.py, for handling setup.cfg-only projects.
  import os, sys, tokenize

  try:
      import setuptools
  except ImportError as error:
      print(
          "ERROR: Can not execute `setup.py` since setuptools is not available in "
          "the build environment.",
          file=sys.stderr,
      )
      sys.exit(1)

  __file__ = %r
  sys.argv[0] = __file__

  if os.path.exists(__file__):
      filename = __file__
      with tokenize.open(__file__) as f:
          setup_py_code = f.read()
  else:
      filename = "<auto-generated setuptools caller>"
      setup_py_code = "from setuptools import setup; setup()"

  exec(compile(setup_py_code, filename, "exec"))
  '"'"''"'"''"'"' % ('"'"'C:\\Users\\ZCHAWAN4\\Downloads\\texture_baker\\setup.py'"'"',), "<pip-setuptools-caller>", "exec"))' bdist_wheel -d 'C:\Users\ZCHAWAN4\AppData\Local\Temp\pip-wheel-2so762q_'
  cwd: C:\Users\ZCHAWAN4\Downloads\texture_baker\\
  Building wheel for texture_baker (setup.py) ... error
  ERROR: Failed building wheel for texture_baker
  Running setup.py clean for texture_baker
  Running command python setup.py clean
  [<setuptools.extension.Extension('texture_baker._C') at 0x3ed8dc50>]
  running clean
  removing 'build\temp.win-amd64-cpython-311' (and everything under it)
  removing 'build\lib.win-amd64-cpython-311' (and everything under it)
  'build\bdist.win-amd64' does not exist -- can't clean it
  'build\scripts-3.11' does not exist -- can't clean it
  removing 'build'
Failed to build texture_baker
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (texture_baker)

@jammm
Copy link
Contributor

jammm commented Sep 23, 2024

@CurrenWong can you try deleting the texture_baker/build folder then trying again?

@CurrenWong
Copy link

@CurrenWong can you try deleting the texture_baker/build folder then trying again?

Hi @jammm

I didn't find texture_baker/build from my folder.

PS C:\Users\ZCHAWAN4\Downloads\texture_baker> pip install .
Processing c:\users\zchawan4\downloads\texture_baker
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: texture_baker
  Building wheel for texture_baker (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [25 lines of output]
      [<setuptools.extension.Extension('texture_baker._C') at 0x37dac50>]
      running bdist_wheel
      running build
      running build_py
      creating build\lib.win-amd64-cpython-311\texture_baker
      copying .\texture_baker\baker.py -> build\lib.win-amd64-cpython-311\texture_baker
      copying .\texture_baker\__init__.py -> build\lib.win-amd64-cpython-311\texture_baker
      creating build\lib.win-amd64-cpython-311\texture_baker\csrc
      copying .\texture_baker\csrc\baker.h -> build\lib.win-amd64-cpython-311\texture_baker\csrc
      copying .\texture_baker\csrc\baker_kernel.metal -> build\lib.win-amd64-cpython-311\texture_baker\csrc
      running build_ext
      C:\Users\ZCHAWAN4\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\utils\cpp_extension.py:414: UserWarning: The detected CUDA version (12.4) has a minor version mismatch with the version that was used to compile PyTorch (12.1). Most likely this shouldn't be a problem.
        warnings.warn(CUDA_MISMATCH_WARN.format(cuda_str_version, torch.version.cuda))
      building 'texture_baker._C' extension
      creating C:\Users\ZCHAWAN4\Downloads\texture_baker\build\temp.win-amd64-cpython-311\Release\texture_baker\csrc
      C:\Users\ZCHAWAN4\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\utils\cpp_extension.py:1965: UserWarning: TORCH_CUDA_ARCH_LIST is not set, all archs for visible cards are included for compilation.
      If this is not desired, please set os.environ['TORCH_CUDA_ARCH_LIST'].
        warnings.warn(
      Emitting ninja build file C:\Users\ZCHAWAN4\Downloads\texture_baker\build\temp.win-amd64-cpython-311\Release\build.ninja...
      Compiling objects...
      Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
      1.11.1.git.kitware.jobserver-1
      "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\bin\HostX86\x64\link.exe" /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Users\ZCHAWAN4\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\lib "/LIBPATH:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\lib\x64" /LIBPATH:C:\Users\ZCHAWAN4\AppData\Local\Programs\Python\Python311\libs /LIBPATH:C:\Users\ZCHAWAN4\AppData\Local\Programs\Python\Python311 /LIBPATH:C:\Users\ZCHAWAN4\AppData\Local\Programs\Python\Python311\PCbuild\amd64 "/LIBPATH:C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\ATLMFC\lib\x64" "/LIBPATH:C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.22000.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\\lib\10.0.22000.0\\um\x64" cudart_static.lib c10_cuda.lib c10.lib torch.lib torch_cpu.lib torch_python.lib c10.lib torch.lib torch_cpu.lib torch_python.lib cudart_static.lib c10_cuda.lib torch_cuda.lib /EXPORT:PyInit__C C:\Users\ZCHAWAN4\Downloads\texture_baker\build\temp.win-amd64-cpython-311\Release\texture_baker\csrc\baker.obj C:\Users\ZCHAWAN4\Downloads\texture_baker\build\temp.win-amd64-cpython-311\Release\texture_baker\csrc\baker_kernel.obj /OUT:build\lib.win-amd64-cpython-311\texture_baker\_C.cp311-win_amd64.pyd /IMPLIB:C:\Users\ZCHAWAN4\Downloads\texture_baker\build\temp.win-amd64-cpython-311\Release\texture_baker\csrc\_C.cp311-win_amd64.lib
      LINK : fatal error LNK1181: 无法打开输入文件“C:\Users\ZCHAWAN4\Downloads\texture_baker\build\temp.win-amd64-cpython-311\Release\texture_baker\csrc\baker.obj”
      error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.36.32532\\bin\\HostX86\\x64\\link.exe' failed with exit code 1181
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for texture_baker
  Running setup.py clean for texture_baker
Failed to build texture_baker
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (texture_baker)

PS C:\Users\ZCHAWAN4\Downloads\texture_baker> tree /f
Folder PATH listing for volume ZC05N0020J
Volume serial number is B066-73D2
C:.
│   README.md
│   requirements.txt
│   setup.py
│
└───texture_baker
    │   baker.py
    │   __init__.py
    │
    └───csrc
            baker.cpp
            baker.h
            baker_kernel.cu
            baker_kernel.metal
            baker_kernel.mm

@jammm
Copy link
Contributor

jammm commented Sep 23, 2024

That's weird. I wonder if it's a Windows permission issue. Can you try manually creating the texture_baker/build folder and try again?

Also try powershell/command prompt with admin permissions

@CurrenWong
Copy link

That's weird. I wonder if it's a Windows permission issue. Can you try manually creating the texture_baker/build folder and try again?

Also try powershell/command prompt with admin permissions

I serched the problem and someone says reinstall the torch can solve this issue.

It works now. Thanks!

PS C:\Users\ZCHAWAN4\Downloads\texture_baker> pip install .
Processing c:\users\zchawan4\downloads\texture_baker
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: texture_baker
  Building wheel for texture_baker (setup.py) ... done
  Created wheel for texture_baker: filename=texture_baker-0.0.1-cp311-cp311-win_amd64.whl size=158989 sha256=15f16f7c303a03e8cf06ef10818a46ad1af0ddf3c1db0cc21304ef46584d5565
  Stored in directory: C:\Users\ZCHAWAN4\AppData\Local\Temp\pip-ephem-wheel-cache-khdbay10\wheels\bd\0b\06\5b540aed35424846661f32c4f6812d5b0a7b81998d3ae4c565
Successfully built texture_baker
Installing collected packages: texture_baker
Successfully installed texture_baker-0.0.1
PS C:\Users\ZCHAWAN4\Downloads> pip install torch-2.4.1+cu124-cp311-cp311-win_amd64.whl
WARNING: Ignoring invalid distribution ~orch (C:\Users\ZCHAWAN4\AppData\Local\Programs\Python\Python311\Lib\site-packages)
Processing c:\users\zchawan4\downloads\torch-2.4.1+cu124-cp311-cp311-win_amd64.whl
Requirement already satisfied: filelock in c:\users\zchawan4\appdata\local\programs\python\python311\lib\site-packages (from torch==2.4.1+cu124) (3.10.7)
Requirement already satisfied: typing-extensions>=4.8.0 in c:\users\zchawan4\appdata\local\programs\python\python311\lib\site-packages (from torch==2.4.1+cu124) (4.11.0)
Requirement already satisfied: sympy in c:\users\zchawan4\appdata\local\programs\python\python311\lib\site-packages (from torch==2.4.1+cu124) (1.13.2)
Requirement already satisfied: networkx in c:\users\zchawan4\appdata\local\programs\python\python311\lib\site-packages (from torch==2.4.1+cu124) (3.0)
Requirement already satisfied: jinja2 in c:\users\zchawan4\appdata\local\programs\python\python311\lib\site-packages (from torch==2.4.1+cu124) (3.1.2)
Requirement already satisfied: fsspec in c:\users\zchawan4\appdata\local\programs\python\python311\lib\site-packages (from torch==2.4.1+cu124) (2024.9.0)
Requirement already satisfied: MarkupSafe>=2.0 in c:\users\zchawan4\appdata\local\programs\python\python311\lib\site-packages (from jinja2->torch==2.4.1+cu124) (2.1.2)
Requirement already satisfied: mpmath<1.4,>=1.1.0 in c:\users\zchawan4\appdata\local\programs\python\python311\lib\site-packages (from sympy->torch==2.4.1+cu124) (1.3.0)
WARNING: Ignoring invalid distribution ~orch (C:\Users\ZCHAWAN4\AppData\Local\Programs\Python\Python311\Lib\site-packages)
Installing collected packages: torch
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
clip-interrogator 0.6.0 requires torchvision, which is not installed.
open-clip-torch 2.26.1 requires torchvision, which is not installed.
pretrainedmodels 0.7.4 requires torchvision, which is not installed.
segmentation-models-pytorch 0.3.4 requires torchvision>=0.5.0, which is not installed.
spandrel 0.3.4 requires torchvision, which is not installed.
timm 1.0.9 requires torchvision, which is not installed.
ultralytics 8.2.96 requires torchvision>=0.9.0, which is not installed.
segmentation-models-pytorch 0.3.4 requires timm==0.9.7, but you have timm 1.0.9 which is incompatible.
torchaudio 2.4.1+cu121 requires torch==2.4.1+cu121, but you have torch 2.4.1+cu124 which is incompatible.
Successfully installed torch-2.4.1+cu124
PS C:\Users\ZCHAWAN4\Downloads> pip install .\torchvision-0.19.1+cu124-cp311-cp311-win_amd64.whl
Processing c:\users\zchawan4\downloads\torchvision-0.19.1+cu124-cp311-cp311-win_amd64.whl
Requirement already satisfied: numpy in c:\users\zchawan4\appdata\local\programs\python\python311\lib\site-packages (from torchvision==0.19.1+cu124) (1.26.4)
Requirement already satisfied: torch==2.4.1+cu124 in c:\users\zchawan4\appdata\local\programs\python\python311\lib\site-packages (from torchvision==0.19.1+cu124) (2.4.1+cu124)
Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in c:\users\zchawan4\appdata\local\programs\python\python311\lib\site-packages (from torchvision==0.19.1+cu124) (9.4.0)
Requirement already satisfied: filelock in c:\users\zchawan4\appdata\local\programs\python\python311\lib\site-packages (from torch==2.4.1+cu124->torchvision==0.19.1+cu124) (3.10.7)
Requirement already satisfied: typing-extensions>=4.8.0 in c:\users\zchawan4\appdata\local\programs\python\python311\lib\site-packages (from torch==2.4.1+cu124->torchvision==0.19.1+cu124) (4.11.0)
Requirement already satisfied: sympy in c:\users\zchawan4\appdata\local\programs\python\python311\lib\site-packages (from torch==2.4.1+cu124->torchvision==0.19.1+cu124) (1.13.2)
Requirement already satisfied: networkx in c:\users\zchawan4\appdata\local\programs\python\python311\lib\site-packages (from torch==2.4.1+cu124->torchvision==0.19.1+cu124) (3.0)
Requirement already satisfied: jinja2 in c:\users\zchawan4\appdata\local\programs\python\python311\lib\site-packages (from torch==2.4.1+cu124->torchvision==0.19.1+cu124) (3.1.2)
Requirement already satisfied: fsspec in c:\users\zchawan4\appdata\local\programs\python\python311\lib\site-packages (from torch==2.4.1+cu124->torchvision==0.19.1+cu124) (2024.9.0)
Requirement already satisfied: MarkupSafe>=2.0 in c:\users\zchawan4\appdata\local\programs\python\python311\lib\site-packages (from jinja2->torch==2.4.1+cu124->torchvision==0.19.1+cu124) (2.1.2)
Requirement already satisfied: mpmath<1.4,>=1.1.0 in c:\users\zchawan4\appdata\local\programs\python\python311\lib\site-packages (from sympy->torch==2.4.1+cu124->torchvision==0.19.1+cu124) (1.3.0)
Installing collected packages: torchvision
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
segmentation-models-pytorch 0.3.4 requires timm==0.9.7, but you have timm 1.0.9 which is incompatible.
Successfully installed torchvision-0.19.1+cu124
PS C:\Users\ZCHAWAN4\Downloads> pip uninstall torchaudio
Found existing installation: torchaudio 2.4.1+cu121
Uninstalling torchaudio-2.4.1+cu121:
  Would remove:
    c:\users\zchawan4\appdata\local\programs\python\python311\lib\site-packages\torchaudio-2.4.1+cu121.dist-info\*
    c:\users\zchawan4\appdata\local\programs\python\python311\lib\site-packages\torchaudio\*
    c:\users\zchawan4\appdata\local\programs\python\python311\lib\site-packages\torio\*
Proceed (Y/n)? y
  Successfully uninstalled torchaudio-2.4.1+cu121
PS C:\Users\ZCHAWAN4\Downloads> pip install .\torchaudio-2.4.1+cu124-cp311-cp311-win_amd64.whl
Processing c:\users\zchawan4\downloads\torchaudio-2.4.1+cu124-cp311-cp311-win_amd64.whl
Requirement already satisfied: torch==2.4.1+cu124 in c:\users\zchawan4\appdata\local\programs\python\python311\lib\site-packages (from torchaudio==2.4.1+cu124) (2.4.1+cu124)
Requirement already satisfied: filelock in c:\users\zchawan4\appdata\local\programs\python\python311\lib\site-packages (from torch==2.4.1+cu124->torchaudio==2.4.1+cu124) (3.10.7)
Requirement already satisfied: typing-extensions>=4.8.0 in c:\users\zchawan4\appdata\local\programs\python\python311\lib\site-packages (from torch==2.4.1+cu124->torchaudio==2.4.1+cu124) (4.11.0)
Requirement already satisfied: sympy in c:\users\zchawan4\appdata\local\programs\python\python311\lib\site-packages (from torch==2.4.1+cu124->torchaudio==2.4.1+cu124) (1.13.2)
Requirement already satisfied: networkx in c:\users\zchawan4\appdata\local\programs\python\python311\lib\site-packages (from torch==2.4.1+cu124->torchaudio==2.4.1+cu124) (3.0)
Requirement already satisfied: jinja2 in c:\users\zchawan4\appdata\local\programs\python\python311\lib\site-packages (from torch==2.4.1+cu124->torchaudio==2.4.1+cu124) (3.1.2)
Requirement already satisfied: fsspec in c:\users\zchawan4\appdata\local\programs\python\python311\lib\site-packages (from torch==2.4.1+cu124->torchaudio==2.4.1+cu124) (2024.9.0)
Requirement already satisfied: MarkupSafe>=2.0 in c:\users\zchawan4\appdata\local\programs\python\python311\lib\site-packages (from jinja2->torch==2.4.1+cu124->torchaudio==2.4.1+cu124) (2.1.2)
Requirement already satisfied: mpmath<1.4,>=1.1.0 in c:\users\zchawan4\appdata\local\programs\python\python311\lib\site-packages (from sympy->torch==2.4.1+cu124->torchaudio==2.4.1+cu124) (1.3.0)
Installing collected packages: torchaudio
Successfully installed torchaudio-2.4.1+cu124
PS C:\Users\ZCHAWAN4\Downloads> cd .\texture_baker\
PS C:\Users\ZCHAWAN4\Downloads\texture_baker> pip install .
Processing c:\users\zchawan4\downloads\texture_baker
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: texture_baker
  Building wheel for texture_baker (setup.py) ... done
  Created wheel for texture_baker: filename=texture_baker-0.0.1-cp311-cp311-win_amd64.whl size=158989 sha256=15f16f7c303a03e8cf06ef10818a46ad1af0ddf3c1db0cc21304ef46584d5565
  Stored in directory: C:\Users\ZCHAWAN4\AppData\Local\Temp\pip-ephem-wheel-cache-khdbay10\wheels\bd\0b\06\5b540aed35424846661f32c4f6812d5b0a7b81998d3ae4c565
Successfully built texture_baker
Installing collected packages: texture_baker
Successfully installed texture_baker-0.0.1

@janiceylau
Copy link

I am a Red Hat linux user and run into this problem as well. I have set my CUDA_HOME and CUDA_PATH. What else should I do? @jammm @priamai

@jammm
Copy link
Contributor

jammm commented Sep 23, 2024

I am a Red Hat linux user and run into this problem as well. I have set my CUDA_HOME and CUDA_PATH. What else should I do? @jammm @priamai

Can you try setting USE_CUDA=1?

@janiceylau
Copy link

Thanks for your reply! The same error though...

@jammm
Copy link
Contributor

jammm commented Sep 23, 2024

Can you share your build logs?

@janiceylau
Copy link

janiceylau commented Sep 23, 2024

Sure.

Device used: cuda
/net/work/lau/stable-fast-3d/sf3d/models/network.py:22: FutureWarning: torch.cuda.amp.custom_fwd(args...) is deprecated. Please use torch.amp.custom_fwd(args..., device_type='cuda') instead.
return decorator_with_args(*args, **kwargs)(fn)
/homes/math/lau/.conda/envs/sf3d/lib/python3.10/site-packages/open_clip/factory.py:128: FutureWarning: You are using torch.load with weights_only=False (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for weights_only will be flipped to True. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via torch.serialization.add_safe_globals. We recommend you start setting weights_only=True for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
checkpoint = torch.load(checkpoint_path, map_location=map_location)
0%| | 0/1 [00:00<?, ?it/s]After Remesh 8888 17776
0%| | 0/1 [00:00<?, ?it/s]
Traceback (most recent call last):
File "/net/work/lau/stable-fast-3d/run.py", line 122, in
mesh, glob_dict = model.run_image(
File "/net/work/lau/stable-fast-3d/sf3d/system.py", line 287, in run_image
meshes, global_dict = self.generate_mesh(
File "/net/work/lau/stable-fast-3d/sf3d/system.py", line 370, in generate_mesh
rast = self.baker.rasterize(
File "/homes/math/lau/.conda/envs/sf3d/lib/python3.10/site-packages/texture_baker/baker.py", line 28, in rasterize
return torch.ops.texture_baker_cpp.rasterize(
File "/homes/math/lau/.conda/envs/sf3d/lib/python3.10/site-packages/torch/ops.py", line 1061, in call
return self
._op(*args, **(kwargs or {}))
NotImplementedError: Could not run 'texture_baker_cpp::rasterize' with arguments from the 'CUDA' backend. This could be because the operator doesn't exist for this backend, or was omitted during the selective/custom build process (if using custom build). If you are a Facebook employee using PyTorch on mobile, please visit https://fburl.com/ptmfixes for possible resolutions. 'texture_baker_cpp::rasterize' is only available for these backends: [CPU, Meta, BackendSelect, Python, FuncTorchDynamicLayerBackMode, Functionalize, Named, Conjugate, Negative, ZeroTensor, ADInplaceOrView, AutogradOther, AutogradCPU, AutogradCUDA, AutogradXLA, AutogradMPS, AutogradXPU, AutogradHPU, AutogradLazy, AutogradMeta, Tracer, AutocastCPU, AutocastXPU, AutocastCUDA, FuncTorchBatched, BatchedNestedTensor, FuncTorchVmapMode, Batched, VmapMode, FuncTorchGradWrapper, PythonTLSSnapshot, FuncTorchDynamicLayerFrontMode, PreDispatch, PythonDispatcher].

CPU: registered at texture_baker/csrc/baker.cpp:543 [kernel]
Meta: registered at /opt/conda/conda-bld/pytorch_1724789115564/work/aten/src/ATen/core/MetaFallbackKernel.cpp:23 [backend fallback]
BackendSelect: fallthrough registered at /opt/conda/conda-bld/pytorch_1724789115564/work/aten/src/ATen/core/BackendSelectFallbackKernel.cpp:3 [backend fallback]
Python: registered at /opt/conda/conda-bld/pytorch_1724789115564/work/aten/src/ATen/core/PythonFallbackKernel.cpp:153 [backend fallback]
FuncTorchDynamicLayerBackMode: registered at /opt/conda/conda-bld/pytorch_1724789115564/work/aten/src/ATen/functorch/DynamicLayer.cpp:497 [backend fallback]
Functionalize: registered at /opt/conda/conda-bld/pytorch_1724789115564/work/aten/src/ATen/FunctionalizeFallbackKernel.cpp:349 [backend fallback]
Named: registered at /opt/conda/conda-bld/pytorch_1724789115564/work/aten/src/ATen/core/NamedRegistrations.cpp:7 [backend fallback]
Conjugate: registered at /opt/conda/conda-bld/pytorch_1724789115564/work/aten/src/ATen/ConjugateFallback.cpp:17 [backend fallback]
Negative: registered at /opt/conda/conda-bld/pytorch_1724789115564/work/aten/src/ATen/native/NegateFallback.cpp:18 [backend fallback]
ZeroTensor: registered at /opt/conda/conda-bld/pytorch_1724789115564/work/aten/src/ATen/ZeroTensorFallback.cpp:86 [backend fallback]
ADInplaceOrView: fallthrough registered at /opt/conda/conda-bld/pytorch_1724789115564/work/aten/src/ATen/core/VariableFallbackKernel.cpp:86 [backend fallback]
AutogradOther: registered at /opt/conda/conda-bld/pytorch_1724789115564/work/aten/src/ATen/core/VariableFallbackKernel.cpp:53 [backend fallback]
AutogradCPU: registered at /opt/conda/conda-bld/pytorch_1724789115564/work/aten/src/ATen/core/VariableFallbackKernel.cpp:57 [backend fallback]
AutogradCUDA: registered at /opt/conda/conda-bld/pytorch_1724789115564/work/aten/src/ATen/core/VariableFallbackKernel.cpp:65 [backend fallback]
AutogradXLA: registered at /opt/conda/conda-bld/pytorch_1724789115564/work/aten/src/ATen/core/VariableFallbackKernel.cpp:69 [backend fallback]
AutogradMPS: registered at /opt/conda/conda-bld/pytorch_1724789115564/work/aten/src/ATen/core/VariableFallbackKernel.cpp:77 [backend fallback]
AutogradXPU: registered at /opt/conda/conda-bld/pytorch_1724789115564/work/aten/src/ATen/core/VariableFallbackKernel.cpp:61 [backend fallback]
AutogradHPU: registered at /opt/conda/conda-bld/pytorch_1724789115564/work/aten/src/ATen/core/VariableFallbackKernel.cpp:90 [backend fallback]
AutogradLazy: registered at /opt/conda/conda-bld/pytorch_1724789115564/work/aten/src/ATen/core/VariableFallbackKernel.cpp:73 [backend fallback]
AutogradMeta: registered at /opt/conda/conda-bld/pytorch_1724789115564/work/aten/src/ATen/core/VariableFallbackKernel.cpp:81 [backend fallback]
Tracer: registered at /opt/conda/conda-bld/pytorch_1724789115564/work/torch/csrc/autograd/TraceTypeManual.cpp:297 [backend fallback]
AutocastCPU: fallthrough registered at /opt/conda/conda-bld/pytorch_1724789115564/work/aten/src/ATen/autocast_mode.cpp:209 [backend fallback]
AutocastXPU: fallthrough registered at /opt/conda/conda-bld/pytorch_1724789115564/work/aten/src/ATen/autocast_mode.cpp:351 [backend fallback]
AutocastCUDA: fallthrough registered at /opt/conda/conda-bld/pytorch_1724789115564/work/aten/src/ATen/autocast_mode.cpp:165 [backend fallback]
FuncTorchBatched: registered at /opt/conda/conda-bld/pytorch_1724789115564/work/aten/src/ATen/functorch/LegacyBatchingRegistrations.cpp:731 [backend fallback]
BatchedNestedTensor: registered at /opt/conda/conda-bld/pytorch_1724789115564/work/aten/src/ATen/functorch/LegacyBatchingRegistrations.cpp:758 [backend fallback]
FuncTorchVmapMode: fallthrough registered at /opt/conda/conda-bld/pytorch_1724789115564/work/aten/src/ATen/functorch/VmapModeRegistrations.cpp:27 [backend fallback]
Batched: registered at /opt/conda/conda-bld/pytorch_1724789115564/work/aten/src/ATen/LegacyBatchingRegistrations.cpp:1075 [backend fallback]
VmapMode: fallthrough registered at /opt/conda/conda-bld/pytorch_1724789115564/work/aten/src/ATen/VmapModeRegistrations.cpp:33 [backend fallback]
FuncTorchGradWrapper: registered at /opt/conda/conda-bld/pytorch_1724789115564/work/aten/src/ATen/functorch/TensorWrapper.cpp:207 [backend fallback]
PythonTLSSnapshot: registered at /opt/conda/conda-bld/pytorch_1724789115564/work/aten/src/ATen/core/PythonFallbackKernel.cpp:161 [backend fallback]
FuncTorchDynamicLayerFrontMode: registered at /opt/conda/conda-bld/pytorch_1724789115564/work/aten/src/ATen/functorch/DynamicLayer.cpp:493 [backend fallback]
PreDispatch: registered at /opt/conda/conda-bld/pytorch_1724789115564/work/aten/src/ATen/core/PythonFallbackKernel.cpp:165 [backend fallback]
PythonDispatcher: registered at /opt/conda/conda-bld/pytorch_1724789115564/work/aten/src/ATen/core/PythonFallbackKernel.cpp:157 [backend fallback]

@jammm
Copy link
Contributor

jammm commented Sep 23, 2024

Can you share the logs when running USE_CUDA=1 pip install -v ./texture_baker ?
Make sure to delete ./texture_baker/build folder

@janiceylau
Copy link

Great! That works. Didn't try this out at the beginning as I thought it didn't work for the other linux user.

@realstevewarner
Copy link

Windows user here. I'm getting the same error installing texture baker.

I've ensured that the CUDA path is set in the environment variables. I've set use_cuda=1. I've deleted the build folder. I've manually created the build folder. I've tried powershell with admin rights. I've disabled my antivirus. I just can't get texture baker to install. Any ideas?

Here's the log from the command prompt.

D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\stable-fast-3d>pip install -v ./texture_baker
Using pip 24.0 from C:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip (python 3.11)
Processing d:\ai\comfyui_windows_portable\comfyui\custom_nodes\stable-fast-3d\texture_baker
Running command python setup.py egg_info
[<setuptools.extension.Extension('texture_baker.C') at 0x2eb0a76e590>]
running egg_info
creating C:\Users\steve\AppData\Local\Temp\pip-pip-egg-info-y8tpa_kl\texture_baker.egg-info
writing C:\Users\steve\AppData\Local\Temp\pip-pip-egg-info-y8tpa_kl\texture_baker.egg-info\PKG-INFO
writing dependency_links to C:\Users\steve\AppData\Local\Temp\pip-pip-egg-info-y8tpa_kl\texture_baker.egg-info\dependency_links.txt
writing top-level names to C:\Users\steve\AppData\Local\Temp\pip-pip-egg-info-y8tpa_kl\texture_baker.egg-info\top_level.txt
writing manifest file 'C:\Users\steve\AppData\Local\Temp\pip-pip-egg-info-y8tpa_kl\texture_baker.egg-info\SOURCES.txt'
reading manifest file 'C:\Users\steve\AppData\Local\Temp\pip-pip-egg-info-y8tpa_kl\texture_baker.egg-info\SOURCES.txt'
writing manifest file 'C:\Users\steve\AppData\Local\Temp\pip-pip-egg-info-y8tpa_kl\texture_baker.egg-info\SOURCES.txt'
Preparing metadata (setup.py) ... done
Building wheels for collected packages: texture_baker
Running command python setup.py bdist_wheel
[<setuptools.extension.Extension('texture_baker.C') at 0x1c9fe8b1f50>]
running bdist_wheel
running build
running build_py
creating build\lib.win-amd64-cpython-311
creating build\lib.win-amd64-cpython-311\texture_baker
copying .\texture_baker\baker.py -> build\lib.win-amd64-cpython-311\texture_baker
copying .\texture_baker_init
.py -> build\lib.win-amd64-cpython-311\texture_baker
creating build\lib.win-amd64-cpython-311\texture_baker\csrc
copying .\texture_baker\csrc\baker.h -> build\lib.win-amd64-cpython-311\texture_baker\csrc
copying .\texture_baker\csrc\baker_kernel.metal -> build\lib.win-amd64-cpython-311\texture_baker\csrc
running build_ext
C:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\utils\cpp_extension.py:380: 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 'texture_baker.C' extension
creating D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\build\temp.win-amd64-cpython-311
creating D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\build\temp.win-amd64-cpython-311\Release
creating D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\build\temp.win-amd64-cpython-311\Release\texture_baker
creating D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\build\temp.win-amd64-cpython-311\Release\texture_baker\csrc
C:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\utils\cpp_extension.py:1965: UserWarning: TORCH_CUDA_ARCH_LIST is not set, all archs for visible cards are included for compilation.
If this is not desired, please set os.environ['TORCH_CUDA_ARCH_LIST'].
warnings.warn(
Emitting ninja build file D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\build\temp.win-amd64-cpython-311\Release\build.ninja...
Compiling objects...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
[1/2] C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin\nvcc --generate-dependencies-with-compile --dependency-output D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\build\temp.win-amd64-cpython-311\Release\texture_baker\csrc\baker_kernel.obj.d -std=c++17 --use-local-env -Xcompiler /MD -Xcompiler /wd4819 -Xcompiler /wd4251 -Xcompiler /wd4244 -Xcompiler /wd4267 -Xcompiler /wd4275 -Xcompiler /wd4018 -Xcompiler /wd4190 -Xcompiler /wd4624 -Xcompiler /wd4067 -Xcompiler /wd4068 -Xcompiler /EHsc -Xcudafe --diag_suppress=base_class_has_different_dll_interface -Xcudafe --diag_suppress=field_without_dll_interface -Xcudafe --diag_suppress=dll_interface_conflict_none_assumed -Xcudafe --diag_suppress=dll_interface_conflict_dllexport_assumed -DTHRUST_IGNORE_CUB_VERSION_CHECK -IC:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\include -IC:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\include\TH -IC:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\include" -IC:\Users\steve\AppData\Local\Programs\Python\Python311\include -IC:\Users\steve\AppData\Local\Programs\Python\Python311\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.41.34120\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" -c D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\texture_baker\csrc\baker_kernel.cu -o D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\build\temp.win-amd64-cpython-311\Release\texture_baker\csrc\baker_kernel.obj -D__CUDA_NO_HALF_OPERATORS
-D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -O3 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_89,code=compute_89 -gencode=arch=compute_89,code=sm_89
FAILED: D:/AI/ComfyUI_windows_portable/ComfyUI/custom_nodes/stable-fast-3d/texture_baker/build/temp.win-amd64-cpython-311/Release/texture_baker/csrc/baker_kernel.obj
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin\nvcc --generate-dependencies-with-compile --dependency-output D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\build\temp.win-amd64-cpython-311\Release\texture_baker\csrc\baker_kernel.obj.d -std=c++17 --use-local-env -Xcompiler /MD -Xcompiler /wd4819 -Xcompiler /wd4251 -Xcompiler /wd4244 -Xcompiler /wd4267 -Xcompiler /wd4275 -Xcompiler /wd4018 -Xcompiler /wd4190 -Xcompiler /wd4624 -Xcompiler /wd4067 -Xcompiler /wd4068 -Xcompiler /EHsc -Xcudafe --diag_suppress=base_class_has_different_dll_interface -Xcudafe --diag_suppress=field_without_dll_interface -Xcudafe --diag_suppress=dll_interface_conflict_none_assumed -Xcudafe --diag_suppress=dll_interface_conflict_dllexport_assumed -DTHRUST_IGNORE_CUB_VERSION_CHECK -IC:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\include -IC:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\include\TH -IC:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\include" -IC:\Users\steve\AppData\Local\Programs\Python\Python311\include -IC:\Users\steve\AppData\Local\Programs\Python\Python311\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.41.34120\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" -c D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\texture_baker\csrc\baker_kernel.cu -o D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\build\temp.win-amd64-cpython-311\Release\texture_baker\csrc\baker_kernel.obj -D__CUDA_NO_HALF_OPERATORS
_ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -O3 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_89,code=compute_89 -gencode=arch=compute_89,code=sm_89
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\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.

baker_kernel.cu

[2/2] cl /showIncludes /nologo /O2 /W3 /GL /DNDEBUG /MD /MD /wd4819 /wd4251 /wd4244 /wd4267 /wd4275 /wd4018 /wd4190 /wd4624 /wd4067 /wd4068 /EHsc -DTHRUST_IGNORE_CUB_VERSION_CHECK -IC:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\include -IC:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\include\TH -IC:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\include" -IC:\Users\steve\AppData\Local\Programs\Python\Python311\include -IC:\Users\steve\AppData\Local\Programs\Python\Python311\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.41.34120\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" -c D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\texture_baker\csrc\baker.cpp /FoD:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\build\temp.win-amd64-cpython-311\Release\texture_baker\csrc\baker.obj -O3 -fdiagnostics-color=always -fopenmp -march=native -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 /std:c++17
cl : Command line warning D9002 : ignoring unknown option '-O3'
cl : Command line warning D9002 : ignoring unknown option '-fdiagnostics-color=always'
cl : Command line warning D9002 : ignoring unknown option '-fopenmp'
cl : Command line warning D9002 : ignoring unknown option '-march=native'
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
File "C:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\utils\cpp_extension.py", line 2105, in _run_ninja_build
subprocess.run(
File "C:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 571, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "", line 2, in
File "", line 34, in
File "D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\setup.py", line 109, in
setup(
File "C:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools_init_.py", line 104, in setup
return distutils.core.setup(**attrs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools_distutils\core.py", line 184, in setup
return run_commands(dist)
^^^^^^^^^^^^^^^^^^
File "C:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools_distutils\core.py", line 200, in run_commands
dist.run_commands()
File "C:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools_distutils\dist.py", line 969, in run_commands
self.run_command(cmd)
File "C:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\dist.py", line 967, in run_command
super().run_command(command)
File "C:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools_distutils\dist.py", line 988, in run_command
cmd_obj.run()
File "C:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\wheel_bdist_wheel.py", line 378, in run
self.run_command("build")
File "C:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools_distutils\cmd.py", line 316, in run_command
self.distribution.run_command(command)
File "C:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\dist.py", line 967, in run_command
super().run_command(command)
File "C:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools_distutils\dist.py", line 988, in run_command
cmd_obj.run()
File "C:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools_distutils\command\build.py", line 132, in run
self.run_command(cmd_name)
File "C:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools_distutils\cmd.py", line 316, in run_command
self.distribution.run_command(command)
File "C:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\dist.py", line 967, in run_command
super().run_command(command)
File "C:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools_distutils\dist.py", line 988, in run_command
cmd_obj.run()
File "C:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\command\build_ext.py", line 91, in run
_build_ext.run(self)
File "C:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools_distutils\command\build_ext.py", line 359, in run
self.build_extensions()
File "C:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\utils\cpp_extension.py", line 866, in build_extensions
build_ext.build_extensions(self)
File "C:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools_distutils\command\build_ext.py", line 479, in build_extensions
self._build_extensions_serial()
File "C:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools_distutils\command\build_ext.py", line 505, in _build_extensions_serial
self.build_extension(ext)
File "C:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\command\build_ext.py", line 252, in build_extension
_build_ext.build_extension(self, ext)
File "C:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools_distutils\command\build_ext.py", line 560, in build_extension
objects = self.compiler.compile(
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\utils\cpp_extension.py", line 838, in win_wrap_ninja_compile
_write_ninja_file_and_compile_objects(
File "C:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\utils\cpp_extension.py", line 1785, in _write_ninja_file_and_compile_objects
_run_ninja_build(
File "C:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\utils\cpp_extension.py", line 2121, in _run_ninja_build
raise RuntimeError(message) from e
RuntimeError: Error compiling objects for extension
error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
full command: 'C:\Users\steve\AppData\Local\Programs\Python\Python311\python.exe' -u -c '
exec(compile('"'"''"'"''"'"'

This is -- a caller that pip uses to run setup.py

- It imports setuptools before invoking setup.py, to enable projects that directly

import from distutils.core to work with newer packaging standards.

- It provides a clear error message when setuptools is not installed.

- It sets sys.argv[0] to the underlying setup.py, when invoking setup.py so

setuptools doesn'"'"'t think the script is -c. This avoids the following warning:

manifest_maker: standard file '"'"'-c'"'"' not found".

- It generates a shim setup.py, for handling setup.cfg-only projects.

import os, sys, tokenize

try:
import setuptools
except ImportError as error:
print(
"ERROR: Can not execute setup.py since setuptools is not available in "
"the build environment.",
file=sys.stderr,
)
sys.exit(1)

file = %r
sys.argv[0] = file

if os.path.exists(file):
filename = file
with tokenize.open(file) as f:
setup_py_code = f.read()
else:
filename = ""
setup_py_code = "from setuptools import setup; setup()"

exec(compile(setup_py_code, filename, "exec"))
'"'"''"'"''"'"' % ('"'"'D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\stable-fast-3d\texture_baker\setup.py'"'"',), "", "exec"))' bdist_wheel -d 'C:\Users\steve\AppData\Local\Temp\pip-wheel-lihkigva'
cwd: D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\stable-fast-3d\texture_baker
Building wheel for texture_baker (setup.py) ... error
ERROR: Failed building wheel for texture_baker
Running setup.py clean for texture_baker
Running command python setup.py clean
[<setuptools.extension.Extension('texture_baker._C') at 0x1997aeb8290>]
running clean
removing 'build\temp.win-amd64-cpython-311' (and everything under it)
removing 'build\lib.win-amd64-cpython-311' (and everything under it)
'build\bdist.win-amd64' does not exist -- can't clean it
'build\scripts-3.11' does not exist -- can't clean it
removing 'build'
Failed to build texture_baker
ERROR: Could not build wheels for texture_baker, which is required to install pyproject.toml-based projects

[notice] A new release of pip is available: 24.0 -> 24.2
[notice] To update, run: python.exe -m pip install --upgrade pip

@jammm
Copy link
Contributor

jammm commented Oct 12, 2024

@realstevewarner the logs you shared indicate an incompatible VS installation:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\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.

You should install VS 2022.

@realstevewarner
Copy link

I have Visual Studio Community 2022 with the C++ option installed as well as Visual Studio Build Tools 2022. Is this not the correct version?

@jammm
Copy link
Contributor

jammm commented Oct 12, 2024

It should be.
how about using x64 Native Tools Command Prompt for VS 2022 and installing?

@realstevewarner
Copy link

It still fails when trying to build the wheel for texture_baker, but at least it gives me a different error than PowerShell.

Here's the log. Seems to be a problem with torch?

d:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\stable-fast-3d>pip install -r requirements.txt
Ignoring rembg: markers 'sys_platform == "darwin"' don't match your environment
Collecting git+https://github.com/vork/[email protected] (from -r requirements.txt (line 11))
Cloning https://github.com/vork/PyNanoInstantMeshes.git (to revision v0.0.3) to c:\users\steve\appdata\local\temp\pip-req-build-3o5sbcbd
Running command git clone --filter=blob:none --quiet https://github.com/vork/PyNanoInstantMeshes.git 'C:\Users\steve\AppData\Local\Temp\pip-req-build-3o5sbcbd'
Resolved https://github.com/vork/PyNanoInstantMeshes.git to commit 753fda26424d4fc11ed09b55bac79f60bd02529d
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... done
Processing d:\ai\comfyui_windows_portable\comfyui\custom_nodes\stable-fast-3d\texture_baker
Preparing metadata (setup.py) ... done
Processing d:\ai\comfyui_windows_portable\comfyui\custom_nodes\stable-fast-3d\uv_unwrapper
Preparing metadata (setup.py) ... done
Collecting einops==0.7.0 (from -r requirements.txt (line 1))
Using cached einops-0.7.0-py3-none-any.whl.metadata (13 kB)
Collecting jaxtyping==0.2.31 (from -r requirements.txt (line 2))
Using cached jaxtyping-0.2.31-py3-none-any.whl.metadata (6.4 kB)
Requirement already satisfied: omegaconf==2.3.0 in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from -r requirements.txt (line 3)) (2.3.0)
Collecting transformers==4.42.3 (from -r requirements.txt (line 4))
Using cached transformers-4.42.3-py3-none-any.whl.metadata (43 kB)
Collecting open_clip_torch==2.24.0 (from -r requirements.txt (line 5))
Using cached open_clip_torch-2.24.0-py3-none-any.whl.metadata (30 kB)
Collecting trimesh==4.4.1 (from -r requirements.txt (line 6))
Using cached trimesh-4.4.1-py3-none-any.whl.metadata (18 kB)
Requirement already satisfied: numpy==1.26.4 in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from -r requirements.txt (line 7)) (1.26.4)
Collecting huggingface-hub==0.23.4 (from -r requirements.txt (line 8))
Using cached huggingface_hub-0.23.4-py3-none-any.whl.metadata (12 kB)
Collecting rembg==2.0.57 (from rembg[gpu]==2.0.57->-r requirements.txt (line 9))
Using cached rembg-2.0.57-py3-none-any.whl.metadata (16 kB)
Collecting gpytoolbox==0.2.0 (from -r requirements.txt (line 12))
Using cached gpytoolbox-0.2.0-cp311-cp311-win_amd64.whl.metadata (9.9 kB)
Requirement already satisfied: typeguard==2.13.3 in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from jaxtyping==0.2.31->-r requirements.txt (line 2)) (2.13.3)
Requirement already satisfied: antlr4-python3-runtime==4.9.* in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from omegaconf==2.3.0->-r requirements.txt (line 3)) (4.9.3)
Requirement already satisfied: PyYAML>=5.1.0 in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from omegaconf==2.3.0->-r requirements.txt (line 3)) (6.0.2)
Requirement already satisfied: filelock in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from transformers==4.42.3->-r requirements.txt (line 4)) (3.16.1)
Requirement already satisfied: packaging>=20.0 in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from transformers==4.42.3->-r requirements.txt (line 4)) (24.1)
Requirement already satisfied: regex!=2019.12.17 in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from transformers==4.42.3->-r requirements.txt (line 4)) (2024.9.11)
Requirement already satisfied: requests in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from transformers==4.42.3->-r requirements.txt (line 4)) (2.32.3)
Requirement already satisfied: safetensors>=0.4.1 in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from transformers==4.42.3->-r requirements.txt (line 4)) (0.4.5)
Collecting tokenizers<0.20,>=0.19 (from transformers==4.42.3->-r requirements.txt (line 4))
Using cached tokenizers-0.19.1-cp311-none-win_amd64.whl.metadata (6.9 kB)
Requirement already satisfied: tqdm>=4.27 in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from transformers==4.42.3->-r requirements.txt (line 4)) (4.66.5)
Requirement already satisfied: torch>=1.9.0 in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from open_clip_torch==2.24.0->-r requirements.txt (line 5)) (2.4.1+cu118)
Requirement already satisfied: torchvision in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from open_clip_torch==2.24.0->-r requirements.txt (line 5)) (0.19.1+cu118)
Collecting ftfy (from open_clip_torch==2.24.0->-r requirements.txt (line 5))
Using cached ftfy-6.3.0-py3-none-any.whl.metadata (7.1 kB)
Collecting sentencepiece (from open_clip_torch==2.24.0->-r requirements.txt (line 5))
Using cached sentencepiece-0.2.0-cp311-cp311-win_amd64.whl.metadata (8.3 kB)
Requirement already satisfied: protobuf in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from open_clip_torch==2.24.0->-r requirements.txt (line 5)) (5.28.2)
Collecting timm (from open_clip_torch==2.24.0->-r requirements.txt (line 5))
Using cached timm-1.0.9-py3-none-any.whl.metadata (42 kB)
Requirement already satisfied: fsspec>=2023.5.0 in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from huggingface-hub==0.23.4->-r requirements.txt (line 8)) (2024.9.0)
Requirement already satisfied: typing-extensions>=3.7.4.3 in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from huggingface-hub==0.23.4->-r requirements.txt (line 8)) (4.12.2)
Requirement already satisfied: jsonschema in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from rembg==2.0.57->rembg[gpu]==2.0.57->-r requirements.txt (line 9)) (4.23.0)
Requirement already satisfied: onnxruntime in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from rembg==2.0.57->rembg[gpu]==2.0.57->-r requirements.txt (line 9)) (1.19.2)
Requirement already satisfied: opencv-python-headless in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from rembg==2.0.57->rembg[gpu]==2.0.57->-r requirements.txt (line 9)) (4.10.0.84)
Requirement already satisfied: pillow in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from rembg==2.0.57->rembg[gpu]==2.0.57->-r requirements.txt (line 9)) (10.4.0)
Requirement already satisfied: pooch in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from rembg==2.0.57->rembg[gpu]==2.0.57->-r requirements.txt (line 9)) (1.8.2)
Requirement already satisfied: pymatting in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from rembg==2.0.57->rembg[gpu]==2.0.57->-r requirements.txt (line 9)) (1.1.12)
Requirement already satisfied: scikit-image in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from rembg==2.0.57->rembg[gpu]==2.0.57->-r requirements.txt (line 9)) (0.24.0)
Requirement already satisfied: scipy in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from rembg==2.0.57->rembg[gpu]==2.0.57->-r requirements.txt (line 9)) (1.14.1)
Collecting onnxruntime-gpu (from rembg[gpu]==2.0.57->-r requirements.txt (line 9))
Using cached onnxruntime_gpu-1.19.2-cp311-cp311-win_amd64.whl.metadata (4.7 kB)
Requirement already satisfied: sympy in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from torch>=1.9.0->open_clip_torch==2.24.0->-r requirements.txt (line 5)) (1.13.3)
Requirement already satisfied: networkx in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from torch>=1.9.0->open_clip_torch==2.24.0->-r requirements.txt (line 5)) (3.4.1)
Requirement already satisfied: jinja2 in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from torch>=1.9.0->open_clip_torch==2.24.0->-r requirements.txt (line 5)) (3.1.4)
Requirement already satisfied: colorama in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from tqdm>=4.27->transformers==4.42.3->-r requirements.txt (line 4)) (0.4.6)
Collecting wcwidth (from ftfy->open_clip_torch==2.24.0->-r requirements.txt (line 5))
Using cached wcwidth-0.2.13-py2.py3-none-any.whl.metadata (14 kB)
Requirement already satisfied: attrs>=22.2.0 in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from jsonschema->rembg==2.0.57->rembg[gpu]==2.0.57->-r requirements.txt (line 9)) (24.2.0)
Requirement already satisfied: jsonschema-specifications>=2023.03.6 in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from jsonschema->rembg==2.0.57->rembg[gpu]==2.0.57->-r requirements.txt (line 9)) (2024.10.1)
Requirement already satisfied: referencing>=0.28.4 in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from jsonschema->rembg==2.0.57->rembg[gpu]==2.0.57->-r requirements.txt (line 9)) (0.35.1)
Requirement already satisfied: rpds-py>=0.7.1 in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from jsonschema->rembg==2.0.57->rembg[gpu]==2.0.57->-r requirements.txt (line 9)) (0.20.0)
Requirement already satisfied: coloredlogs in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from onnxruntime->rembg==2.0.57->rembg[gpu]==2.0.57->-r requirements.txt (line 9)) (15.0.1)
Requirement already satisfied: flatbuffers in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from onnxruntime->rembg==2.0.57->rembg[gpu]==2.0.57->-r requirements.txt (line 9)) (24.3.25)
Requirement already satisfied: platformdirs>=2.5.0 in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from pooch->rembg==2.0.57->rembg[gpu]==2.0.57->-r requirements.txt (line 9)) (4.3.6)
Requirement already satisfied: charset-normalizer<4,>=2 in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from requests->transformers==4.42.3->-r requirements.txt (line 4)) (3.4.0)
Requirement already satisfied: idna<4,>=2.5 in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from requests->transformers==4.42.3->-r requirements.txt (line 4)) (3.10)
Requirement already satisfied: urllib3<3,>=1.21.1 in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from requests->transformers==4.42.3->-r requirements.txt (line 4)) (2.2.3)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from requests->transformers==4.42.3->-r requirements.txt (line 4)) (2024.8.30)
Requirement already satisfied: numba!=0.49.0 in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from pymatting->rembg==2.0.57->rembg[gpu]==2.0.57->-r requirements.txt (line 9)) (0.60.0)
Requirement already satisfied: imageio>=2.33 in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from scikit-image->rembg==2.0.57->rembg[gpu]==2.0.57->-r requirements.txt (line 9)) (2.35.1)
Requirement already satisfied: tifffile>=2022.8.12 in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from scikit-image->rembg==2.0.57->rembg[gpu]==2.0.57->-r requirements.txt (line 9)) (2024.9.20)
Requirement already satisfied: lazy-loader>=0.4 in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from scikit-image->rembg==2.0.57->rembg[gpu]==2.0.57->-r requirements.txt (line 9)) (0.4)
Requirement already satisfied: llvmlite<0.44,>=0.43.0dev0 in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from numba!=0.49.0->pymatting->rembg==2.0.57->rembg[gpu]==2.0.57->-r requirements.txt (line 9)) (0.43.0)
Requirement already satisfied: humanfriendly>=9.1 in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from coloredlogs->onnxruntime->rembg==2.0.57->rembg[gpu]==2.0.57->-r requirements.txt (line 9)) (10.0)
Requirement already satisfied: MarkupSafe>=2.0 in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from jinja2->torch>=1.9.0->open_clip_torch==2.24.0->-r requirements.txt (line 5)) (2.1.5)
Requirement already satisfied: mpmath<1.4,>=1.1.0 in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from sympy->torch>=1.9.0->open_clip_torch==2.24.0->-r requirements.txt (line 5)) (1.3.0)
Requirement already satisfied: pyreadline3 in c:\users\steve\appdata\local\programs\python\python311\lib\site-packages (from humanfriendly>=9.1->coloredlogs->onnxruntime->rembg==2.0.57->rembg[gpu]==2.0.57->-r requirements.txt (line 9)) (3.5.4)
Using cached einops-0.7.0-py3-none-any.whl (44 kB)
Using cached jaxtyping-0.2.31-py3-none-any.whl (41 kB)
Using cached transformers-4.42.3-py3-none-any.whl (9.3 MB)
Using cached open_clip_torch-2.24.0-py3-none-any.whl (1.5 MB)
Using cached trimesh-4.4.1-py3-none-any.whl (694 kB)
Using cached huggingface_hub-0.23.4-py3-none-any.whl (402 kB)
Using cached rembg-2.0.57-py3-none-any.whl (33 kB)
Using cached gpytoolbox-0.2.0-cp311-cp311-win_amd64.whl (3.5 MB)
Using cached tokenizers-0.19.1-cp311-none-win_amd64.whl (2.2 MB)
Using cached ftfy-6.3.0-py3-none-any.whl (44 kB)
Using cached onnxruntime_gpu-1.19.2-cp311-cp311-win_amd64.whl (226.4 MB)
Using cached sentencepiece-0.2.0-cp311-cp311-win_amd64.whl (991 kB)
Using cached timm-1.0.9-py3-none-any.whl (2.3 MB)
Using cached wcwidth-0.2.13-py2.py3-none-any.whl (34 kB)
Building wheels for collected packages: pynim, texture_baker, uv_unwrapper
Building wheel for pynim (pyproject.toml) ... done
Created wheel for pynim: filename=pynim-0.0.3-cp311-cp311-win_amd64.whl size=1001826 sha256=4da50a8427a55da436f0bd957e48d0c0f356fee10582e8ac363c981d514d47dc
Stored in directory: C:\Users\steve\AppData\Local\Temp\pip-ephem-wheel-cache-7r1vjsn4\wheels\03\7f\05\f3e0d0a4bc3cb3db549c3ade48410db6db9e41a35631510558
Building wheel for texture_baker (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [16 lines of output]
[<setuptools.extension.Extension('texture_baker.C') at 0x18b461ac350>]
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-cpython-311
creating build\lib.win-amd64-cpython-311\texture_baker
copying .\texture_baker\baker.py -> build\lib.win-amd64-cpython-311\texture_baker
copying .\texture_baker_init
.py -> build\lib.win-amd64-cpython-311\texture_baker
creating build\lib.win-amd64-cpython-311\texture_baker\csrc
copying .\texture_baker\csrc\baker.h -> build\lib.win-amd64-cpython-311\texture_baker\csrc
copying .\texture_baker\csrc\baker_kernel.metal -> build\lib.win-amd64-cpython-311\texture_baker\csrc
running build_ext
C:\Users\steve\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\utils\cpp_extension.py:380: 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}')
error: [WinError 2] The system cannot find the file specified
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for texture_baker
Running setup.py clean for texture_baker
Building wheel for uv_unwrapper (setup.py) ... done
Created wheel for uv_unwrapper: filename=uv_unwrapper-0.0.1-cp311-cp311-win_amd64.whl size=112408 sha256=df66dae61980ba23e9cb9a64ecf6f7a757f1c9226cf8671ee7c1019e6956e6ce
Stored in directory: C:\Users\steve\AppData\Local\Temp\pip-ephem-wheel-cache-7r1vjsn4\wheels\b7\3a\be\9ef4ad7c4082c67dfdb21b53ad4c6723efbcef43d1ce9d3f03
Successfully built pynim uv_unwrapper
Failed to build texture_baker
ERROR: Could not build wheels for texture_baker, which is required to install pyproject.toml-based projects

@jammm
Copy link
Contributor

jammm commented Oct 12, 2024

Hmm are you on python 3.11? Maybe try python 3.10 ? That's the python version I'm using.

@realstevewarner
Copy link

I have both 3.11 and 3.10 installed, but 3.11 was my default. I switched my environment variable over to 3.10 and confirmed in the x64 Native Tools Com Prompt for VS 2022 that it sees 3.10 as the default python. I then installed PyTorch, upgraded setuptools and installed wheel. It's still failing.

Building wheels for collected packages: pynim, texture_baker, uv_unwrapper
Building wheel for pynim (pyproject.toml) ... done
Created wheel for pynim: filename=pynim-0.0.3-cp310-cp310-win_amd64.whl size=1001950 sha256=7f5a639dbd340cc1182ed139de02a7f7ae1d9ec325b1e53abe933c0ff1b89ffb
Stored in directory: C:\Users\steve\AppData\Local\Temp\pip-ephem-wheel-cache-qjt83r5c\wheels\6b\27\35\d1d0fa6f1bed575d2c787eb5e541d49c71e88d38346b8d4009
Building wheel for texture_baker (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [16 lines of output]
[<setuptools.extension.Extension('texture_baker.C') at 0x24674b01cc0>]
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-cpython-310
creating build\lib.win-amd64-cpython-310\texture_baker
copying .\texture_baker\baker.py -> build\lib.win-amd64-cpython-310\texture_baker
copying .\texture_baker_init
.py -> build\lib.win-amd64-cpython-310\texture_baker
creating build\lib.win-amd64-cpython-310\texture_baker\csrc
copying .\texture_baker\csrc\baker.h -> build\lib.win-amd64-cpython-310\texture_baker\csrc
copying .\texture_baker\csrc\baker_kernel.metal -> build\lib.win-amd64-cpython-310\texture_baker\csrc
running build_ext
C:\Users\steve\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\utils\cpp_extension.py:380: 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}')
error: [WinError 2] The system cannot find the file specified
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for texture_baker
Running setup.py clean for texture_baker
Building wheel for uv_unwrapper (setup.py) ... done
Created wheel for uv_unwrapper: filename=uv_unwrapper-0.0.1-cp310-cp310-win_amd64.whl size=111145 sha256=d85d92435a466ca5a90ac3296a43d69704a690f4861ae067c1072aebc4b5fd8b
Stored in directory: C:\Users\steve\AppData\Local\Temp\pip-ephem-wheel-cache-qjt83r5c\wheels\60\21\ab\a144efddf4f81a45304b615819d561bdf788e61b54fadedc06
Successfully built pynim uv_unwrapper
Failed to build texture_baker
Installing collected packages: uv_unwrapper, texture_baker, sentencepiece, typeguard, trimesh, pyreadline3, pynim, llvmlite, einops, pooch, numba, jaxtyping, humanfriendly, huggingface-hub, tokenizers, pymatting, gpytoolbox, coloredlogs, transformers, timm, onnxruntime-gpu, onnxruntime, rembg, open_clip_torch
Running setup.py install for texture_baker ... error
error: subprocess-exited-with-error

× Running setup.py install for texture_baker did not run successfully.
│ exit code: 1
╰─> [29 lines of output]
[<setuptools.extension.Extension('texture_baker._C') at 0x27f53521cc0>]
running install
C:\Users\steve\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools_distutils\cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!

          ********************************************************************************
          Please avoid running ``setup.py`` directly.
          Instead, use pypa/build, pypa/installer or other
          standards-based tools.

          See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
          ********************************************************************************

  !!
    self.initialize_options()
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-cpython-310
  creating build\lib.win-amd64-cpython-310\texture_baker
  copying .\texture_baker\baker.py -> build\lib.win-amd64-cpython-310\texture_baker
  copying .\texture_baker\__init__.py -> build\lib.win-amd64-cpython-310\texture_baker
  creating build\lib.win-amd64-cpython-310\texture_baker\csrc
  copying .\texture_baker\csrc\baker.h -> build\lib.win-amd64-cpython-310\texture_baker\csrc
  copying .\texture_baker\csrc\baker_kernel.metal -> build\lib.win-amd64-cpython-310\texture_baker\csrc
  running build_ext
  C:\Users\steve\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\utils\cpp_extension.py:380: 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}')
  error: [WinError 2] The system cannot find the file specified
  [end of output]

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

× Encountered error while trying to install package.
╰─> texture_baker

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

@realstevewarner
Copy link

It looks like an issue with cl. I tried pip install cl but that gave me an error saying that python setup.py egg_info didn't run successfully. I looked that up and it said that it's probably an issue with setuptools or ez_setup. LOL.

@jammm
Copy link
Contributor

jammm commented Oct 12, 2024

Hmm I'm stumped. It could be multiple environments conflicting.
You shouldn't need to do pip install cl. cl.exe is the MSVC compiler which is part of Visual Studio.

Perhaps you could try creating a fresh new venv python3.10 -m venv venv and then source venv/bin/activate then install the requirements from above?

Other than that, I don't know. Ideally it should detect the cl.exe installed on your system. Check to make sure cl.exe is in your PATH when you run the x64 command line tools? This is what python does when checking cl version https://github.com/pytorch/pytorch/blob/main/torch/utils/cpp_extension.py#L407-L414

@jammm
Copy link
Contributor

jammm commented Oct 12, 2024

Perhaps try running the x64 command line tools as admin just in case?

@realstevewarner
Copy link

I'll give those suggestions a try. Greatly appreciate your time and assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants