Gourieff / comfyui-reactor-node

Fast and Simple Face Swap Extension Node for ComfyUI
GNU General Public License v3.0
1.62k stars 163 forks source link

Precompiled insightface wheel not compatible with Portable ComfyUI v0.2.4 #471

Open Quaggles opened 1 month ago

Quaggles commented 1 month ago

First, confirm

What happened?

The new ComfyUI v0.2.4 portable release uses Python 3.12, CUDA 12.4, pytorch 2.5 and numpy v2.1.2. When I install the Python 3.12 wheel of insightface (https://github.com/Gourieff/Assets/raw/main/Insightface/insightface-0.7.3-cp312-cp312-win_amd64.whl) I get the error: Cannot import C:\comfy\ComfyUI\custom_nodes\comfyui-reactor-node module for custom nodes: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

If I install cython and manually copy over the include and libs folders from C:\Users\<User>\AppData\Local\Programs\Python\Python312 to comfy\python_embeded and run a regular pip install insightface it compiles and works but for many end users compiling it themselves will be too complicated.

Is the error occuring because the wheel was compiled with numpy 1.x.x? If so since the official ComfyUI release has moved to numpy v2 would you be able to provide a compatible wheel for that version?

Steps to reproduce the problem

  1. Download and extract the ComfyUI v0.2.4 release, https://github.com/comfyanonymous/ComfyUI/releases/tag/v0.2.4
  2. Install the precompiled insightface wheel with .\python_embeded\python.exe -m pip install https://github.com/Gourieff/Assets/raw/main/Insightface/insightface-0.7.3-cp312-cp312-win_amd64.whl
  3. Clone ReActor into ComfyUI\custom_nodes
  4. Run comfyui-reactor-node\install.bat
  5. Run ComfyUI and see error

Sysinfo

Windows 11 Chrome RTX 2080ti No other custom nodes installed

Relevant console log

C:\comfy>.\python_embeded\python.exe -s ComfyUI\main.py --windows-standalone-build
Total VRAM 11264 MB, total RAM 32683 MB
pytorch version: 2.5.0+cu124
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 2080 Ti : cudaMallocAsync
Using pytorch cross attention
[Prompt Server] web root: C:\comfy\ComfyUI\web
C:\comfy\python_embeded\Lib\site-packages\kornia\feature\lightglue.py:44: FutureWarning: `torch.cuda.amp.custom_fwd(args...)` is deprecated. Please use `torch.amp.custom_fwd(args..., device_type='cuda')` instead.
  @torch.cuda.amp.custom_fwd(cast_inputs=torch.float32)
Traceback (most recent call last):
  File "C:\comfy\ComfyUI\nodes.py", line 2001, in load_custom_node
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "C:\comfy\ComfyUI\custom_nodes\comfyui-reactor-node\__init__.py", line 23, in <module>
    from .nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
  File "C:\comfy\ComfyUI\custom_nodes\comfyui-reactor-node\nodes.py", line 15, in <module>
    from insightface.app.common import Face
  File "C:\comfy\python_embeded\Lib\site-packages\insightface\__init__.py", line 18, in <module>
    from . import app
  File "C:\comfy\python_embeded\Lib\site-packages\insightface\app\__init__.py", line 2, in <module>
    from .mask_renderer import *
  File "C:\comfy\python_embeded\Lib\site-packages\insightface\app\mask_renderer.py", line 8, in <module>
    from ..thirdparty import face3d
  File "C:\comfy\python_embeded\Lib\site-packages\insightface\thirdparty\face3d\__init__.py", line 3, in <module>
    from . import mesh
  File "C:\comfy\python_embeded\Lib\site-packages\insightface\thirdparty\face3d\mesh\__init__.py", line 9, in <module>
    from .cython import mesh_core_cython
  File "insightface\\thirdparty\\face3d\\mesh\\cython\\mesh_core_cython.pyx", line 1, in init insightface.thirdparty.face3d.mesh.cython.mesh_core_cython
ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

Cannot import C:\comfy\ComfyUI\custom_nodes\comfyui-reactor-node module for custom nodes: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

Import times for custom nodes:
   0.0 seconds: C:\comfy\ComfyUI\custom_nodes\websocket_image_save.py
   0.6 seconds (IMPORT FAILED): C:\comfy\ComfyUI\custom_nodes\comfyui-reactor-node

Starting server

To see the GUI go to: http://127.0.0.1:8188

Additional information

No response

Raees760 commented 4 weeks ago

Having same issue and idk how to fix it

embeddedDevices commented 4 weeks ago

Hello, having same issue, perfect describtion of the problem.

patrice74 commented 3 weeks ago

Good morning, To work around the problem: In your "ComfyUI_windows_portable\python_embeded" directory, run the command: python.exe -m pip install numpy==1.26.4 It works for me.

embeddedDevices commented 3 weeks ago

Good morning, To work around the problem: In your "ComfyUI_windows_portable\python_embeded" directory, run the command: python.exe -m pip install numpy==1.26.4 It works for me.

Thank you so much. That works fine.

YurchenkoAndrew commented 5 days ago

Раньше с бубнами, но получалось поставить. Сейчас ComfyUI переустановил и все. Уже и по инструкции основной попробовал и в ручном варианте, и "ComfyUI_windows_portable\python_embeded" directory, run the command: python.exe -m pip install numpy==1.26.4 It works for me это испробовал. Ошибка такая как в заголовки и хоть ты тресни.

`Prestartup times for custom nodes: 5.8 seconds: C:\AI\ComfyUI\ComfyUI\custom_nodes\ComfyUI-Manager

Total VRAM 6144 MB, total RAM 16236 MB pytorch version: 2.5.1+cu124 Set vram state to: NORMAL_VRAM Device: cuda:0 NVIDIA GeForce RTX 3060 Laptop GPU : cudaMallocAsync Using pytorch cross attention [Prompt Server] web root: C:\AI\ComfyUI\ComfyUI\web

Loading: ComfyUI-Manager (V2.51.9)

ComfyUI Revision: 2841 [89861512] | Released on '2024-11-19'

[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 Traceback (most recent call last): File "C:\AI\ComfyUI\ComfyUI\nodes.py", line 2024, in load_custom_node module_spec.loader.exec_module(module) File "", line 995, in exec_module File "", line 488, in _call_with_frames_removed File "C:\AI\ComfyUI\ComfyUI\custom_nodes\comfyui-reactor-node__init.py", line 23, in from .nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS File "C:\AI\ComfyUI\ComfyUI\custom_nodes\comfyui-reactor-node\nodes.py", line 15, in from insightface.app.common import Face File "C:\AI\ComfyUI\python_embeded\Lib\site-packages\insightface__init__.py", line 18, in from . import app File "C:\AI\ComfyUI\python_embeded\Lib\site-packages\insightface\app__init.py", line 2, in from .mask_renderer import * File "C:\AI\ComfyUI\python_embeded\Lib\site-packages\insightface\app\mask_renderer.py", line 8, in from ..thirdparty import face3d File "C:\AI\ComfyUI\python_embeded\Lib\site-packages\insightface\thirdparty\face3d\init__.py", line 3, in from . import mesh File "C:\AI\ComfyUI\python_embeded\Lib\site-packages\insightface\thirdparty\face3d\mesh\init__.py", line 9, in from .cython import mesh_core_cython File "insightface\thirdparty\face3d\mesh\cython\mesh_core_cython.pyx", line 1, in init insightface.thirdparty.face3d.mesh.cython.mesh_core_cython ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

Cannot import C:\AI\ComfyUI\ComfyUI\custom_nodes\comfyui-reactor-node module for custom nodes: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

Import times for custom nodes: 0.0 seconds: C:\AI\ComfyUI\ComfyUI\custom_nodes\websocket_image_save.py 0.0 seconds: C:\AI\ComfyUI\ComfyUI\custom_nodes\cg-use-everywhere 0.0 seconds: C:\AI\ComfyUI\ComfyUI\custom_nodes\ComfyUI_UltimateSDUpscale 0.3 seconds: C:\AI\ComfyUI\ComfyUI\custom_nodes\ComfyUI-Manager 0.8 seconds (IMPORT FAILED): C:\AI\ComfyUI\ComfyUI\custom_nodes\comfyui-reactor-node

Starting server

To see the GUI go to: http://127.0.0.1:8188`