cubiq/ComfyUI_IPAdapter_plus

Dependencies missing for Insightface

pphoto808 opened this issue ยท 151 comments

Screenshot 2023-12-24 at 19 27 54

I have followed in the installation guide lines. Installed all the appropriate files in ComfyUI environment, updated Comfy and still get the same error.

Running Comfy on Mac Studio M2 Ultra.

I'm getting the exact same problem @pphoto808! Running on an i9, RTX 4080. Very weird. I followed all of Matteo's/Cubiq's instructions. Pip installed all of the dependencies and models. Everything is placed where it should be. And still on ComfyUI I get this:

Error occurred when executing InsightFaceLoader:

IPAdapter: InsightFace is not installed! Install the missing dependencies if you wish to use FaceID models.

File "D:\ComfyUI_windows_portable\ComfyUI\execution.py", line 153, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI_windows_portable\ComfyUI\execution.py", line 83, 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 76, 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_IPAdapter_plus\IPAdapterPlus.py", line 459, in load_insight_face
raise Exception('IPAdapter: InsightFace is not installed! Install the missing dependencies if you wish to use FaceID models.')

Same problem here. I guess we'll need a new tutorial: "How to properly install InsightFace to make it work with IPAdapter", apparently many of us couldn't make it.

It is the same problem with issue #156.
There is a workaround I am using.
But I still hope someone can find better solution.

This solution From Reactor Trubleshoot:
I. (For Windows users) If you still cannot build Insightface for some reason or just don't want to install Visual Studio or VS C++ Build Tools - do the following:
(ComfyUI Portable) From the root folder check the version of Python:
run CMD and type python_embeded\python.exe -V
Download prebuilt Insightface package for Python 3.10 or for Python 3.11 (if in the previous step you see 3.11) and put into the stable-diffusion-webui (A1111 or SD.Next) root folder (where you have "webui-user.bat" file) or into ComfyUI root folder if you use ComfyUI Portable
From the root folder run:
(SD WebUI) CMD and .\venv\Scripts\activate
(ComfyUI Portable) run CMD
Then update your PIP:
(SD WebUI) python -m pip install -U pip
(ComfyUI Portable) python_embeded\python.exe -m pip install -U pip
Then install Insightface:
(SD WebUI) pip install insightface-0.7.3-cp310-cp310-win_amd64.whl (for 3.10) or pip install insightface-0.7.3-cp311-cp311-win_amd64.whl (for 3.11)
(ComfyUI Portable) python_embeded\python.exe -m pip install insightface-0.7.3-cp310-cp310-win_amd64.whl (for 3.10) or python_embeded\python.exe -m pip install insightface-0.7.3-cp311-cp311-win_amd64.whl (for 3.11)
Enjoy!

I suggest uninstalling InsightFace first if exists then follow the above instructions.
Good luck

Thanks MMoneer, I've tried that, but no luck. Comfy still complains that InsightFace is not installed.

do you have any errors in the consol log?

"Error occurred when executing InsightFaceLoader:

IPAdapter: InsightFace is not installed! Install the missing dependencies if you wish to use FaceID models.

File "F:\ConfyUI\ComfyUI_windows_portable\ComfyUI\execution.py", line 153, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
File "F:\ConfyUI\ComfyUI_windows_portable\ComfyUI\execution.py", line 83, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
File "F:\ConfyUI\ComfyUI_windows_portable\ComfyUI\execution.py", line 76, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
File "F:\ConfyUI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_IPAdapter_plus\IPAdapterPlus.py", line 459, in load_insight_face
raise Exception('IPAdapter: InsightFace is not installed! Install the missing dependencies if you wish to use FaceID models.')"

I mean while InsightFace installation prosses.

Not really, if I run the install command again, I get this:
Processing f:\confyui\comfyui_windows_portable\python_embeded\insightface-0.7.3-cp310-cp310-win_amd64.whl
Requirement already satisfied: numpy in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from insightface==0.7.3) (1.23.5)
Requirement already satisfied: onnx in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from insightface==0.7.3) (1.14.0)
Requirement already satisfied: tqdm in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from insightface==0.7.3) (4.66.1)
Requirement already satisfied: requests in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from insightface==0.7.3) (2.31.0)
Requirement already satisfied: matplotlib in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from insightface==0.7.3) (3.7.2)
Requirement already satisfied: Pillow in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from insightface==0.7.3) (9.5.0)
Requirement already satisfied: scipy in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from insightface==0.7.3) (1.11.2)
Requirement already satisfied: scikit-learn in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from insightface==0.7.3) (1.3.0)
Requirement already satisfied: scikit-image in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from insightface==0.7.3) (0.20.0)
Requirement already satisfied: easydict in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from insightface==0.7.3) (1.10)
Requirement already satisfied: cython in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from insightface==0.7.3) (3.0.2)
Requirement already satisfied: albumentations in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from insightface==0.7.3) (1.3.1)
Requirement already satisfied: prettytable in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from insightface==0.7.3) (3.8.0)
Requirement already satisfied: PyYAML in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from albumentations->insightface==0.7.3) (6.0.1)
Requirement already satisfied: qudida>=0.0.4 in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from albumentations->insightface==0.7.3) (0.0.4)
Requirement already satisfied: opencv-python-headless>=4.1.1 in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from albumentations->insightface==0.7.3) (4.7.0.72)
Requirement already satisfied: networkx>=2.8 in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from scikit-image->insightface==0.7.3) (3.1)
Requirement already satisfied: imageio>=2.4.1 in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from scikit-image->insightface==0.7.3) (2.31.3)
Requirement already satisfied: tifffile>=2019.7.26 in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from scikit-image->insightface==0.7.3) (2023.8.30)
Requirement already satisfied: PyWavelets>=1.1.1 in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from scikit-image->insightface==0.7.3) (1.4.1)
Requirement already satisfied: packaging>=20.0 in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from scikit-image->insightface==0.7.3) (23.1)
Requirement already satisfied: lazy_loader>=0.1 in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from scikit-image->insightface==0.7.3) (0.3)
Requirement already satisfied: contourpy>=1.0.1 in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from matplotlib->insightface==0.7.3) (1.1.0)
Requirement already satisfied: cycler>=0.10 in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from matplotlib->insightface==0.7.3) (0.11.0)
Requirement already satisfied: fonttools>=4.22.0 in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from matplotlib->insightface==0.7.3) (4.42.1)
Requirement already satisfied: kiwisolver>=1.0.1 in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from matplotlib->insightface==0.7.3) (1.4.5)
Requirement already satisfied: pyparsing<3.1,>=2.3.1 in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from matplotlib->insightface==0.7.3) (3.0.9)
Requirement already satisfied: python-dateutil>=2.7 in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from matplotlib->insightface==0.7.3) (2.8.2)
Requirement already satisfied: protobuf>=3.20.2 in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from onnx->insightface==0.7.3) (3.20.3)
Requirement already satisfied: typing-extensions>=3.6.2.1 in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from onnx->insightface==0.7.3) (4.7.1)
Requirement already satisfied: wcwidth in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from prettytable->insightface==0.7.3) (0.2.6)
Requirement already satisfied: charset-normalizer<4,>=2 in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from requests->insightface==0.7.3) (3.2.0)
Requirement already satisfied: idna<4,>=2.5 in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from requests->insightface==0.7.3) (3.4)
Requirement already satisfied: urllib3<3,>=1.21.1 in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from requests->insightface==0.7.3) (1.26.18)
Requirement already satisfied: certifi>=2017.4.17 in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from requests->insightface==0.7.3) (2023.7.22)
Requirement already satisfied: joblib>=1.1.1 in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from scikit-learn->insightface==0.7.3) (1.3.2)
Requirement already satisfied: threadpoolctl>=2.0.0 in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from scikit-learn->insightface==0.7.3) (3.2.0)
Requirement already satisfied: colorama in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from tqdm->insightface==0.7.3) (0.4.6)
Requirement already satisfied: six>=1.5 in f:\confyui\comfyui_windows_portable\python_embeded\lib\site-packages (from python-dateutil>=2.7->matplotlib->insightface==0.7.3) (1.16.0)
insightface is already installed with the same version as the provided wheel. Use --force-reinstall to force an installation of the wheel.
DEPRECATION: torchsde 0.2.5 has a non-standard dependency specifier numpy>=1.19.*; python_version >= "3.7". pip 24.0 will enforce this behaviour change. A possible replacement is to upgrade to a newer version of torchsde or contact the author to suggest that they release a version with a conforming dependency specifiers. Discussion can be found at pypa/pip#12063

