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
1.72k stars 165 forks source link

Does not work, missing nodes (portable standalone build for Windows) #143

Closed KannManMachen closed 1 month ago

KannManMachen commented 2 months ago

Hello everyone,

unfortunately I can't get the 3D-Pack to work after several attempts and many hours of trying. When loading the workflows, all nodes are displayed as missing. As a non-developer, I have rummaged through the other Github issues to find potential sources of error - unfortunately without success. I'm afraid I've broken something in my many "repair attempts".

For the installation I followed the instructions "Install Method 0" (Directly inside ComfyUI Windows Python Embedded Environment).

I don't know if it is relevant, but I am using Windows Server 2022 (Version 21H2 (Build 20348.2402)).

What can I do? Do you need further information from me?

Cheers <3

C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable>.\python_embeded\python.exe -s ComfyUI\main.py --windows-standalone-build
** ComfyUI startup time: 2024-04-30 09:03:38.543521
** 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\<USERNAME>\Desktop\ComfyUI_windows_portable\python_embeded\python.exe
** Log path: C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\comfyui.log

Prestartup times for custom nodes:
   0.0 seconds: C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\rgthree-comfy
   0.2 seconds: C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Manager

Total VRAM 24564 MB, total RAM 48995 MB
xformers version: 0.0.26.post1
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 4090 : cudaMallocAsync
VAE dtype: torch.bfloat16
Using xformers cross attention

Adding extra search path checkpoints C:\Users\<USERNAME>\Desktop\stable-diffusion-webui\models/Stable-diffusion
Adding extra search path configs C:\Users\<USERNAME>\Desktop\stable-diffusion-webui\models/Stable-diffusion
Adding extra search path vae C:\Users\<USERNAME>\Desktop\stable-diffusion-webui\models/VAE
Adding extra search path loras C:\Users\<USERNAME>\Desktop\stable-diffusion-webui\models/Lora
Adding extra search path loras C:\Users\<USERNAME>\Desktop\stable-diffusion-webui\models/LyCORIS
Adding extra search path upscale_models C:\Users\<USERNAME>\Desktop\stable-diffusion-webui\models/ESRGAN
Adding extra search path upscale_models C:\Users\<USERNAME>\Desktop\stable-diffusion-webui\models/RealESRGAN
Adding extra search path upscale_models C:\Users\<USERNAME>\Desktop\stable-diffusion-webui\models/SwinIR
Adding extra search path embeddings C:\Users\<USERNAME>\Desktop\stable-diffusion-webui\embeddings
Adding extra search path hypernetworks C:\Users\<USERNAME>\Desktop\stable-diffusion-webui\models/hypernetworks
Adding extra search path controlnet C:\Users\<USERNAME>\Desktop\stable-diffusion-webui\models/ControlNet

Traceback (most recent call last):
  File "C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\ComfyUI\nodes.py", line 1864, 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\<USERNAME>\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\__init__.py", line 28, 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\<USERNAME>\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\nodes.py", line 36, in <module>
    from .algorithms.dmtet import DMTetMesh
  File "C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\algorithms\dmtet.py", line 6, in <module>
    from pytorch3d.loss import chamfer_distance, mesh_laplacian_smoothing
  File "C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\python_embeded\Lib\site-packages\pytorch3d\loss\__init__.py", line 8, in <module>
    from .chamfer import chamfer_distance
  File "C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\python_embeded\Lib\site-packages\pytorch3d\loss\chamfer.py", line 11, in <module>
    from pytorch3d.ops.knn import knn_gather, knn_points
  File "C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\python_embeded\Lib\site-packages\pytorch3d\ops\__init__.py", line 7, in <module>
    from .ball_query import ball_query
  File "C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\python_embeded\Lib\site-packages\pytorch3d\ops\ball_query.py", line 10, in <module>
    from pytorch3d import _C
ImportError: DLL load failed while importing _C: Die angegebene Prozedur wurde nicht gefunden.

