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.41k stars 245 forks source link

Installation Issues with ComfyUI manager (imported fail) #314

Closed 0mil closed 2 months ago

0mil commented 2 months ago

Hello,

This custom_node is surprisingly awesome! However, it's extremely difficult to install successfully.

I have tried to install this custom_node using various configurations, including Ubuntu LTS, and Windows 10 with CUDA version 11.8 and 12.1. Currently, I am following the guide from this video, but I have also encountered the same failure with the installation of PyTorch3D.

Therefore, I sincerely request assistance: what is the best way to install this custom node using ComfyUI Manager or any other installation steps? Please provide the exact and specific requirements, including the supported OS, CUDA version, and Torch library version. I would like to try installing it again with the correct specifications. Thank you. πŸ˜‚πŸ˜‚πŸ˜‚

C:\Users\jh.park\Downloads\ComfyUI_3D\ComfyUI_windows_portable>.\python_embeded\python.exe -s ComfyUI\main.py --windows-standalone-build
[START] Security scan
DEPRECATION: Loading egg at c:\users\jh.park\downloads\comfyui_3d\comfyui_windows_portable\python_embeded\lib\site-packages\nvdiffrast-0.3.1-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation. Discussion can be found at https://github.com/pypa/pip/issues/12330
[DONE] Security scan
[ComfyUI-Manager] Logging failed: [WinError 32] λ‹€λ₯Έ ν”„λ‘œμ„ΈμŠ€κ°€ νŒŒμΌμ„ μ‚¬μš© 쀑이기 λ•Œλ¬Έμ— ν”„λ‘œμ„ΈμŠ€κ°€ μ•‘μ„ΈμŠ€ ν•  수 μ—†μŠ΅λ‹ˆλ‹€: 'comfyui.log' -> 'comfyui.prev.log'
## ComfyUI-Manager: installing dependencies done.
** ComfyUI startup time: 2024-09-23 14:55:03.687033
** Platform: Windows
** Python version: 3.11.8 (tags/v3.11.8:db85d51, Feb  6 2024, 22:03:32) [MSC v.1937 64 bit (AMD64)]
** Python executable: C:\Users\jh.park\Downloads\ComfyUI_3D\ComfyUI_windows_portable\python_embeded\python.exe
** ComfyUI Path: C:\Users\jh.park\Downloads\ComfyUI_3D\ComfyUI_windows_portable\ComfyUI
** Log path: C:\Users\jh.park\Downloads\ComfyUI_3D\ComfyUI_windows_portable\comfyui.log

Prestartup times for custom nodes:
   1.7 seconds: C:\Users\jh.park\Downloads\ComfyUI_3D\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Manager

Total VRAM 10239 MB, total RAM 16326 MB
pytorch version: 2.3.0+cu121
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 3080 : cudaMallocAsync
Using pytorch cross attention
Traceback (most recent call last):
  File "C:\Users\jh.park\Downloads\ComfyUI_3D\ComfyUI_windows_portable\ComfyUI\nodes.py", line 1931, 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 "C:\Users\jh.park\Downloads\ComfyUI_3D\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\__init__.py", line 53, 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 "C:\Users\jh.park\Downloads\ComfyUI_3D\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\nodes.py", line 57, in <module>
    from TriplaneGaussian.triplane_gaussian_transformers import TGS
  File "C:\Users\jh.park\Downloads\ComfyUI_3D\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\Gen_3D_Modules\TriplaneGaussian\triplane_gaussian_transformers.py", line 6, in <module>
    from TriplaneGaussian.models.image_feature import ImageFeature
  File "C:\Users\jh.park\Downloads\ComfyUI_3D\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\Gen_3D_Modules\TriplaneGaussian\models\image_feature.py", line 7, in <module>
    from ..utils.ops import compute_distance_transform
  File "C:\Users\jh.park\Downloads\ComfyUI_3D\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\Gen_3D_Modules\TriplaneGaussian\utils\ops.py", line 8, in <module>
    from pytorch3d import io
ImportError: cannot import name 'io' from 'pytorch3d' (unknown location)

Cannot import C:\Users\jh.park\Downloads\ComfyUI_3D\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack module for custom nodes: cannot import name 'io' from 'pytorch3d' (unknown location)
### Loading: ComfyUI-Manager (V2.51)
### ComfyUI Revision: 2360 [4ca9b9cc] *DETACHED | Released on '2024-07-12'

Import times for custom nodes:
   0.0 seconds: C:\Users\jh.park\Downloads\ComfyUI_3D\ComfyUI_windows_portable\ComfyUI\custom_nodes\websocket_image_save.py
   0.5 seconds: C:\Users\jh.park\Downloads\ComfyUI_3D\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Manager
   2.3 seconds (IMPORT FAILED): C:\Users\jh.park\Downloads\ComfyUI_3D\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack

Traceback (most recent call last):
  File "C:\Users\jh.park\Downloads\ComfyUI_3D\ComfyUI_windows_portable\ComfyUI\main.py", line 258, in <module>
    loop.run_until_complete(run(server, address=args.listen, port=args.port, verbose=not args.dont_print_server, call_on_start=call_on_start))
  File "asyncio\base_events.py", line 654, in run_until_complete
  File "C:\Users\jh.park\Downloads\ComfyUI_3D\ComfyUI_windows_portable\ComfyUI\main.py", line 153, in run
    await asyncio.gather(server.start(address, port, verbose, call_on_start), server.publish_loop())
  File "C:\Users\jh.park\Downloads\ComfyUI_3D\ComfyUI_windows_portable\ComfyUI\server.py", line 669, in start
    await site.start()
  File "C:\Users\jh.park\Downloads\ComfyUI_3D\ComfyUI_windows_portable\python_embeded\Lib\site-packages\aiohttp\web_runner.py", line 119, in start
    self._server = await loop.create_server(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "asyncio\base_events.py", line 1536, in create_server
OSError: [Errno 10048] error while attempting to bind on address ('127.0.0.1', 8188): 각 μ†ŒμΌ“ μ£Όμ†Œ(ν”„λ‘œν† μ½œ/λ„€νŠΈμ›Œν¬ μ£Όμ†Œ/포트)λŠ” ν•˜λ‚˜λ§Œ μ‚¬μš©ν•  수 μžˆμŠ΅λ‹ˆλ‹€
[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/alter-list.json
[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/model-list.json
[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/github-stats.json
[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/extension-node-map.json
[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json
jakechai commented 2 months ago

It looks like your pytorch3d is not installed properly. Here is the torch2.3.0 pytorch3d wheel in ...\ComfyUI\custom_nodes\ComfyUI-3D-Pack\_Pre_Builds\_Build_Wheels\_Wheels_win_py311_cu121

Try reinstall pytorch3d: ...\python.exe -m pip install --force-reinstall "...\ComfyUI\custom_nodes\ComfyUI-3D-Pack\_Pre_Builds\_Build_Wheels\_Wheels_win_py311_cu121\pytorch3d-0.7.7-cp311-cp311-win_amd64.whl"

I will update the video's description for the new update of torch2.4.0.

AN3Orik commented 2 months ago

New ComfyUI has torch2.4.1 installed by default and it's just impossible to install 3D-Pack to portable.

jakechai commented 2 months ago

New ComfyUI has torch2.4.1 installed by default and it's just impossible to install 3D-Pack to portable.

Install torch2.4.0 first

MrForExample commented 2 months ago

@AN3Orik If you run the: "Your comfyUI python.exe" install.py it should automatically download everything in the correct version, so is reinstall from ComfyUI-Manager

MrForExample commented 2 months ago

@0mil ComfyUI-Manager should work for most cases, both torch2.3 and torch2.4 should work But in your case, you can try those two steps separately under ComfyUI-3D-Pack folder and see what other errors you got:

  1. "Your comfyUI python.exe" -s -m pip -r requirements.txt
  2. "Your comfyUI python.exe" install.py
0mil commented 2 months ago

@MrForExample It completley works. Thank you for your answering and awesome works. πŸ‘πŸ‘πŸ‘

GPU-server commented 1 month ago

@0mil ComfyUI-Manager should work for most cases, both torch2.3 and torch2.4 should work But in your case, you can try those two steps separately under ComfyUI-3D-Pack folder and see what other errors you got:

  1. "Your comfyUI python.exe" -s -m pip -r requirements.txt
  2. "Your comfyUI python.exe" install.py

Hello @MrForExample , do you mean we must go to comfyui 3D pack folder under CUSTOM NODES, then open terminal and write this? "My_ComfyUI_path\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\python_embeded\python.exe -s -m pip -r requirements.txt" ?? Please confirm

GPU-server commented 1 month ago

I tried it:

MyComfyUiPath\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack>"D:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\python_embeded\python.exe" -s -m pip -r requirements.txt

and got: "no such option: -r"!

0mil commented 1 month ago

@GPU-server Yeah, you're almost there! However, there are a few typos. You have to execute the following command.

# first
MyComfyUiPath\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack>"D:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\python_embeded\python.exe" -s -m pip install -r requirements.txt

# second
MyComfyUiPath\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack>"D:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\python_embeded\python.exe" install.py
GPU-server commented 1 month ago

Hello again @0mil , since your last message (3H+ ago), I have been trying to install it :). Got SO many mistakes, erros, bugs. I tried so many things. 1) First, your solution (the one you mentioned just now). Result:

D:\NewInstalls\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack>"D:\NewInstalls\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\python_embeded\python.exe" install.py
Traceback (most recent call last):
  File "D:\NewInstalls\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\install.py", line 19, in <module>
    from build_utils import (
  File "D:\NewInstalls\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\_Pre_Builds/_Build_Scripts\build_utils.py", line 54, in <module>
    CUDA_VERSION = get_cuda_version()
                   ^^^^^^^^^^^^^^^^^^
  File "D:\NewInstalls\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\_Pre_Builds/_Build_Scripts\build_utils.py", line 49, in get_cuda_version
    raise RuntimeError(f"Please install/reinstall CUDA tookit with any of the following supported version: {build_config.supported_cuda_versions}")
RuntimeError: Please install/reinstall CUDA tookit with any of the following supported version: ['12.1', '11.8']
Traceback (most recent call last):
  File "D:\NewInstalls\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\install.py", line 19, in <module>
    from build_utils import (
  File "D:\NewInstalls\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\_Pre_Builds/_Build_Scripts\build_utils.py", line 54, in <module>
    CUDA_VERSION = get_cuda_version()
                   ^^^^^^^^^^^^^^^^^^
  File "D:\NewInstalls\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\_Pre_Builds/_Build_Scripts\build_utils.py", line 49, in get_cuda_version
    raise RuntimeError(f"Please install/reinstall CUDA tookit with any of the following supported version: {build_config.supported_cuda_versions}")
RuntimeError: Please install/reinstall CUDA tookit with any of the following supported version: ['12.1', '11.8']

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\NewInstalls\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\install.py", line 84, in <module>
    cstr("Comfy3D install failed: Dependency installation has failed. Please install manually: https://github.com/MrForExample/ComfyUI-3D-Pack/tree/main/_Pre_Builds/README.md.").error.print()
    ^^^^
NameError: name 'cstr' is not defined. Did you mean: 'str'?

In the meantime I figured I would try the WHEEL thing, I googled (meaning Used chatGPT) to understand what this is about. In summary, these are prechosen libraries that you can install.

2) So since my python inside Comfy embedded py was 3.11, I figured I must choose one of the 311 wheels. Latest comfy comes up with 3.4.1 torch, but none of wheels were 341, So I went and did: python install torch==2.4.0+cu121 torchvision==0.19.0+cu121 torchaudio==2.4.0 --extra-index-url https://download.pytorch.org/whl/cu121 Inside the embedded python directory. But I did not perform a uninstall before it, I guess it was done automatically. (I actually did an unistall with : pip uninstall torch torchvision torchaudio But that uninstalled it from the BASE environement right? Anyway. (Forgot to do "python -m pip.." to make sure the embedded python is used)

Anyway upon rolling back I figured I could use these wheels right? https://github.com/MrForExample/Comfy3D_Pre_Builds/tree/main/_Build_Wheels/_Wheels_win_py311_torch2.4.0_cu121 To install them we do the same thing as you described in your comment: MyPathToMbedded\python.exe -m pip install --force-reinstall "pathToWheelFile1" And did it for all files.

When I did it for nvdiffrast I encountered this:

...
      Successfully uninstalled numpy-1.26.4
  WARNING: The scripts f2py.exe and numpy-config.exe are installed in 'D:\NewInstalls\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\python_embeded\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
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.
gpytoolbox 0.3.2 requires numpy<2, but you have numpy 2.1.2 which is incompatible.
numba 0.60.0 requires numpy<2.1,>=1.22, but you have numpy 2.1.2 which is incompatible.
Successfully installed numpy-2.1.2 nvdiffrast-0.3.1

(Notice the ERROR? Despite it saying success)

3) Then I launched comfy again, the import of 3D PACK showed "failed" again, I saw this in the logs related to comfy starting: ..ComfyUI-3D-Pack module for custom nodes: No module named 'torch_scatter' I did this:

python.exe -m pip install torch-scatter -f https://data.pyg.org/whl/torch-2.4.0+cu121.html

4) Launched again, it shows "failed", and logs show:

File "D:\NewInstalls\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\python_embeded\Lib\site-packages\numba__init__.py", line 45, in _ensure_critical_deps raise ImportError(msg) ImportError: Numba needs NumPy 2.0 or less. Got NumPy 2.1.

So I did this: python.exe -m pip install numpy==2.0 here is how it went:

Collecting numpy==2.0
  Using cached numpy-2.0.0-cp311-cp311-win_amd64.whl.metadata (60 kB)
Using cached numpy-2.0.0-cp311-cp311-win_amd64.whl (16.5 MB)
Installing collected packages: numpy
  WARNING: The scripts f2py.exe and numpy-config.exe are installed in 'D:\NewInstalls\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\python_embeded\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
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.
gpytoolbox 0.3.2 requires numpy<2, but you have numpy 2.0.0 which is incompatible.

Successfully installed numpy-2.0.0

(Notice the ERROR despite success?)

5) Launched Comfy again -> failed. Logs show: AttributeError: np.Inf was removed in the NumPy 2.0 release. Use np.inf instead. Solution: Went to this file "D:\NewInstalls\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\python_embeded\Lib\site-packages\gpytoolbox\reach_for_the_arcs.py" and mofidied all the lines with "np.Inf" into "np.inf".

6) Opened it again, failed. It shows: 'Python.h'Β : No such file or directory ninja: build stopped: subcommand failed. Solution (from here: https://github.com/MrForExample/ComfyUI-3D-Pack/issues/61)

Result: D:\NewInstalls\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\include\torch/csrc/python_headers.h(12): fatal error C1083: .... includeΒ : 'Python.h'Β : No such file or directory ninja: build stopped: subcommand failed.

I don't know what to do now. What do you think @MrForExample ? Am I crazy, should I had really to spend that much time and still not be able to install it?