This solution From Reactor Trubleshoot: I. (For Windows users) If you still cannot build Insightface for some reason or just don't want to install Visual Studio or VS C++ Build Tools - do the following: (ComfyUI Portable) From the root folder check the version of Python: run CMD and type python_embeded\python.exe -V Download prebuilt Insightface package for Python 3.10 or for Python 3.11 (if in the previous step you see 3.11) and put into the stable-diffusion-webui (A1111 or SD.Next) root folder (where you have "webui-user.bat" file) or into ComfyUI root folder if you use ComfyUI Portable From the root folder run: (SD WebUI) CMD and .\venv\Scripts\activate (ComfyUI Portable) run CMD Then update your PIP: (SD WebUI) python -m pip install -U pip (ComfyUI Portable) python_embeded\python.exe -m pip install -U pip Then install Insightface: (SD WebUI) pip install insightface-0.7.3-cp310-cp310-win_amd64.whl (for 3.10) or pip install insightface-0.7.3-cp311-cp311-win_amd64.whl (for 3.11) (ComfyUI Portable) python_embeded\python.exe -m pip install insightface-0.7.3-cp310-cp310-win_amd64.whl (for 3.10) or python_embeded\python.exe -m pip install insightface-0.7.3-cp311-cp311-win_amd64.whl (for 3.11) Enjoy!

I suggest uninstalling InsightFace first if exists then follow the above instructions. Good luck

I've tried that troubleshooting option too! Doesn't resolve the issue for me.
I even downloaded and updated the entire Visual Studio Installer from Microsoft (as recommended on stackoverflow thread). Re-downloaded. Re-installed. Triple checked all the names of files. Nothing. Can anyone show us how to get this working? Thx

Please uninstall Insightface first, as the above Requirement already satisfied , it has to be a fresh installation

Please uninstall Insightface first, as the above Requirement already satisfied , it has to be a fresh installation

Doesn't work. Does it work for you? Can you share some screenshots of how you got it running?

Please uninstall Insightface first, as the above Requirement already satisfied , it has to be a fresh installation

How to uninstall Insightface? I success install Insightface but also got an error from ComfyUI like @Winnougan

Please uninstall Insightface first, as the above Requirement already satisfied , it has to be a fresh installation

How to uninstall Insightface? I success install Insightface but also got an error from ComfyUI like @Winnougan

To uninstall anything using pip you type:
pip uninstall insightface

However, it's not working for me. I suspect there's something with a missing model? Or perhaps the name of the folder. I'm hoping @cubiq can share a fix for us.

23_comfyUI_04

Is it right? @Winnougan

23_comfyUI_05

After uninstalled. Now, I reinstall Insightface.

23_comfyUI_06

Error occurred when executing InsightFaceLoader:

IPAdapter: InsightFace is not installed! Install the missing dependencies if you wish to use FaceID models.

File "D:\ComfyUI_windows_portable\ComfyUI\execution.py", line 153, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI_windows_portable\ComfyUI\execution.py", line 83, 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 76, 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_IPAdapter_plus\IPAdapterPlus.py", line 459, in load_insight_face
raise Exception('IPAdapter: InsightFace is not installed! Install the missing dependencies if you wish to use FaceID models.')

23_comfyUI_04

Is it right? @Winnougan

Yes, it's correct. But, just like you, I'm continuing to run into errors. There seems to be no fix until @cubiq can resolve this for us.

  • run the update bat scripts from the update directory to ensure that the latest version of comfy is installed, do not rely on the manager even if it says that everything's updated it might not be true
  • be sure to have the latest version of ipadapter extension installed
  • delete the __pycache__ directories from inside ipadapter extension and reactor if you have it... just in case
  • upgrade pip python_embeded\python.exe -m pip install -U pip
  • install insightface python_embeded\python.exe -m pip install insightface

On windows to compile insightface you need Visual Studio installed or the "Desktop Development with C++" from VS C++ Build Tools.

Alternatively you can download the pre-compiled version from here. Select the file based on your python version cp310 is for python 3.10, cp311 if for python 3.11. To know what version of python you have use: python_embeded\python.exe -V

Then you can install it with python_embeded\python.exe -m pip install insightface-0.7.3-cp310-cp310-win_amd64.whl or cp311 for python 3.11.

If you have inisghtface already installed remove it with python_embeded\python.exe -m pip uninstall insightface and repeat the process.

It's not my fault that Tencent Labs chose inisghtface as provider and Insightface is such a pain.

I honestly don't remember if onnx is automatically installed, just in case you can try to also manually install onnxruntime and onnxruntime-gpu (if you want),

On a Mac I have no idea, if it's any close to linux you just have to install it with pip, be sure to activate the comfyui environment first. Note the I'm not sure it will work on a Mac anyway. Software support is not great on anything that is not Cuda.

brave_25122023_014