Cannot import C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack module for custom nodes: DLL load failed while importing _C: Die angegebene Prozedur wurde nicht gefunden.

### Loading: ComfyUI-Impact-Pack (V5.1.4)
### Loading: ComfyUI-Impact-Pack (Subpack: V0.4)
### Loading: ComfyUI-Inspire-Pack (V0.67)
[Impact Pack] Wildcards loading done.
Total VRAM 24564 MB, total RAM 48995 MB
xformers version: 0.0.26.post1
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 4090 : cudaMallocAsync
VAE dtype: torch.bfloat16
### Loading: ComfyUI-Manager (V2.24.1)
### ComfyUI Revision: 2149 [059773a6] | Released on '2024-04-28'
[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/custom-node-list.json
[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/extension-node-map.json
[ReActor] - STATUS - Running v0.5.0-b1 in ComfyUI
Torch version: 2.3.0+cu121
------------------------------------------
Comfyroll Studio v1.76 :  175 Nodes Loaded
------------------------------------------
** For changes, please see patch notes at https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/blob/main/Patch_Notes.md
** For help, please see the wiki at https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki
------------------------------------------
[comfyui_controlnet_aux] | INFO -> Using ckpts path: C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_controlnet_aux\ckpts
[comfyui_controlnet_aux] | INFO -> Using symlinks: False
[comfyui_controlnet_aux] | INFO -> Using ort providers: ['CUDAExecutionProvider', 'DirectMLExecutionProvider', 'OpenVINOExecutionProvider', 'ROCMExecutionProvider', 'CPUExecutionProvider', 'CoreMLExecutionProvider']
DWPose: Onnxruntime with acceleration providers detected
Efficiency Nodes: Attempting to add Control Net options to the 'HiRes-Fix Script' Node (comfyui_controlnet_aux add-on)...Success!

[rgthree] Loaded 37 magnificent nodes.
[rgthree] Will use rgthree's optimized recursive execution.

DEPRECATION: Loading egg at c:\users\<USERNAME>\desktop\comfyui_windows_portable\python_embeded\lib\site-packages\diff_gaussian_rasterization-0.0.0-py3.11-win-amd64.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
DEPRECATION: Loading egg at c:\users\<USERNAME>\desktop\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
DEPRECATION: Loading egg at c:\users\<USERNAME>\desktop\comfyui_windows_portable\python_embeded\lib\site-packages\pointnet2_ops-3.0.0-py3.11-win-amd64.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
DEPRECATION: Loading egg at c:\users\<USERNAME>\desktop\comfyui_windows_portable\python_embeded\lib\site-packages\simple_knn-0.0.0-py3.11-win-amd64.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

WAS Node Suite: OpenCV Python FFMPEG support is enabled
WAS Node Suite Warning: `ffmpeg_bin_path` is not set in `C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\was-node-suite-comfyui\was_suite_config.json` config file. Will attempt to use system ffmpeg binaries if available.
DEPRECATION: Loading egg at c:\users\<USERNAME>\desktop\comfyui_windows_portable\python_embeded\lib\site-packages\diff_gaussian_rasterization-0.0.0-py3.11-win-amd64.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
DEPRECATION: Loading egg at c:\users\<USERNAME>\desktop\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
DEPRECATION: Loading egg at c:\users\<USERNAME>\desktop\comfyui_windows_portable\python_embeded\lib\site-packages\pointnet2_ops-3.0.0-py3.11-win-amd64.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
DEPRECATION: Loading egg at c:\users\<USERNAME>\desktop\comfyui_windows_portable\python_embeded\lib\site-packages\simple_knn-0.0.0-py3.11-win-amd64.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
WAS Node Suite: Finished. Loaded 211 nodes successfully.

        "Every artist was first an amateur." - Ralph Waldo Emerson

Import times for custom nodes:
   0.0 seconds: C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\websocket_image_save.py
   0.0 seconds: C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\masquerade-nodes-comfyui
   0.0 seconds: C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\stability-ComfyUI-nodes
   0.0 seconds: C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_essentials
   0.0 seconds: C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_IPAdapter_plus
   0.0 seconds: C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_UltimateSDUpscale
   0.0 seconds: C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Advanced-ControlNet   0.0 seconds: C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\efficiency-nodes-comfyui
   0.0 seconds: C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\rgthree-comfy
   0.0 seconds: C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-KJNodes
   0.0 seconds: C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_Comfyroll_CustomNodes
   0.0 seconds: C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_controlnet_aux
   0.0 seconds: C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Inspire-Pack
   0.0 seconds: C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_segment_anything
   0.1 seconds: C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Manager
   0.3 seconds: C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Impact-Pack
   0.3 seconds: C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-SUPIR
   0.3 seconds: C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\hd_node
   0.4 seconds: C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui-reactor-node
   0.5 seconds (IMPORT FAILED): C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack
   0.9 seconds: C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\was-node-suite-comfyui
   1.0 seconds: C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-InstantMesh

Starting server

To see the GUI go to: http://127.0.0.1:8188
FETCH DATA from: C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Manager\extension-node-map.json
LichAcademy commented 2 months ago

I believe I have the same error message. I am also on Windows 11, but I am not using portable version. Comfy is installed manually inside Conda environment.

Below are the commands I used.

I have successfully installed CUDA using:

conda install nvidia/label/cuda-12.1.1::cuda-toolkit

I have successfully installed PyTorch via:

pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121

And I have xformers using:

pip install -U xformers --index-url https://download.pytorch.org/whl/cu121

Below is the log:

PS C:\Users\<USERNAME>\sd\ComfyUI> & C:/Users/<USERNAME>/anaconda3/envs/py311/python.exe c:/Users/<USERNAME>/sd/ComfyUI/main.py
** ComfyUI startup time: 2024-05-01 18:39:21.382339
** Platform: Windows
** Python version: 3.11.9 | packaged by Anaconda, Inc. | (main, Apr 19 2024, 16:40:41) [MSC v.1916 64 bit (AMD64)]
** Python executable: C:\Users\<USERNAME>\anaconda3\envs\py311\python.exe
** Log path: C:\Users\<USERNAME>\sd\ComfyUI\comfyui.log

Prestartup times for custom nodes:
   0.3 seconds: C:\Users\<USERNAME>\sd\ComfyUI\custom_nodes\ComfyUI-Manager

Total VRAM 16379 MB, total RAM 16176 MB
xformers version: 0.0.26.post1
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 4060 Ti : cudaMallocAsync
VAE dtype: torch.bfloat16
Using xformers cross attention
Traceback (most recent call last):
  File "c:\Users\<USERNAME>\sd\ComfyUI\nodes.py", line 1864, 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\<USERNAME>\sd\ComfyUI\custom_nodes\ComfyUI-3D-Pack\__init__.py", line 28, in <module>
    module = importlib.import_module(f".{nodes_filename}", package=__name__)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\<USERNAME>\anaconda3\envs\py311\Lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  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\<USERNAME>\sd\ComfyUI\custom_nodes\ComfyUI-3D-Pack\nodes.py", line 36, in <module>
    from .algorithms.dmtet import DMTetMesh
  File "C:\Users\<USERNAME>\sd\ComfyUI\custom_nodes\ComfyUI-3D-Pack\algorithms\dmtet.py", line 6, in <module>
    from pytorch3d.loss import chamfer_distance, mesh_laplacian_smoothing
  File "C:\Users\<USERNAME>\anaconda3\envs\py311\Lib\site-packages\pytorch3d\loss\__init__.py", line 8, in <module>
    from .chamfer import chamfer_distance
  File "C:\Users\<USERNAME>\anaconda3\envs\py311\Lib\site-packages\pytorch3d\loss\chamfer.py", line 11, in <module>
    from pytorch3d.ops.knn import knn_gather, knn_points
  File "C:\Users\<USERNAME>\anaconda3\envs\py311\Lib\site-packages\pytorch3d\ops\__init__.py", line 7, in <module>
    from .ball_query import ball_query
  File "C:\Users\<USERNAME>\anaconda3\envs\py311\Lib\site-packages\pytorch3d\ops\ball_query.py", line 10, in <module>
    from pytorch3d import _C
ImportError: DLL load failed while importing _C: The specified procedure could not be found.

Cannot import C:\Users\<USERNAME>\sd\ComfyUI\custom_nodes\ComfyUI-3D-Pack module for custom nodes: DLL load failed while importing _C: The specified procedure could not be found.
### Loading: ComfyUI-Impact-Pack (V5.2)
### Loading: ComfyUI-Impact-Pack (Subpack: V0.5)
### Loading: ComfyUI-Inspire-Pack (V0.68)
[Impact Pack] Wildcards loading done.
### Loading: ComfyUI-Manager (V2.24.1)
### ComfyUI Revision: 2153 [2aed53c4] | Released on '2024-04-30'
[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/custom-node-list.json
[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/extension-node-map.json
[tinyterraNodes] Loaded
WAS Node Suite: OpenCV Python FFMPEG support is enabled
WAS Node Suite: `ffmpeg_bin_path` is set to: C:/ProgramData/chocolatey/bin
WAS Node Suite: Finished. Loaded 211 nodes successfully.

        "Art is the stored honey of the human soul." - Theodore Dreiser

Import times for custom nodes:
   0.0 seconds: C:\Users\<USERNAME>\sd\ComfyUI\custom_nodes\websocket_image_save.py
   0.0 seconds: C:\Users\<USERNAME>\sd\ComfyUI\custom_nodes\ComfyUI-Advanced-ControlNet
   0.0 seconds: C:\Users\<USERNAME>\sd\ComfyUI\custom_nodes\ComfyUI-AnimateDiff-Evolved
   0.0 seconds: C:\Users\<USERNAME>\sd\ComfyUI\custom_nodes\ComfyUI_IPAdapter_plus
   0.1 seconds: C:\Users\<USERNAME>\sd\ComfyUI\custom_nodes\ComfyUI-Inspire-Pack
   0.4 seconds: C:\Users\<USERNAME>\sd\ComfyUI\custom_nodes\ComfyUI-Manager
   0.6 seconds: C:\Users\<USERNAME>\sd\ComfyUI\custom_nodes\ComfyUI-Impact-Pack
   0.9 seconds: C:\Users\<USERNAME>\sd\ComfyUI\custom_nodes\ComfyUI_tinyterraNodes
   1.2 seconds (IMPORT FAILED): C:\Users\<USERNAME>\sd\ComfyUI\custom_nodes\ComfyUI-3D-Pack
   2.2 seconds: C:\Users\<USERNAME>\sd\ComfyUI\custom_nodes\was-node-suite-comfyui

Starting server

To see the GUI go to: http://127.0.0.1:8188
LichAcademy commented 2 months ago

(PS OP nice card! 🀩 )

TamakoT commented 2 months ago

I also encountered the same issue after upgrading my PyTorch version to 2.3.0.

LichAcademy commented 2 months ago

@KannManMachen @TamakoT I fixed it, it works now! I have documented my every step, I will get back to you shortly, just need to type it up! :)

LichAcademy commented 2 months ago
  1. Create virtual environment and activate it
  2. Get Python
  3. In exactly this order, install:
    • CUDA toolkit
    • xformers
    • PyTorch
  4. Clone Comfy and install it manually.
  5. Clone Manager repo and install dependencies.
  6. Test to see if it all works first.
  7. Clone Comfy 3D Pack; manually install dependencies and it should work!

Step 1

(Conda)

conda create --name py311
conda activate py311

If you are not using Anaconda, I suspect you would have something like venv that you create and activate (unless you have an existing one you want to use):

(Venv)

python -m venv py311
py311\Scripts\activate

Step 2

(Conda)

conda install python=3.11.9

(Venv)

You already have Python, so you skip to Step 3.

Step 3

We install CUDA toolkit, xformers and PyTorch in exactly that order.

(Conda)

conda config --add channels conda-forge
conda config --add channels pytorch
conda config --add channels nvidia

conda install -c "nvidia/label/cuda-12.1.1" cuda-toolkit
pip install -U xformers --index-url https://download.pytorch.org/whl/cu121
conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia

(Venv)

Without Conda, you need to use the installer to get CUDA-toolkit, I believe. Documentation says something about pip wheels, but I'm not sure if that version is enough for this repo. Here is link to documentation explaining it: https://docs.nvidia.com/cuda/archive/12.1.1/cuda-installation-guide-microsoft-windows/index.html

On Windows, there is only one way of getting xformers (that I am aware of), and that's using pip:

pip install -U xformers --index-url https://download.pytorch.org/whl/cu121

Get PyTorch by running:

pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
pip install torchsde

Step 4

(Conda)

git clone https://github.com/comfyanonymous/ComfyUI

Install the missing dependencies listed in requirements.txt:

conda install einops sdy623::torchsde safetensors aiohttp pyyaml pillow scipy tqdm psutil kornia

(Venv)

Without conda, you just run pip install -r requirements.txt.

Step 5

(Conda)

git clone https://github.com/ltdrdata/ComfyUI-Manager

conda install GitPython PyGithub matrix_client transformers huggingface-hub

In custom_nodes:

git clone https://github.com/ltdrdata/ComfyUI-Manager
conda install GitPython PyGithub matrix_client transformers huggingface-hub

(Venv)

You just run pip install -r requirements.txt inside the manager folder.

Step 6.

Make sure this all runs by launching main.py. Install anything else missing.

Step 7

At this poing I stopped using conda for installations, and switched to pip. I used these commands:

(In custom_nodes directory)

git clone https://github.com/MrForExample/ComfyUI-3D-Pack

(In ComfyUI-3D-Pack directory)

pip install -r requirements.txt
pip install -r requirements_post.txt

And that's it. Second one took some time before the wheels got built. I think I will keep this verion of Comfy separate from the rest.

LichAcademy commented 2 months ago

If you run pip list, you can compare the versions you have installed to what I have (if this helps):

PS C:\Users\<USERNAME>\sd\ComfyUI> pip list
Package                     Version
--------------------------- ------------------
aiohttp                     3.9.5
aiosignal                   1.3.1
antlr4-python3-runtime      4.9.3
attrs                       23.2.0
Brotli                      1.1.0
certifi                     2024.2.2
cffi                        1.16.0
charset-normalizer          3.3.2
cmake                       3.29.2
colorama                    0.4.6
contourpy                   1.2.1
cryptography                42.0.5
cycler                      0.12.1
dataclasses-json            0.6.5
Deprecated                  1.2.14
diff_gaussian_rasterization 0.0.0
diffusers                   0.27.2
einops                      0.8.0
executing                   2.0.1
filelock                    3.13.1
fonttools                   4.51.0
frozenlist                  1.4.1
fsspec                      2024.2.0
ftfy                        6.2.0
fvcore                      0.1.5.post20221221
gitdb                       4.0.11
GitPython                   3.1.43
huggingface-hub             0.22.2
idna                        3.7
imageio                     2.34.1
imageio-ffmpeg              0.4.9
importlib_metadata          7.1.0
intel-openmp                2021.4.0
iopath                      0.1.10
jaxtyping                   0.2.28
Jinja2                      3.1.3
joblib                      1.4.0
kiui                        0.2.8
kiwisolver                  1.4.5
kornia                      0.7.1
lazy_loader                 0.4
markdown-it-py              3.0.0
MarkupSafe                  2.1.5
marshmallow                 3.21.1
matplotlib                  3.8.4
matrix-client               0.4.0
mdurl                       0.1.2
mkl                         2021.4.0
mpmath                      1.3.0
msvc-runtime                14.34.31931
multidict                   6.0.5
mypy-extensions             1.0.0
nerfacc                     0.5.3
networkx                    3.2.1
ninja                       1.11.1.1
numpy                       1.26.3
nvdiffrast                  0.3.1
objprint                    0.2.3
omegaconf                   2.3.0
open-clip-torch             2.24.0
opencv-python               4.9.0.80
packaging                   24.0
pillow                      10.3.0
pip                         24.0
plyfile                     1.0.3
pointnet2_ops               3.0.0
portalocker                 2.8.2
protobuf                    5.26.1
psutil                      5.9.8
pycparser                   2.22
PyGithub                    2.3.0
pygltflib                   1.16.2
Pygments                    2.17.2
pyhocon                     0.3.60
PyJWT                       2.8.0
PyMCubes                    0.1.4
pymeshlab                   2023.12.post1
PyNaCl                      1.5.0
pyparsing                   3.1.2
PySocks                     1.7.1
python-dateutil             2.9.0.post0
pytorch-msssim              1.0.0
pytorch3d                   0.7.6
pywin32                     306
PyYAML                      6.0.1
regex                       2024.4.28
requests                    2.31.0
rich                        13.7.1
roma                        1.5.0
safetensors                 0.4.3
scikit-learn                1.4.2
scipy                       1.13.0
sentencepiece               0.2.0
setuptools                  69.5.1
simple_knn                  0.0.0
six                         1.16.0
smmap                       5.0.1
sympy                       1.12
tabulate                    0.9.0
tbb                         2021.11.0
termcolor                   2.4.0
threadpoolctl               3.5.0
timm                        0.9.16
tokenizers                  0.19.1
torch                       2.3.0+cu121
torch_scatter               2.1.2
torchaudio                  2.3.0
torchmcubes                 0.1.0
torchsde                    0.2.6
torchtyping                 0.1.4
torchvision                 0.18.0
tqdm                        4.66.2
trampoline                  0.1.2
transformers                4.40.1
trimesh                     4.3.2
typeguard                   2.13.3
typing_extensions           4.11.0
typing-inspect              0.9.0
urllib3                     1.26.18
varname                     0.13.0
wcwidth                     0.2.13
wheel                       0.43.0
win-inet-pton               1.1.0
wrapt                       1.16.0
xatlas                      0.0.9
xformers                    0.0.26.post1
yacs                        0.1.8
yarl                        1.9.4
zipp                        3.18.1
PS C:\Users\<USERNAME>\sd\ComfyUI> 
KannManMachen commented 2 months ago

Wow - thanks for the detailed answer and listing your installation steps :) !

You were kind enough to always differentiate between (conda) and (venv) in your instructions - do you think I can apply and use the steps you listed for (venv) for my portable ComfyUI version (Python Embedded Environment)? In other words, the "Python Embedded Environment" is a kind of virtual environment, right?

I will check the packages list first.

You suggested a specific order for step 3 - this seems to be crucial:

  1. CUDA toolkit
  2. xformers
  3. pyTorch

... can you explain why :) ?

My biggest question is actually: do I have to uninstall the already installed elements before I set it up again or is it enough (according to your list) to install or update the individual elements "over it"?

Cheers

LichAcademy commented 2 months ago

That's a very important question (the last one). Hmm..

Tell you what, I'm feeling adventurous tonight. My 3D-Pack is now working, so I will try setting up venv on a side and see what happens!

As for the reason for the reason on why in that order - I tried it other way last time and it didn't work. πŸ₯² Haha, as I said, I'm not really a programmer either.

LichAcademy commented 2 months ago

Create a new folder and open a terminal there. Then clone the comfy repo:

git clone https://github.com/comfyanonymous/ComfyUI

and change directory:

cd ComfyUI

In here, we create environment and name it myVenv:

python -m venv myVenv

Now, this is important. When you run pip list, you should get a long list of packages you have. For example, I have:

Package                     Version
--------------------------- --------------------
absl-py                     2.1.0
accelerate                  0.29.3
addict                      2.4.0
aiohttp                     3.9.5
aiosignal                   1.3.1
albumentations              1.4.4
annotated-types             0.6.0
antlr4-python3-runtime      4.9.3
anyio                       4.3.0
attrs                       23.2.0
Brotli                      1.1.0
cachetools                  5.3.3
certifi                     2024.2.2
cffi                        1.16.0
chardet                     5.2.0
charset-normalizer          3.3.2
clip-interrogator           0.6.0
cmake                       3.29.2
colorama                    0.4.6

But when you activate your venv:

.\myVenv\Scripts\activate

Now, when you run pip list, you should only have:

(myVenv) (pyDemo) C:\demoForKann\ComfyUI>pip list
Package                  Version
------------------------ ------------
pip                      24.0
setuptools               65.5.0

This is how you will know you are in the separate environment, and not risking your functional environment that already works for you.

Then you install below, one at a time (I am following NVIDIA docs here):

python -m pip install wheel

python -m pip install nvidia-pyindex

python -m pip install nvidia-cuda-runtime-cu12

python -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121

This last line of code will take some time (below is what you will likely see). Folder myVenv should end up having 4-6 GB by the end of it.

(myVenv) (pyDemo) C:\demoForKann\ComfyUI>python -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
Looking in indexes: https://download.pytorch.org/whl/cu121, https://pypi.ngc.nvidia.com
Collecting torch
  Downloading https://download.pytorch.org/whl/cu121/torch-2.3.0%2Bcu121-cp311-cp311-win_amd64.whl (2413.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━ 1.5/2.4 GB 7.8 MB/s eta 0:02:01                                                ━━━━━━━━━━━━━━━━━━━━━━━━╸━━━━━━━━━━━━━━━ 1.5/2.4 GB 7.7 MB/s eta 0:02:02                 ━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━ 1.6/2.4 GB 7.7 MB/s eta 0:01:41                                                                               ━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━ 1.6/2.4 GB 7     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╸━━━━━━━ 2.0/2.4 GB 7.7 MB/s eta 0:00:56

Now, when you run pip list:

(myVenv) (pyDemo) C:\demoForKann\ComfyUI>pip list
Package                  Version
------------------------ ------------
filelock                 3.13.1
fsspec                   2024.2.0
intel-openmp             2021.4.0
Jinja2                   3.1.3
MarkupSafe               2.1.5
mkl                      2021.4.0
mpmath                   1.3.0
networkx                 3.2.1
numpy                    1.26.3
nvidia-cuda-runtime-cu12 12.4.127
nvidia-pyindex           1.0.9
pillow                   10.2.0
pip                      24.0
setuptools               65.5.0
sympy                    1.12
tbb                      2021.11.0
torch                    2.3.0+cu121
torchaudio               2.3.0+cu121
torchvision              0.18.0+cu121
typing_extensions        4.9.0
wheel                    0.43.0
xformers                 0.0.26.post1

(myVenv) (pyDemo) C:\demoForKann\ComfyUI>

And lastly, the xformers:

pip install -U xformers --index-url https://download.pytorch.org/whl/cu121

That's it for the environment setup. Then run Comfy's requirements:

python -m pip install -r requirements.txt

And now we check to see if Comfy works! Run this:

python main.py

On my end, Comfy works.

Do not close the terminal. You can press CTRL+C on your keyboard instead (this will ComfyUI without closing the terminal). If you accidentally close the terminal, it's not the end of the world, but you will need to activate your venv environment once again.

Then install the manager, and the requirements.txt inside it. Run these (1 line at a time):

cd custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Manager
cd ComfyUI-Manager
python -m pip install -r requirements.txt

Then return to the root folder of Comfy:

cd ..
cd ..

And that's it! You now run python main.py again. You should have the Comfy running, along with the Manager. Use manager to install 3D and it should work for you now.

Optional Step (Quality of Life)

As it currently stands, it is tiresome having to open the terminal each time, then cd into the comfy folder, then activate venv, and then run python main.py. Do this instead.

Create a shortcut of main.py by right-clicking and dragging it to your desktop. Then right click on the shortcut and change the target:

%windir%\System32\cmd.exe /K "C:\demoForKann\ComfyUI\myVenv\Scripts\activate.bat myVenv && python C:\demoForKann\ComfyUI\main.py"

The first line is your Command Prompt executable. You can figure out the rest, you just need to alter them so that they match your configuration.

I made a video explaining it (just need to rewind to the end, the part with the shortcuts):

https://youtu.be/DTae-zhWV8o

If you can, leave my video a like and good luck! :)

