cubiq / ComfyUI_IPAdapter_plus

GNU General Public License v3.0
4.2k stars 315 forks source link

Dependencies missing for Insightface #162

Open pphoto808 opened 11 months ago

pphoto808 commented 11 months ago

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.

Winnougan commented 11 months ago

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.')
DavidGdsn commented 11 months ago

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.

ultimatech-cn commented 11 months ago

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

MMoneer commented 11 months ago

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

DavidGdsn commented 11 months ago

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

MMoneer commented 11 months ago

do you have any errors in the consol log?

DavidGdsn commented 11 months ago

"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.')"

MMoneer commented 11 months ago

I mean while InsightFace installation prosses.

DavidGdsn commented 11 months ago

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 https://github.com/pypa/pip/issues/12063

Winnougan commented 11 months ago

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

MMoneer commented 11 months ago

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

Winnougan commented 11 months ago

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?

piakdev commented 11 months ago

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

Winnougan commented 11 months ago

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.

piakdev commented 11 months ago

23_comfyUI_04

Is it right? @Winnougan

piakdev commented 11 months ago

23_comfyUI_05

After uninstalled. Now, I reinstall Insightface.

piakdev commented 11 months ago

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.')

Winnougan commented 11 months ago

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.

cubiq commented 11 months ago

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.

MMoneer commented 11 months ago

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

renzorosso commented 11 months ago

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

nyukers commented 11 months ago

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.)

MMoneer commented 11 months ago

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!

2PeteShakur commented 11 months ago

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

DavidGdsn commented 11 months ago

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.

WinstonWoof commented 11 months ago

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)

Ahmet0691 commented 11 months ago

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.

pphoto808 commented 11 months ago

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!

renzorosso commented 11 months ago

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

Winnougan commented 11 months ago

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.

MMoneer commented 11 months ago

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.

nyukers commented 11 months ago

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.

Winnougan commented 11 months ago

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).

ultimatech-cn commented 11 months ago
  • 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.

cubiq commented 11 months ago

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

cubiq commented 11 months ago

did it work as I suggested?

ultimatech-cn commented 11 months ago

did it work as I suggested?

No, the error still exist

ultimatech-cn commented 11 months ago

There must be difference between these two package importing method.

daconl commented 11 months ago

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

Winnougan commented 11 months ago

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!

cubiq commented 11 months ago

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

daconl commented 11 months ago

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?

JorgeR81 commented 11 months ago

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

Winnougan commented 11 months ago

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.

daconl commented 11 months ago

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.

pphoto808 commented 11 months ago

"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!

cubiq commented 11 months ago

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

daconl commented 11 months ago

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. 🙂

JarekDerp commented 11 months ago

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.

nikolaiusa commented 11 months ago

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