I faced this problem with reactor, I did these steps:
1- uninstall numpy 1.26 and install 1.24
1- uninstall InsightFace then reinstall as reactor troubleshoot (it didn't work without the other steps) "Also you can use pip install --upgrade --force-reinstall"
3- uninstall onnx 1.15.0 onnxruntime 1.16.3 onnxruntime-gpu 1.16.3 and instal version 1.14 for all (this step helps me for reactor)
Now reactor and face-id work for me, I hope that works for you

running the update_comfyui_and_python_dependencies.bat in the update folder fixed it for me.

brave_25122023_014

I faced this problem with reactor, I did these steps: 1- uninstall numpy 1.26 and install 1.24 1- uninstall InsightFace then reinstall as reactor troubleshoot (it didn't work without the other steps) "Also you can use pip install --upgrade --force-reinstall" 3- uninstall onnx 1.15.0 onnxruntime 1.16.3 onnxruntime-gpu 1.16.3 and instal version 1.14 for all (this step helps me for reactor) Now reactor and face-id work for me, I hope that works for you

I don't know, my Reactor is well done, but FaceID is failed. The new will break the good.)

brave_25122023_014
I faced this problem with reactor, I did these steps: 1- uninstall numpy 1.26 and install 1.24 1- uninstall InsightFace then reinstall as reactor troubleshoot (it didn't work without the other steps) "Also you can use pip install --upgrade --force-reinstall" 3- uninstall onnx 1.15.0 onnxruntime 1.16.3 onnxruntime-gpu 1.16.3 and instal version 1.14 for all (this step helps me for reactor) Now reactor and face-id work for me, I hope that works for you

I don't know, my Reactor is well done, but FaceID is failed. The new will break the good.)

That is weird if the InsightFace is the issue Reactor will not work!

as renzorosso stated: try running the update_comfyui_and_python_dependencies.bat - it worked for them.

Great! Thanks to everyone who has participated in the search for a solution, and a special thanks to Matteo, who is making all of this possible, and trying to help us even a 25th of December.
For me, running the update_comfyui_and_python_dependencies.bat from the Update folder was enough to solve the problem.

The only way I've managed (despite following all the good advice above) to get faceID to work without ComfyUI moaning about Insight face not being installed was too.

Extract a fresh copy of ComfyUI Portable to a new folder (from a n older zip file)
carry out upgrade
Add Ipadaptors
Install InsightFace using pre compiled wheel as per above advice
Install onnxruntime using "python_embeded\python.exe -m pip install onnxruntime"

Now to put all my usual custom nodes back in and see what if anything else breaks.

This is the joy of bleeding edge, this is open source, this is the way ;o)

The only way I've managed (despite following all the good advice above) to get faceID to work without ComfyUI moaning about Insight face not being installed was too.

Extract a fresh copy of ComfyUI Portable to a new folder (from a n older zip file) carry out upgrade Add Ipadaptors Install InsightFace using pre compiled wheel as per above advice Install onnxruntime using "python_embeded\python.exe -m pip install onnxruntime"

Now to put all my usual custom nodes back in and see what if anything else breaks.

This is the joy of bleeding edge, this is open source, this is the way ;o)

Solved.

You guys are the best Christmas present ever lol. Nice to see so many responses! Sneaked away from my wife to say thanks for the comments and suggestions. Since I'm on Mac, don't have the batch update file or folder. Is it possible for someone to attach the file (update_comfyui_and_python_dependencies.bat)? I want to maybe rewrite as a python script and try that. IF that doesn't work, then I'll try the other recommendation. Again, thanks to all!

Heres the contents of the file:

@echo off
..\python_embeded\python.exe .\update.py ..\ComfyUI
echo
echo This will try to update pytorch and all python dependencies, if you get an error wait for pytorch/xformers to fix their stuff
echo You should not be running this anyways unless you really have to
echo
echo If you just want to update normally, close this and run update_comfyui.bat instead.
echo
pause
..\python_embeded\python.exe -s -m pip install --upgrade torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu118 xformers -r ../ComfyUI/requirements.txt pygit2
pause

brave_25122023_014

I faced this problem with reactor, I did these steps: 1- uninstall numpy 1.26 and install 1.24 1- uninstall InsightFace then reinstall as reactor troubleshoot (it didn't work without the other steps) "Also you can use pip install --upgrade --force-reinstall" 3- uninstall onnx 1.15.0 onnxruntime 1.16.3 onnxruntime-gpu 1.16.3 and instal version 1.14 for all (this step helps me for reactor) Now reactor and face-id work for me, I hope that works for you

How do you install 1.14 with pip? I was having problems. Still can't get it to load. Tried every suggestion so far. Running on i9, RTX 4080 (so I have cudas).

Updated ComfyUI, followed every instruction. But I'd like to download onnx and the onnx runtime to 1.14 but can't figure it out.

brave_25122023_014
I faced this problem with reactor, I did these steps: 1- uninstall numpy 1.26 and install 1.24 1- uninstall InsightFace then reinstall as reactor troubleshoot (it didn't work without the other steps) "Also you can use pip install --upgrade --force-reinstall" 3- uninstall onnx 1.15.0 onnxruntime 1.16.3 onnxruntime-gpu 1.16.3 and instal version 1.14 for all (this step helps me for reactor) Now reactor and face-id work for me, I hope that works for you

How do you install 1.14 with pip? I was having problems. Still can't get it to load. Tried every suggestion so far. Running on i9, RTX 4080 (so I have cudas).

Updated ComfyUI, followed every instruction. But I'd like to download onnx and the onnx runtime to 1.14 but can't figure it out.

  • check packages with "python_embeded\python.exe -m pip list " to show already installed versions
    -uninstall " python_embeded\python.exe -m pip uninstall onnx onnxruntime onnxruntime-gpu"
  • "python_embeded\python.exe -m pip install onnxruntime-gpu==1.14.0 onnxruntime==1.14.0 onnx==1.14.0"

brave_25122023_014
I faced this problem with reactor, I did these steps: 1- uninstall numpy 1.26 and install 1.24 1- uninstall InsightFace then reinstall as reactor troubleshoot (it didn't work without the other steps) "Also you can use pip install --upgrade --force-reinstall" 3- uninstall onnx 1.15.0 onnxruntime 1.16.3 onnxruntime-gpu 1.16.3 and instal version 1.14 for all (this step helps me for reactor) Now reactor and face-id work for me, I hope that works for you

I don't know, my Reactor is well done, but FaceID is failed. The new will break the good.)

That is weird if the InsightFace is the issue Reactor will not work!

Maybe, so the problem is not in Insightface, but in FaceID.

Solution found. Buckle up everyone because it's a wild ride.
The first thing you'll want to do is pip uninstall your onnx repositories: python_embeded\python.exe -m pip uninstall onnx onnxruntime onnxruntime-gpu

Then install the "python_embeded\python.exe -m pip install onnxruntime-gpu==1.14.0 onnxruntime==1.14.0 onnx==1.14.0"

I will see if updating them to their current version afterwards breaks it or not (to do).

Then you'll want to create this bat file in the comfyui update folder: ComfyUI_windows_portable\update
Just edit it with notepad++ and save it as insight.bat:

@echo off
..\python_embeded\python.exe -m pip install insightface-0.7.3-cp311-cp311-win_amd64.whl
pause

If you need the python 3.10 script you can get it here under troubleshooting: https://github.com/Gourieff/comfyui-reactor-node?tab=readme-ov-file#i-for-windows-users-if-you-still-cannot-build-insightface-for-some-reasons-or-just-dont-want-to-install-visual-studio-or-vs-c-build-tools---do-the-following

I also have placed the whl files for both python 3.11 and 3.10 in the update folder

I have also updated my Microsoft Visual Studio 2022

Then you go to the pyhon embed folder and do a pip install insightface

Make sure comfyui is updated in the update folder. Open up comfyui and it should now work. When you run the model for the first time it will download the buffalo-l folder (which I already manually downloaded).

  • run the update bat scripts from the update directory to ensure that the latest version of comfy is installed, do not rely on the manager even if it says that everything's updated it might not be true
  • be sure to have the latest version of ipadapter extension installed
  • delete the __pycache__ directories from inside ipadapter extension and reactor if you have it... just in case
  • upgrade pip python_embeded\python.exe -m pip install -U pip
  • install insightface python_embeded\python.exe -m pip install insightface

On windows to compile insightface you need Visual Studio installed or the "Desktop Development with C++" from VS C++ Build Tools.

Alternatively you can download the pre-compiled version from here. Select the file based on your python version cp310 is for python 3.10, cp311 if for python 3.11. To know what version of python you have use: python_embeded\python.exe -V

Then you can install it with python_embeded\python.exe -m pip install insightface-0.7.3-cp310-cp310-win_amd64.whl or cp311 for python 3.11.

If you have inisghtface already installed remove it with python_embeded\python.exe -m pip uninstall insightface and repeat the process.

It's not my fault that Tencent Labs chose inisghtface as provider and Insightface is such a pain.

I honestly don't remember if onnx is automatically installed, just in case you can try to also manually install onnxruntime and onnxruntime-gpu (if you want),

On a Mac I have no idea, if it's any close to linux you just have to install it with pip, be sure to activate the comfyui environment first. Note the I'm not sure it will work on a Mac anyway. Software support is not great on anything that is not Cuda.

I found a solution for that, please confirm it @cubiq
The error is related to insightface package importing. I have changed the code of IPAdapterPlus.py. First add "#" to line from 457 to 460. And add "from insightface.app import FaceAnalysis" to top of the code

def load_insight_face(self, provider):
# try:
# from insightface.app import FaceAnalysis
# except ImportError:
# raise Exception('IPAdapter: InsightFace is not installed! Install the missing dependencies if you wish to use FaceID models.')

    model = FaceAnalysis(name="buffalo_l", root=INSIGHTFACE_DIR, providers=[provider + 'ExecutionProvider',])
    model.prepare(ctx_id=0, det_size=(640, 640))

    return (model,)

It worked for me.

I don't know why it would work like that @ultimatech-cn

Instead of moving the import, just remove the try/except and leave the import inside the load_insight_face method

did it work as I suggested?

did it work as I suggested?

No, the error still exist

There must be difference between these two package importing method.

I don't know why it would work like that @ultimatech-cn

Instead of moving the import, just remove the try/except and leave the import inside the load_insight_face method

That didn't work for me, but moving the import to the start worked out for me

did it work as I suggested?

Read my latest writeup, that's how I finally got it working. No more errors now. Now, I'm hoping for SDXL support!

importing from the middle of the code is never a good idea, but I hate insightface and I don't want to push it into people's throat.

If @Winnougan is the "ultimate" solution, then I'll leave everything as it is, otherwise I'll move the import at the beginning

If @Winnougan is the "ultimate" solution, then I'll leave everything as it is, otherwise I'll move the import at the beginning

That solution didn't work out for me. Maybe for other people?

Hi,
Just to report that Face ID worked for me, via CPU and CUDA, with the provided workflow, without any need for troubleshooting.

I'm on Windows 10, with a portable install.
I only had to update via manager.

I already had insightface installed, to use the ReActor node.
I installed the ReActor node, via the manager.
I didn't need to install Visual Studio.
But I had to install insightface manually, with the troubleshooting instructions:
https://github.com/Gourieff/comfyui-reactor-node?tab=readme-ov-file#troubleshooting

I have Python 3.11
In case it helps, I have this in my site packages:

sitepak

If @Winnougan is the "ultimate" solution, then I'll leave everything as it is, otherwise I'll move the import at the beginning

That solution didn't work out for me. Maybe for other people?

Make sure you follow all of the steps. Believe me bro, nothing worked before. Now, it's working like butter. Make sure you uninstall onxx and it's two brothers. Then make sure you have the latest visual studio and have install all of the C++ components. Then make sure you uninstall insightface. Delete all remnants of it from your files. Then you're going to create that bat file with the whl files. Run the bat. Install the 14.0 onnx dependencies. Pip install Insightface. Make sure ComfyUI is up to date through the update bat file. Make sure you're running with Cudas.

Make sure you follow all of the steps. Believe me bro, nothing worked before. Now, it's working like butter. Make sure you uninstall onxx and it's two brothers. Then make sure you have the latest visual studio and have install all of the C++ components. Then make sure you uninstall insightface. Delete all remnants of it from your files. Then you're going to create that bat file with the whl files. Run the bat. Install the 14.0 onnx dependencies. Pip install Insightface. Make sure ComfyUI is up to date through the update bat file. Make sure you're running with Cudas.

I followd every step exactly as you said, several times. Did not work for me. Maybe of some other custom nodes I run, I don't know. What helped for me, was editing the file 'IPAdapterPlus.py' as follows:
Disable line 457-461 like this:

 #       try:
 #           from insightface.app import FaceAnalysis
 #           except ImportError:
 #           raise Exception('IPAdapter: InsightFace is not installed! Install the missing dependencies if you wish to use FaceID models.')

And place from insightface.app import FaceAnalysis to line 17

It runs with CPU and CUDA perfectly fine now. This was the only workaround that actually worked for me.

"Fixed" the problem for Mac Studio M2 Ultra.
Some steps I took before last step...
I did a lot of the recommendations to no avail. For Mac Silicon users, you don't have python_embed and you won't have the Update folder. I used "/usr/local/opt/python@3.11/bin/python3.11 -m pip install" instead
Today I did the following:
Brew update
Brew upgrade
/usr/local/bin/python3 -m pip install insightface (don't think this matters)

Before I started uninstalling things (onnx stuff), I renamed my current ComfyUI to ComfyUI-Old and created new ComfyUI from latest Github version. Installed Manager, loaded my FaceID graph, installed missing nodes (IPAdapter-Plus), restarted and it works. This time it actually downloaded the insightface files.

WHY it works...no real clue. I didn't note that in the new Comfy folder, there is no venv folder. Removed it from old Comfy folder but still got missing dependencies error. So, clearly the dependencies are there since it works with new Comfy install.

For now, satisfied that it works but still mystified why it doesn't work in old install.

Thanks!

And place from insightface.app import FaceAnalysis to line 17

It runs with CPU and CUDA perfectly fine now. This was the only workaround that actually worked for me.

Beware, that will prevent you from getting any future update

And place from insightface.app import FaceAnalysis to line 17
It runs with CPU and CUDA perfectly fine now. This was the only workaround that actually worked for me.

Beware, that will prevent you from getting any future update

Yes, thanks for the warning. I'll just run this as a seperate comfyui environment then. ๐Ÿ™‚

download the pre-compiled version from here. Select the file based on your python version cp310 is for python 3.10, cp311 if for python 3.11. To know what version of python you have use: python_embeded\python.exe -V

Then you can install it with python_embeded\python.exe -m pip install insightface-0.7.3-cp310-cp310-win_amd64.whl or cp311 for python 3.11.

If you have inisghtface already installed remove it with python_embeded\python.exe -m pip uninstall insightface and repeat the process.

I'm not good with Python and I was a bit lost here. For anybody that struggles and don't want to install Visual Studio for this, here's what to do:

  1. Download the right version of pre-compiled from the link https://github.com/Gourieff/Assets/tree/main/Insightface like explained in the quote.
  2. Open cmd and run
cd <path where you saved the file>
<Path to your Comfy Folder>\python_embeded\python.exe -m pip install <name of the file you downloaded>

So in my case I'm using ComfyUI that has python 3.11 embedded, so I downloaded insightface-0.7.3-cp311-cp311-win_amd64.whl and saved it in the folder where ComfyUI is. I have Comfy in C:\ComfyUI folder so this is what it looks like:

cd C:\ComfyUI\
C:\ComfyUI\python_embeded\python.exe -m pip install insightface-0.7.3-cp311-cp311-win_amd64.whl

After that I got smooth sailing.

removed ัomfyui-reactor-node +
installed ComfyUI-FaceSwap +

after that ip-adapter-faceid_sd15.bin works
but ip-adapter-faceid-plus_sd15.bin does not work

removed ัomfyui-reactor-node + installed ComfyUI-FaceSwap +

after that ip-adapter-faceid_sd15.bin works but ip-adapter-faceid-plus_sd15.bin does not work

Noted the same...I disabled Reactor and didn't get the dependencies error from the Load Insightface node. Didn't try the faceid-plus tho.

faceid-plus is not supported yet. check again later today

removed ัomfyui-reactor-node + installed ComfyUI-FaceSwap +
after that ip-adapter-faceid_sd15.bin works but ip-adapter-faceid-plus_sd15.bin does not work

Noted the same...I disabled Reactor and didn't get the dependencies error from the Load Insightface node. Didn't try the faceid-plus tho.
I find it funny how swappers don't get along. And we're each forced to choose between them.((

removed ัomfyui-reactor-node + installed ComfyUI-FaceSwap +
after that ip-adapter-faceid_sd15.bin works but ip-adapter-faceid-plus_sd15.bin does not work

Noted the same...I disabled Reactor and didn't get the dependencies error from the Load Insightface node. Didn't try the faceid-plus tho.
I find it funny how swappers don't get along. And we're each forced to choose between them.((

I uninstalled Reactor and insightface -> re-installed insightface, then re-installed Reactor via ComfyUI manager, and now everything is working (without editing any file).

removed ัomfyui-reactor-node + installed ComfyUI-FaceSwap +
after that ip-adapter-faceid_sd15.bin works but ip-adapter-faceid-plus_sd15.bin does not work

Noted the same...I disabled Reactor and didn't get the dependencies error from the Load Insightface node. Didn't try the faceid-plus tho.
I find it funny how swappers don't get along. And we're each forced to choose between them.((

I uninstalled Reactor and insightface -> re-installed insightface, then re-installed Reactor via ComfyUI manager, and now everything is working (without editing any file).

I'm glad for you. I did to disable Reactor temporary, while I will understand that I need FaceID.

removed ัomfyui-reactor-node + installed ComfyUI-FaceSwap +
after that ip-adapter-faceid_sd15.bin works but ip-adapter-faceid-plus_sd15.bin does not work

Noted the same...I disabled Reactor and didn't get the dependencies error from the Load Insightface node. Didn't try the faceid-plus tho.
I find it funny how swappers don't get along. And we're each forced to choose between them.((

I uninstalled Reactor and insightface -> re-installed insightface, then re-installed Reactor via ComfyUI manager, and now everything is working (without editing any file).

This worked like magic after hours of fiddling with all types on nodes, even reinstalled comfyui on another drive from scratch !
Thank a million!

removed ัomfyui-reactor-node + installed ComfyUI-FaceSwap +
after that ip-adapter-faceid_sd15.bin works but ip-adapter-faceid-plus_sd15.bin does not work

Noted the same...I disabled Reactor and didn't get the dependencies error from the Load Insightface node. Didn't try the faceid-plus tho.
I find it funny how swappers don't get along. And we're each forced to choose between them.((

I uninstalled Reactor and insightface -> re-installed insightface, then re-installed Reactor via ComfyUI manager, and now everything is working (without editing any file).

This worked like magic after hours of fiddling with all types on nodes, even reinstalled comfyui on another drive from scratch !

removed ัomfyui-reactor-node + installed ComfyUI-FaceSwap +
after that ip-adapter-faceid_sd15.bin works but ip-adapter-faceid-plus_sd15.bin does not work

Noted the same...I disabled Reactor and didn't get the dependencies error from the Load Insightface node. Didn't try the faceid-plus tho.
I find it funny how swappers don't get along. And we're each forced to choose between them.((

I uninstalled Reactor and insightface -> re-installed insightface, then re-installed Reactor via ComfyUI manager, and now everything is working (without editing any file).

I'm glad for you. I did to disable Reactor temporary, while I will understand that I need FaceID.

Thank you too, since when I reinstalled Reactor it stopped working but when I disabled it by your advice all worked again, so we no know the Insightface and Reactor have a conflict and we need to disable reactor to use insightface. You made my day you and daconl !

removed ัomfyui-reactor-node + installed ComfyUI-FaceSwap +
after that ip-adapter-faceid_sd15.bin works but ip-adapter-faceid-plus_sd15.bin does not work

Noted the same...I disabled Reactor and didn't get the dependencies error from the Load Insightface node. Didn't try the faceid-plus tho.
I find it funny how swappers don't get along. And we're each forced to choose between them.((

I uninstalled Reactor and insightface -> re-installed insightface, then re-installed Reactor via ComfyUI manager, and now everything is working (without editing any file).

This worked like magic after hours of fiddling with all types on nodes, even reinstalled comfyui on another drive from scratch !

removed ัomfyui-reactor-node + installed ComfyUI-FaceSwap +
after that ip-adapter-faceid_sd15.bin works but ip-adapter-faceid-plus_sd15.bin does not work

Noted the same...I disabled Reactor and didn't get the dependencies error from the Load Insightface node. Didn't try the faceid-plus tho.
I find it funny how swappers don't get along. And we're each forced to choose between them.((

I uninstalled Reactor and insightface -> re-installed insightface, then re-installed Reactor via ComfyUI manager, and now everything is working (without editing any file).

I'm glad for you. I did to disable Reactor temporary, while I will understand that I need FaceID.

Thank you too, since when I reinstalled Reactor it stopped working but when I disabled it by your advice all worked again, so we no know the Insightface and Reactor have a conflict and we need to disable reactor to use insightface. You made my day you and daconl !

I am using reactor node and IPAdaptor-plus together by changing the IPAdapterPlus.py source code. Disable " from insightface.app import FaceAnalysis" in the middle of code. Import on the top of code.

delete reactor node then can use this

even if you don't use cuda, remember to install onnxruntime-gpu otherwise it might not work

yeah strange, on one system, got faceid working by just updating comfyui and python dependencies and on another system, it works when reactor nodes are removed from custom nodes dir, oh well least we found a solution! :)

"Fixed" the problem for Mac Studio M2 Ultra. Some steps I took before last step... I did a lot of the recommendations to no avail. For Mac Silicon users, you don't have python_embed and you won't have the Update folder. I used "/usr/local/opt/python@3.11/bin/python3.11 -m pip install" instead Today I did the following: Brew update Brew upgrade /usr/local/bin/python3 -m pip install insightface (don't think this matters)

Before I started uninstalling things (onnx stuff), I renamed my current ComfyUI to ComfyUI-Old and created new ComfyUI from latest Github version. Installed Manager, loaded my FaceID graph, installed missing nodes (IPAdapter-Plus), restarted and it works. This time it actually downloaded the insightface files.

WHY it works...no real clue. I didn't note that in the new Comfy folder, there is no venv folder. Removed it from old Comfy folder but still got missing dependencies error. So, clearly the dependencies are there since it works with new Comfy install.

For now, satisfied that it works but still mystified why it doesn't work in old install.

Thanks!

I got it working on my Macbook M2 Pro as well after doing a bit of modifying of my Python installation. I was on Python 3.12 in a virtual environment folder in the ComfyUI folder. It was failling at getting the onnxruntime for that version of Python. I installed Python 3.11 and created a new venv in the Comfy folder and activated that one instead, re-installed all requirements from the requirement.txt file, pip installed insightface and onnxruntime.

After that I got the following error when runnning the sample FaceID2 workflow,

_AttributeError: module 'cv2.gapi.wip.draw' has no attribute 'Text'_ 

to fix that I downgraded my opencv installation using:

pip install opencv-python==4.5.5.64

Like magic, it is now working perfectly on my M2 silicon mac. Hope that helps someone else!

try this insightface-0.7.3-cp310-cp310-win_amd64

https://github.com/bihailantian655/insightface_wheel

https://github.com/deepinsight/insightface/releases/download/v0.7/buffalo_l.zip

unzip into path ComfyUI\models\insightface\models\buffalo_l

Anyone able to summary what are the current working solutions ?

No matter what I try I still get this error, I updated everything, manually and automatically, disabled and uninstalled reActor nodes. still nothing. Any idea why?

Screenshot 2024-01-03 104806

I tried this on a JarvisLabs instance using a Colab file. At first, I always got the error message that InsightFace was not installed. I thought if I downloaded the Insightface models, it might work. Then I downloaded the buffalo_l models listed by @bihailantian655 above, and then I downloaded the Inswapper model which I downloaded from Inswapper download link (though I'm not sure if it fixed the problem). I uninstalled and then reinstalled insightface, too.

And it just worked. I have created a new instance on JarvisLabs, and the problem has gone. I haven't tried it on my Mac M1, so I don't know if it will also work on my Mac.

Below is the snippet of Colab code I have added (here ~/ComfyUI is the base directory).

%pip install onnxruntime-gpu
%pip uninstall insightface
%pip install insightface
%mkdir ~/ComfyUI/models/ipadapter
%cd ~/ComfyUI/models/ipadapter
!wget https://huggingface.co/h94/IP-Adapter-FaceID/resolve/main/ip-adapter-faceid-plus_sd15.bin
!wget https://huggingface.co/h94/IP-Adapter-FaceID/resolve/main/ip-adapter-faceid-plusv2_sd15.bin

%cd ~/ComfyUI/models/clip_vision/
!wget https://huggingface.co/h94/IP-Adapter/resolve/main/models/image_encoder/model.safetensors && mv model.safetensors CLIP-ViT-H-14-laion2B-s32B-b79K.safetensors
!wget https://huggingface.co/h94/IP-Adapter/resolve/main/sdxl_models/image_encoder/model.safetensors && mv model.safetensors CLIP-ViT-bigG-14-laion2B-39B-b160k.safetensors

%cd ~/ComfyUI/models/loras/
!wget https://huggingface.co/h94/IP-Adapter-FaceID/resolve/main/ip-adapter-faceid-plus_sd15_lora.safetensors
!wget https://huggingface.co/h94/IP-Adapter-FaceID/resolve/main/ip-adapter-faceid-plusv2_sd15_lora.safetensors

%mkdir -p ~/ComfyUI/models/insightface/models/buffalo_l
%cd ~/ComfyUI/models/insightface/models/buffalo_l
!wget https://github.com/deepinsight/insightface/releases/download/v0.7/buffalo_l.zip
!unzip buffalo_l.zip
%cd ~/ComfyUI/models/insightface/models
!wget https://huggingface.co/AIBrainBox/inswapper_128.onnx/resolve/main/inswapper_128.onnx

Besides that, I also modified the IPAdapterPlus.py

# INSIGHTFACE_DIR = os.path.join(folder_paths.models_dir, "insightface")
INSIGHTFACE_DIR = os.path.join(os.path.expanduser('~/ComfyUI/models/'), "insightface") # Modified code

After all, I'm still not sure what really happens and what may have fixed this issue in my case.

Hello,
For insightFace issue, I suggest trying the following steps:
1- First update Comfyui from update_comfyui_and_python_dependencies.bat
2- python_embeded\python.exe -m pip uninstall insightface
3- python_embeded\python.exe -m pip install --upgrade --force-reinstall insightface-0.7.3-cp310-cp310-win_amd64.whl (for 3.10) or python_embeded\python.exe -m pip install --upgrade --force-reinstall insightface-0.7.3-cp311-cp311-win_amd64.whl (for 3.11)
-It's important to use "--upgrade --force-reinstall" the new reinstallation should redownload requirements
If the above does not work try to downgrade Pillow from 10.1.0 to version 9.5.0, and check if it works, if not then redo steps 2 and 3 again with Pillow 9.5.0.

@cubiq mentioned this above but I want to highlight it because I think most folks will run into it. I solved my issue last night by digging into the insightface installation instructions, and realizing that onnxruntime-gpu has to be installed manually. (Note: I'm using ComfyUI in a Linux environment.)

You have to install onnxruntime-gpu manually to enable GPU inference, or install onnxruntime to use CPU only inference.
Docs: InsightFace Python Library - Install Inference Backend

I have pushed a new version that gives better error reporting.

Please don't post screenshots! Copy/paste the full text in the console.

Like so:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/matteo/bin/ComfyUI/execution.py", line 154, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/matteo/bin/ComfyUI/execution.py", line 84, in get_output_data
    return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/matteo/bin/ComfyUI/execution.py", line 77, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/matteo/bin/ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/IPAdapterPlus.py", line 529, in load_insight_face
    raise Exception(e)
Exception: Unable to import dependency onnxruntime.

In the above example you are missing onnxruntime-gpu extension

To see the GUI go to: http://127.0.0.1:8188
To see the GUI go to: https://127.0.0.1:8189
got prompt
[ReActor] 12:08:05 - STATUS - Working: source face index [0], target face index [0]
[ReActor] 12:08:05 - STATUS - Analyzing Source Image...
[ReActor] 12:08:07 - STATUS - Analyzing Target Image...
[ReActor] 12:08:08 - STATUS - Swapping...
[ReActor] 12:08:10 - STATUS - --Done!--
[ReActor] 12:08:10 - STATUS - Restoring with codeformer.pth
Loads SAM model: /home/liguo/deploy/ComfyUI/models/sams/sam_vit_h_4b8939.pth (device:Prefer GPU)

0: 640x480 1 face, 57.4ms
Speed: 1.9ms preprocess, 57.4ms inference, 0.9ms postprocess per image at shape (1, 3, 640, 480)
model_type EPS
adm 0
Using pytorch attention in VAE
Working with z of shape (1, 4, 32, 32) = 4096 dimensions.
Using pytorch attention in VAE
missing {'cond_stage_model.clip_l.text_projection', 'cond_stage_model.clip_l.logit_scale'}
left over keys: dict_keys(['cond_stage_model.clip_l.transformer.text_model.embeddings.position_ids'])
ERROR:root:!!! Exception during processing !!!
ERROR:root:Traceback (most recent call last):
File "/home/liguo/deploy/ComfyUI/execution.py", line 154, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
File "/home/liguo/deploy/ComfyUI/execution.py", line 84, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
File "/home/liguo/deploy/ComfyUI/execution.py", line 77, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
File "/home/liguo/deploy/ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/IPAdapterPlus.py", line 570, in apply_ipadapter
raise Exception('InsightFace must be provided for FaceID models.')
Exception: InsightFace must be provided for FaceID models.

Prompt executed in 13.16 seconds

I have got this logs.
How could i fix it?

Error occurred when executing InsightFaceLoader:

A Message class can only inherit from Message

File "D:\ComfyUI\ComfyUI_windows_portable\ComfyUI\execution.py", line 153, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
File "D:\ComfyUI\ComfyUI_windows_portable\ComfyUI\execution.py", line 83, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
File "D:\ComfyUI\ComfyUI_windows_portable\ComfyUI\execution.py", line 76, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
File "D:\ComfyUI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_IPAdapter_plus\IPAdapterPlus.py", line 527, in load_insight_face
from insightface.app import FaceAnalysis
File "D:\ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\insightface_init_.py", line 16, in
from . import model_zoo
File "D:\ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\insightface\model_zoo_init_.py", line 1, in
from .model_zoo import get_model
File "D:\ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\insightface\model_zoo\model_zoo.py", line 11, in
from .arcface_onnx import *
File "D:\ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\insightface\model_zoo\arcface_onnx.py", line 10, in
import onnx
File "D:\ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\onnx_init_.py", line 77, in
from onnx.external_data_helper import (
File "D:\ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\onnx\external_data_helper.py", line 11, in
from onnx.onnx_pb import AttributeProto, GraphProto, ModelProto, TensorProto
File "D:\ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\onnx\onnx_pb.py", line 4, in
from .onnx_ml_pb2 import * # noqa
File "D:\ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\onnx\onnx_ml_pb2.py", line 19, in
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'onnx.onnx_ml_pb2', globals())
File "D:\ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\google\protobuf\internal\builder.py", line 108, in BuildTopDescriptorsAndMessages
module[name] = BuildMessage(msg_des)
File "D:\ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\google\protobuf\internal\builder.py", line 85, in BuildMessage
message_class = _reflection.GeneratedProtocolMessageType(

Make sure you follow all of the steps. Believe me bro, nothing worked before. Now, it's working like butter. Make sure you uninstall onxx and it's two brothers. Then make sure you have the latest visual studio and have install all of the C++ components. Then make sure you uninstall insightface. Delete all remnants of it from your files. Then you're going to create that bat file with the whl files. Run the bat. Install the 14.0 onnx dependencies. Pip install Insightface. Make sure ComfyUI is up to date through the update bat file. Make sure you're running with Cudas.

I followd every step exactly as you said, several times. Did not work for me. Maybe of some other custom nodes I run, I don't know. What helped for me, was editing the file 'IPAdapterPlus.py' as follows: Disable line 457-461 like this:

 #       try:
 #           from insightface.app import FaceAnalysis
 #           except ImportError:
 #           raise Exception('IPAdapter: InsightFace is not installed! Install the missing dependencies if you wish to use FaceID models.')

And place from insightface.app import FaceAnalysis to line 17

It runs with CPU and CUDA perfectly fine now. This was the only workaround that actually worked for me.

This works great if the model load order is correct, if not you'll need to change:

https://github.com/comfyanonymous/ComfyUI/blob/master/nodes.py#L1837

to be:

base_node_names = sorted(set(NODE_CLASS_MAPPINGS.keys()))

Commands to install Insightface on fresh runpod/stable-diffusion:comfy-ui image

apt update
apt-get install -y build-essential
pip install onnxruntime onnxruntime-gpu insightface

don't forget to update protobuf

don't forget to update protobuf

Thank's. Update my comment that this is related for runpod comfyui image
There is no need to update protobuf

Screenshot 2023-12-24 at 19 27 54

I have followed in the installation guide lines. Installed all the appropriate files in ComfyUI environment, updated Comfy and still get the same error.

Running Comfy on Mac Studio M2 Ultra.

Iโ€™ve encountered the same problem as you. Have you found a solution yet?

don't forget to update protobuf

Thank's. Update my comment that this is related for runpod comfyui image There is no need to update protobuf

can t replicate that... error log:
error: command 'x86_64-linux-gnu-gcc' failed: No such file or directory
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for insightface
Building wheel for easydict (setup.py) ... done
Created wheel for easydict: filename=easydict-1.11-py3-none-any.whl size=6660 sha256=b4eeb391038786457b37ed21ae479b89485410149aa1c959cf3c0589967f72c8e
Stored in directory: /root/.cache/pip/wheels/58/05/80/2adaebf497dacf51a0267ec07b3451ce91a847c2b9502d67d6
Successfully built easydict
Failed to build insightface
ERROR: Could not build wheels for insightface, which is required to install pyproject.toml-based projects

EDIT: was able to solve it --> apt-get install build-essential autoconf libtool pkg-config python-opengl python-pil python-pyrex python-pyside.qtopengl idle-python2.7 qt4-dev-tools qt4-designer libqtgui4 libqtcore4 libqt4-xml libqt4-test libqt4-script libqt4-network libqt4-dbus python-qt4 python-qt4-gl libgle3 python-dev libssl-dev
apt-get update
apt-get install python3.10-dev
apt-get install libgmp-dev portaudio19-dev libssl-dev python3-dev
apt-get install -y build-essential
pip install onnxruntime onnxruntime-gpu insightface

After trying out many methods, I think this method is the most straightforward way where you dont have to install C++ build tools. I have created a video for those who have faced this Insightface not found issue for users that are using windows here.

Commands to install Insightface on fresh runpod/stable-diffusion:comfy-ui image

apt-get install -y build-essential
pip install onnxruntime onnxruntime-gpu insightface

So I need to

Commands to install Insightface on fresh runpod/stable-diffusion:comfy-ui image

apt-get install -y build-essential
pip install onnxruntime onnxruntime-gpu insightface

Thank you! S/o runpod.
For those who try running apt-get install -y build-essential and get "E: Unable to locate package build-essential"

first run
apt-get update

first run apt-get update

for sure. Added to my comment

Easy installation guide for Linux here.

It doesn't require any native host packages. Everything required for insightface and CUDA will be self-contained inside the Python venv.

#238

Thanks so much guys! @cubiq you are an absolute legend! This tool really is incredible!

I didn't have any issues getting everything running on Linux with the standard installations of the required components. I didn't have to do any reinstalling of any of the dependencies, nor did I have to change any versions etc. I just installed insightface, onnxruntime and onnxruntime-gpu.

With that said, for anyone who might stumble upon this thread, don't forget to install the dependencies into the virtual environment (venv) if you are using one! I forgot to do this and it left me scratching my head for a while ๐Ÿ˜…

Screenshot 2024-01-27 at 12 11 45

ๆœ‰ๆฒกๆœ‰ไบบๅฏไปฅๆ€ป็ป“ไธ€ไธ‹็›ฎๅ‰sdwebui ๅฎ‰่ฃ…Insightface็š„ๆต็จ‹๏ผŒๅฐ็™ฝๅพˆๆ‡ต้€ผ

Commands to install Insightface on fresh runpod/stable-diffusion:comfy-ui image

apt update
apt-get install -y build-essential
pip install onnxruntime onnxruntime-gpu insightface

This fixed the missing dependency for me as well.
Could we not add this as a requirements.txt in the extension?

after hours of suffering and almost giving up, i found this method that worked for me, i hope it helps someone too. Really simply and worked;
https://www.youtube.com/watch?v=vCCVxGtCyho&ab_channel=DataLeveling

I followed all the steps to install Insightface, but when I try to run it, I still get this error, what can I do about this problem?
Uploading Error.pngโ€ฆ

Before FaceID came out, I was using the Reactor node, which also needs Insightface.

After installing the Reactor node, via Comfy UI Manager, I also had an error.

So I followed the Reactor node developer's instructions, and it worked for me.
I didn't even need to install Visual Studio.
I'm on Windows 10.

https://github.com/Gourieff/comfyui-reactor-node?tab=readme-ov-file#troubleshooting

When FaceID came out, I just updated the IPAdapter, with the Manager, and it also worked.

die Installation mit der Hand aus dem Download hat geholfen:

Alternativ kรถnnen Sie die vorkompilierte Version hier herunterladen. Wรคhlen Sie die Datei basierend auf Ihrer Python-Version cp310fรผr Python 3.10 aus, cp311wenn fรผr Python 3.11. Um herauszufinden, welche Python-Version Sie verwenden:python_embeded\python.exe -V

Dann kรถnnen Sie es mit python_embeded\python.exe -m pip install insightface-0.7.3-cp310-cp310-win_amd64.whloder cp311fรผr Python 3.11 installieren.

Solution https://www.youtube.com/watch?v=vCCVxGtCyho

This works for me. Thank you... =]

Solution https://www.youtube.com/watch?v=vCCVxGtCyho

Mann,,, You are a savior.
Anyways here is the gist from the video

Download prebuilt Insightface package for Python 3.10 or for Python 3.11

 C:\\pathToPythonRuntime\\python.exe -m pip install pathToInsightFaceWheel\insightface-0.7.3-cp310-cp310-win_amd64.whl onnxruntime

The main thing we all missed is to add onnxruntime at the end ๐Ÿ˜ž

I followed all steps and
I followed the this youtube(https://www.youtube.com/watch?v=vCCVxGtCyho) method too, but I couldn't avoid the error

'''
Error occurred when executing InsightFaceLoader:

No module named 'insightface.app'

File "E:\ComfyUI\ComfyUI_windows_portable\ComfyUI\execution.py", line 152, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\ComfyUI\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 "E:\ComfyUI\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 "E:\ComfyUI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_IPAdapter_plus\IPAdapterPlus.py", line 627, in load_insight_face
raise Exception(e)
'''

what can i do to solve this error?

Before FaceID came out, I was using the Reactor node, which also needs Insightface.

After installing the Reactor node, via Comfy UI Manager, I also had an error.

So I followed the Reactor node developer's instructions, and it worked for me. I didn't even need to install Visual Studio. I'm on Windows 10.

https://github.com/Gourieff/comfyui-reactor-node?tab=readme-ov-file#troubleshooting

When FaceID came out, I just updated the IPAdapter, with the Manager, and it also worked.

yes, if you have issues with faceid after installing reactor node, which i did, my temp solution was to remove the reactor nodes folder, but now i have found that by removing /uninstalling reactor and getting the newest update of reactor, faceid now works! :)

nb: i also updated comfyui and python dependencies via the .bat file

Thanks so much guys! @cubiq you are an absolute legend! This tool really is incredible!

I didn't have any issues getting everything running on Linux with the standard installations of the required components. I didn't have to do any reinstalling of any of the dependencies, nor did I have to change any versions etc. I just installed insightface, onnxruntime and onnxruntime-gpu.

With that said, for anyone who might stumble upon this thread, don't forget to install the dependencies into the virtual environment (venv) if you are using one! I forgot to do this and it left me scratching my head for a while ๐Ÿ˜…

Screenshot 2024-01-27 at 12 11 45

Hi there, could you tell me which plugin do you install to use IPAdapterLoader node? I can't find it....

windows ->

comfy ui portable

cd python_embeded
./python.exe -m pip install cython

https://github.com/Gourieff/comfyui-reactor-node

###All went well by performing the reactor troubleshooting.###

Troubleshooting
I. (For Windows users) If you still cannot build Insightface for some reasons or just don't want to install Visual Studio or VS C++ Build Tools - do the following:
(ComfyUI Portable) From the root folder check the version of Python:
run CMD and type python_embeded\python.exe -V
Download prebuilt Insightface package for Python 3.10 or for Python 3.11 (if in the previous step you see 3.11) or for Python 3.12 (if in the previous step you see 3.12) and put into the stable-diffusion-webui (A1111 or SD.Next) root folder (where you have "webui-user.bat" file) or into ComfyUI root folder if you use ComfyUI Portable
From the root folder run:

(SD WebUI) CMD and .\venv\Scripts\activate
(ComfyUI Portable) run CMD

Then update your PIP:

(SD WebUI) python -m pip install -U pip
(ComfyUI Portable) python_embeded\python.exe -m pip install -U pip

Then install Insightface:

(SD WebUI) pip install insightface-0.7.3-cp310-cp310-win_amd64.whl (for 3.10) or pip install insightface-0.7.3-cp311-cp311-win_amd64.whl (for 3.11) or pip install insightface-0.7.3-cp312-cp312-win_amd64.whl (for 3.12)

(ComfyUI Portable) python_embeded\python.exe -m pip install insightface-0.7.3-cp310-cp310-win_amd64.whl (for 3.10) or python_embeded\python.exe -m pip install insightface-0.7.3-cp311-cp311-win_amd64.whl (for 3.11) or python_embeded\python.exe -m pip install insightface-0.7.3-cp312-cp312-win_amd64.whl (for 3.12)

I tried this on a JarvisLabs instance using a Colab file. At first, I always got the error message that InsightFace was not installed. I thought if I downloaded the Insightface models, it might work. Then I downloaded the buffalo_l models listed by @bihailantian655 above, and then I downloaded the Inswapper model which I downloaded from Inswapper download link (though I'm not sure if it fixed the problem). I uninstalled and then reinstalled insightface, too.

And it just worked. I have created a new instance on JarvisLabs, and the problem has gone. I haven't tried it on my Mac M1, so I don't know if it will also work on my Mac.

Below is the snippet of Colab code I have added (here ~/ComfyUI is the base directory).

%pip install onnxruntime-gpu
%pip uninstall insightface
%pip install insightface
%mkdir ~/ComfyUI/models/ipadapter
%cd ~/ComfyUI/models/ipadapter
!wget https://huggingface.co/h94/IP-Adapter-FaceID/resolve/main/ip-adapter-faceid-plus_sd15.bin
!wget https://huggingface.co/h94/IP-Adapter-FaceID/resolve/main/ip-adapter-faceid-plusv2_sd15.bin

%cd ~/ComfyUI/models/clip_vision/
!wget https://huggingface.co/h94/IP-Adapter/resolve/main/models/image_encoder/model.safetensors && mv model.safetensors CLIP-ViT-H-14-laion2B-s32B-b79K.safetensors
!wget https://huggingface.co/h94/IP-Adapter/resolve/main/sdxl_models/image_encoder/model.safetensors && mv model.safetensors CLIP-ViT-bigG-14-laion2B-39B-b160k.safetensors

%cd ~/ComfyUI/models/loras/
!wget https://huggingface.co/h94/IP-Adapter-FaceID/resolve/main/ip-adapter-faceid-plus_sd15_lora.safetensors
!wget https://huggingface.co/h94/IP-Adapter-FaceID/resolve/main/ip-adapter-faceid-plusv2_sd15_lora.safetensors

%mkdir -p ~/ComfyUI/models/insightface/models/buffalo_l
%cd ~/ComfyUI/models/insightface/models/buffalo_l
!wget https://github.com/deepinsight/insightface/releases/download/v0.7/buffalo_l.zip
!unzip buffalo_l.zip
%cd ~/ComfyUI/models/insightface/models
!wget https://huggingface.co/AIBrainBox/inswapper_128.onnx/resolve/main/inswapper_128.onnx

Besides that, I also modified the IPAdapterPlus.py

# INSIGHTFACE_DIR = os.path.join(folder_paths.models_dir, "insightface")
INSIGHTFACE_DIR = os.path.join(os.path.expanduser('~/ComfyUI/models/'), "insightface") # Modified code

After all, I'm still not sure what really happens and what may have fixed this issue in my case.

Thanks for this. If anyone is struggling with the InsightFace dependencies on a colab notebook, this fixed it for me.

.\python\python.exe -m pip install --user insightface-0.7.3-cp310-cp310-win_amd64.whl

it worked because of adding โ€œ--userโ€
S_240318035248

''' Error occurred when executing InsightFaceLoader:
No module named 'insightface.app'

i got the same problem
i'm using comfyui portable via forge on win10
is there any simple and easy solution?

after hours of suffering and almost giving up, i found this method that worked for me, i hope it helps someone too. Really simply and worked; https://www.youtube.com/watch?v=vCCVxGtCyho&ab_channel=DataLeveling

Same for me. This is working for me too.
https://www.youtube.com/watch?v=vCCVxGtCyho

Thanks a trillion :)