KannManMachen commented 2 months ago

Hey @Unboxed8941 thx again for this very detailed instruction, you are on fire! Happy to see that you as non-developer are getting really into this whole venv-library-dependencies-voodoo-game :D

So you created an venv in advanced – this time not with conda but with the help of python. I am happy to hear that this workflow seems to work fine as well. I will definitely try one of your two approaches, if I fail to achieve it with the native standalone installation of ComfyUI. Speaking of the portable version – I am pretty sure, that the portable version already works with its own pre-implemented venv structure: C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\python_embeded\python.exe

To run ComfyUI you will find the following parameters in the "run_nvidia_gpu.bat": .\python_embeded\python.exe -s ComfyUI\main.py --windows-standalone-build

So I would love - if possible - to get the 3D pack working successfully together with the portable installation by finding the source of the error, so that other users (using the portable version) get a possible solution.

And if everything fails your tutorials will give the users a perfect alternative

Cheers

kitylam9 commented 1 month ago

Run this, work for me: python_embeded\python.exe -m pip install -U xformers torch==2.2.1+cu121 pytorch3d

KannManMachen commented 1 month ago

Hey @kitylam9, when I try to run …

C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\python_embeded\python.exe -m pip install -U xformers torch==2.2.1+cu121 pytorch3d

… I get the following message:

