ComfyUI-3D-Pack icon indicating copy to clipboard operation
ComfyUI-3D-Pack copied to clipboard

Help: How to solve such a problem:raise RuntimeError("Ninja is required to load C++ extensions")

Open g6dv opened this issue 1 year ago • 5 comments

Error occurred when executing [Comfy3D] Convert 3DGS to Mesh with NeRF and Marching Cubes:

Ninja is required to load C++ extensions

File "D:\ComfyUI_windows_portable\ComfyUI\execution.py", line 152, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\ComfyUI_windows_portable\ComfyUI\execution.py", line 82, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\ComfyUI_windows_portable\ComfyUI\execution.py", line 75, in map_node_over_list results.append(getattr(obj, func)(**slice_dict(input_data_all, i))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\nodes.py", line 1458, in convert_gs_ply converter = GSConverterNeRFMarchingCubes(config_defaults[gs_config], gs_ply).cuda() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\algorithms\nerf_marching_cubes_converter.py", line 27, in init from kiui.gridencoder import GridEncoder File "D:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\kiui\gridencoder_init_.py", line 1, in from .grid import GridEncoder File "D:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\kiui\gridencoder\grid.py", line 9, in from .backend import _backend File "D:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\kiui\gridencoder\backend.py", line 63, in _backend = load( ^^^^^ File "D:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\utils\cpp_extension.py", line 1306, in load return _jit_compile( ^^^^^^^^^^^^^ File "D:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\utils\cpp_extension.py", line 1710, in _jit_compile _write_ninja_file_and_build_library( File "D:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\utils\cpp_extension.py", line 1793, in _write_ninja_file_and_build_library verify_ninja_availability() File "D:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\utils\cpp_extension.py", line 1842, in verify_ninja_availability raise RuntimeError("Ninja is required to load C++ extensions")

g6dv avatar Mar 19 '24 05:03 g6dv

Check this issue maybe it helps

DenisKochetov avatar Mar 19 '24 12:03 DenisKochetov

Thank you: The problem still cannot be solved, please take your time to find it

g6dv avatar Mar 20 '24 03:03 g6dv

Thank you: The problem still cannot be solved, please take your time to find it

Hi, if you are using ComfyUI python embed environment then please try: [Your ComfyUI python.exe path] -s -m pip install --force-reinstall ninja

MrForExample avatar Mar 20 '24 10:03 MrForExample

Thank you: Solved

g6dv avatar Mar 22 '24 08:03 g6dv

Thank you: Solved I met the same problem with you could you give the details? thanks

jinkexue avatar Mar 24 '24 01:03 jinkexue

Thank you: The problem still cannot be solved, please take your time to find it

Hi, if you are using ComfyUI python embed environment then please try: [Your ComfyUI python.exe path] -s -m pip install --force-reinstall ninja

I've tried this solution, but still getting the same error 🥲

Warn!: xFormers is available (Attention)
Warn!: Traceback (most recent call last):
  File "E:\AI\ComfyUI_windows_portable\ComfyUI\nodes.py", line 1906, in load_custom_node
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "E:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\__init__.py", line 47, in <module>
    module = importlib.import_module(f".{nodes_filename}", package=__name__)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "importlib\__init__.py", line 126, in import_module
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "E:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\nodes.py", line 78, in <module>
    from Unique3D.scripts.project_mesh import multiview_color_projection, get_cameras_list
  File "E:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\Gen_3D_Modules\Unique3D\scripts\project_mesh.py", line 98, in <module>
    pix2faces_renderer = Pix2FacesRenderer()
                         ^^^^^^^^^^^^^^^^^^^
  File "E:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\Gen_3D_Modules\Unique3D\scripts\project_mesh.py", line 70, in __init__
    self._glctx = dr.RasterizeGLContext(output_db=False, device=device)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\nvdiffrast\torch\ops.py", line 221, in __init__
    self.cpp_wrapper = _get_plugin(gl=True).RasterizeGLStateWrapper(output_db, mode == 'automatic', cuda_device_idx)
                       ^^^^^^^^^^^^^^^^^^^^
  File "E:\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\nvdiffrast\torch\ops.py", line 118, in _get_plugin
    torch.utils.cpp_extension.load(name=plugin_name, sources=source_paths, extra_cflags=opts, extra_cuda_cflags=opts+['-lineinfo'], extra_ldflags=ldflags, with_cuda=True, verbose=False)
  File "E:\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\utils\cpp_extension.py", line 1309, in load
    return _jit_compile(
           ^^^^^^^^^^^^^
  File "E:\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\utils\cpp_extension.py", line 1719, in _jit_compile
    _write_ninja_file_and_build_library(
  File "E:\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\utils\cpp_extension.py", line 1802, in _write_ninja_file_and_build_library
    verify_ninja_availability()
  File "E:\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\utils\cpp_extension.py", line 1851, in verify_ninja_availability
    raise RuntimeError("Ninja is required to load C++ extensions")
RuntimeError: Ninja is required to load C++ extensions

I believe it's the same error. I've made a fresh install of comfy portable with only 3 custom nodes for the 3D workflow. I'm on windows 11

bustrama avatar Jul 12 '24 15:07 bustrama