MrForExample / ComfyUI-3D-Pack

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

ERROR: Failed building wheel for pointnet2-ops #42

Closed jacksoncw2000 closed 6 months ago

jacksoncw2000 commented 6 months ago

I have tried installing this multiple times and keep running into: ERROR: Failed building wheel for pointnet2-ops

I am using miniconda, have a Nvidia 3080, and using Windows 11.

This is my first time creating a GitHub Issue so if I am doing something wrong / need to include specific pieces of information please let me know.

Here is a larger part of the error:

nvcc error   : 'cl.exe' died with status 0xC0000409

      ninja: build stopped: subcommand failed.
      Traceback (most recent call last):
        File "C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_miniconda_env\ComfyUI\Lib\site-packages\torch\utils\cpp_extension.py", line 2096, in _run_ninja_build
          subprocess.run(
        File "C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_miniconda_env\ComfyUI\Lib\subprocess.py", line 571, in run
          raise CalledProcessError(retcode, process.args,
      subprocess.CalledProcessError: Command '['ninja', '-v', '-j', '1']' 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 "C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\tgs\models\snowflake\pointnet2_ops_lib\setup.py", line 22, in <module>
          setup(
        File "C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_miniconda_env\ComfyUI\Lib\site-packages\setuptools\__init__.py", line 103, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_miniconda_env\ComfyUI\Lib\site-packages\setuptools\_distutils\core.py", line 185, in setup
          return run_commands(dist)
                 ^^^^^^^^^^^^^^^^^^
        File "C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_miniconda_env\ComfyUI\Lib\site-packages\setuptools\_distutils\core.py", line 201, in run_commands
          dist.run_commands()
        File "C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_miniconda_env\ComfyUI\Lib\site-packages\setuptools\_distutils\dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_miniconda_env\ComfyUI\Lib\site-packages\setuptools\dist.py", line 989, in run_command
          super().run_command(command)
        File "C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_miniconda_env\ComfyUI\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
          cmd_obj.run()
        File "C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_miniconda_env\ComfyUI\Lib\site-packages\wheel\bdist_wheel.py", line 364, in run
          self.run_command("build")
        File "C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_miniconda_env\ComfyUI\Lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_miniconda_env\ComfyUI\Lib\site-packages\setuptools\dist.py", line 989, in run_command
          super().run_command(command)
        File "C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_miniconda_env\ComfyUI\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
          cmd_obj.run()
        File "C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_miniconda_env\ComfyUI\Lib\site-packages\setuptools\_distutils\command\build.py", line 131, in run
          self.run_command(cmd_name)
        File "C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_miniconda_env\ComfyUI\Lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_miniconda_env\ComfyUI\Lib\site-packages\setuptools\dist.py", line 989, in run_command
          super().run_command(command)
        File "C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_miniconda_env\ComfyUI\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
          cmd_obj.run()
        File "C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_miniconda_env\ComfyUI\Lib\site-packages\setuptools\command\build_ext.py", line 88, in run
          _build_ext.run(self)
        File "C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_miniconda_env\ComfyUI\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 345, in run
          self.build_extensions()
        File "C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_miniconda_env\ComfyUI\Lib\site-packages\torch\utils\cpp_extension.py", line 871, in build_extensions
          build_ext.build_extensions(self)
        File "C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_miniconda_env\ComfyUI\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 467, in build_extensions
          self._build_extensions_serial()
        File "C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_miniconda_env\ComfyUI\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 493, in _build_extensions_serial
          self.build_extension(ext)
        File "C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_miniconda_env\ComfyUI\Lib\site-packages\setuptools\command\build_ext.py", line 249, in build_extension
          _build_ext.build_extension(self, ext)
        File "C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_miniconda_env\ComfyUI\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 548, in build_extension
          objects = self.compiler.compile(
                    ^^^^^^^^^^^^^^^^^^^^^^
        File "C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_miniconda_env\ComfyUI\Lib\site-packages\torch\utils\cpp_extension.py", line 843, in win_wrap_ninja_compile
          _write_ninja_file_and_compile_objects(
        File "C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_miniconda_env\ComfyUI\Lib\site-packages\torch\utils\cpp_extension.py", line 1774, in _write_ninja_file_and_compile_objects
          _run_ninja_build(
        File "C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_miniconda_env\ComfyUI\Lib\site-packages\torch\utils\cpp_extension.py", line 2112, in _run_ninja_build
          raise RuntimeError(message) from e
      RuntimeError: Error compiling objects for extension
      [end of output]

As for the "nvcc error : 'cl.exe' died with status 0xC0000409" part, when I run nvcc in the miniconda prompt I get this output:

(C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_miniconda_env\ComfyUI) C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack>nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Wed_Feb__8_05:53:42_Coordinated_Universal_Time_2023
Cuda compilation tools, release 12.1, V12.1.66
Build cuda_12.1.r12.1/compiler.32415258_0

Building of all other wheels works:

  ERROR: Failed building wheel for pointnet2-ops
  Running setup.py clean for pointnet2-ops
  Building wheel for simple-knn (setup.py) ... done
  Created wheel for simple-knn: filename=simple_knn-0.0.0-cp311-cp311-win_amd64.whl size=365349 sha256=78b43cd461bf2512dd308dfc39e22ecc58372c414c5524b578d8416200723703
  Stored in directory: c:\users\notja\appdata\local\pip\cache\wheels\d0\dd\2b\97965447ecdac866e6fb89f97e8a4b0fabc167392bffcb988a
  Building wheel for diff-gaussian-rasterization (setup.py) ... done
  Created wheel for diff-gaussian-rasterization: filename=diff_gaussian_rasterization-0.0.0-cp311-cp311-win_amd64.whl size=490085 sha256=63771790aaf93509b32b2c0b2c1f17ac7c0ee215b8da3767b668da5bafef8f04
  Stored in directory: C:\Users\notja\AppData\Local\Temp\pip-ephem-wheel-cache-wq7ad9vr\wheels\a9\c6\3b\59b39a0f60badb061da8b34f4e15bc89813f388c73f72a4369
  Building wheel for nvdiffrast (setup.py) ... done
  Created wheel for nvdiffrast: filename=nvdiffrast-0.3.1-py3-none-any.whl size=141467 sha256=e8bd81bba59dded7b0fa9db5dd938cba745fffff0d7cd77f6817ca5eb2bc85af
  Stored in directory: C:\Users\notja\AppData\Local\Temp\pip-ephem-wheel-cache-wq7ad9vr\wheels\b5\a7\d7\a47411b2b358c07b037dae28028ba02c100c03fe3fd2392e5c
  Building wheel for pytorch3d (setup.py) ... done
  Created wheel for pytorch3d: filename=pytorch3d-0.7.5-cp311-cp311-win_amd64.whl size=5466565 sha256=33a875653a3db80378d0a917a1fed99031e4947cf232105e3461ac50c992b88c
  Stored in directory: C:\Users\notja\AppData\Local\Temp\pip-ephem-wheel-cache-wq7ad9vr\wheels\08\90\1b\df18c3e3634f86278e793b87f37ea4c58d0c36731196122518
  Building wheel for torch-scatter (setup.py) ... done
  Created wheel for torch-scatter: filename=torch_scatter-2.1.2-cp311-cp311-win_amd64.whl size=3286750 sha256=b855ac01b016444f0a85dbb56f320b2d2fe75d9860cb00c412f467697c423336
  Stored in directory: C:\Users\notja\AppData\Local\Temp\pip-ephem-wheel-cache-wq7ad9vr\wheels\fa\26\ab\08e8b8230fe29a7c209f0f26e92b097146f076d2184f24598f
  Building wheel for kiui (setup.py) ... done
  Created wheel for kiui: filename=kiui-0.2.4-py3-none-any.whl size=1190200 sha256=24cced4a106ccb967d976cbc9bbc283e66e6c42ce4556a7b14f00463419de674
  Stored in directory: C:\Users\notja\AppData\Local\Temp\pip-ephem-wheel-cache-wq7ad9vr\wheels\20\3c\17\e791a15a84c4c4e2281c95331ff68b27a12f93ce8aa4c0aaf9
Successfully built simple-knn diff-gaussian-rasterization nvdiffrast pytorch3d torch-scatter kiui
Failed to build pointnet2-ops
ERROR: Could not build wheels for pointnet2-ops, which is required to install pyproject.toml-based projects
kustomzone commented 6 months ago

This ninja issue seems to occur even if we have LongPathsEnabled in System Registry (REGEDIT: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem) and CMAKE_OBJECT_PATH_MAX=1024 in our environment.

When ninja builds it likes to repeat the path to the module's base folder after the Release folder so that the target path length doubles. For example, here is a possible path that ninja might be trying to reference which is close to 400 characters long:

C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\tgs\models\snowflake\pointnet2_ops_lib\build\temp.win-amd64-cpython-311\Release\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\tgs\models\snowflake\pointnet2_ops_lib_ext-src\src\group_points_gpu.obj

Likely this is because 'CMAKE_OBJECT_PATH_MAX=1024' is not being appended as a default argument. See: https://github.com/ninja-build/ninja/issues/1900#issuecomment-1817532728

Alternatively, you can simply copy the pointnet2 folder to a root folder 'C:\Temp' where all build paths will be less than 260 chars long, and once it's built there, install the created wheel with pip in your environment as usual. In this case use: python setup.py bdist_wheel instead of install or build.

jacksoncw2000 commented 6 months ago

This ninja issue seems to occur even if we have LongPathsEnabled in System Registry (REGEDIT: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem) and CMAKE_OBJECT_PATH_MAX=1024 in our environment.

When ninja builds it likes to repeat the path to the module's base folder after the Release folder so that the target path length doubles. For example, here is a possible path that ninja might be trying to reference which is close to 400 characters long:

C:\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\tgs\models\snowflake\pointnet2_ops_lib\build\temp.win-amd64-cpython-311\Release\ComfyUI\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\tgs\models\snowflake\pointnet2_ops_lib_ext-src\src\group_points_gpu.obj

Likely this is because 'CMAKE_OBJECT_PATH_MAX=1024' is not being appended as a default argument. See: ninja-build/ninja#1900 (comment)

Alternatively, you can simply copy the pointnet2 folder to a root folder 'C:\Temp' where all build paths will be less than 260 chars long, and once it's built there, install the created wheel with pip in your environment as usual. In this case use: python setup.py bdist_wheel instead of install or build.

Hi kustomzone I have run python setup.py bdist_wheel in C:\Temp\pointnet2_ops_lib

What should I do next? Building the wheel completed successfully in the Temp folder described above, but afterwards I tried running install_miniconda.bat and pip install -r requirements_post.txt but am still getting the same error as above. I then tried moving the pointnet2_ops_lib folder with build folder into the same directory where the unbuilt pointnet2_ops_lib folder is in the ComfyUI-3D-Pack folder, but when I try to load workflows I am still getting a lot of missing nodes.

Any idea where to go from here? Thank you for your help above and any help is appreciated!

jacksoncw2000 commented 6 months ago

Got this to work! Had to install the packages in requirements_post individually and moved the points package into the same directory as the unbuilt one.

jacksoncw2000 commented 6 months ago

Closing this issue.