DEPRECATION: Loading egg at c:\users\<USERNAME>\desktop\comfyui_windows_portable\python_embeded\lib\site-packages\diff_gaussian_rasterization-0.0.0-py3.11-win-amd64.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

DEPRECATION: Loading egg at c:\users\<USERNAME>\desktop\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

DEPRECATION: Loading egg at c:\users\<USERNAME>\desktop\comfyui_windows_portable\python_embeded\lib\site-packages\pointnet2_ops-3.0.0-py3.11-win-amd64.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

DEPRECATION: Loading egg at c:\users\<USERNAME>\desktop\comfyui_windows_portable\python_embeded\lib\site-packages\simple_knn-0.0.0-py3.11-win-amd64.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

Requirement already satisfied: xformers in c:\users\<USERNAME>\desktop\comfyui_windows_portable\python_embeded\lib\site-packages (0.0.26.post1)

ERROR: Could not find a version that satisfies the requirement torch==2.2.1+cu121 (from versions: 2.0.0, 2.0.1, 2.1.0, 2.1.1, 2.1.2, 2.2.0, 2.2.1, 2.2.2, 2.3.0)
ERROR: No matching distribution found for torch==2.2.1+cu121
KannManMachen commented 1 month ago

It finally works - no more "missing nodes" when loading the example workflows of the 3D-Pack!

Thank you very much @kitylam9 (and @Unboxed8941) – I had to change the command to:

C:\Users\<USERNAME>\Desktop\ComfyUI_windows_portable\python_embeded\python.exe -m pip install -U torch==2.2.1 torchvision==0.17.1 torchaudio==2.2.1 xformers --index-url https://download.pytorch.org/whl/cu121

<3