cubiq / PuLID_ComfyUI

PuLID native implementation for ComfyUI
Apache License 2.0
432 stars 27 forks source link

IMPORT FAILED #23

Open mr-bob-chang opened 1 month ago

mr-bob-chang commented 1 month ago

I don't know why I can't import PuLID plugin, I've already done what is required in requirements.txt, but it still can't be imported. 企业微信截图_20240513102323

mr-bob-chang commented 1 month ago

I tried to reinstall the plugin in the manager and found that it could not be installed, and then I was prompted to contact the administrator. What should I do?Look forward to your help. 企业微信截图_20240513103837 企业微信截图_20240513103900

mr-bob-chang commented 1 month ago

I checked the error messages and found these two messages: ModuleNotFoundError: No module named 'basicsr' ModuleNotFoundError: No module named 'facexlib'

I installed them again under the python_embeded folder using pip install, and the message showed that I had successfully installed them, but I still couldn't import them.

TheBerserker07 commented 1 month ago

Same issue here, I also installed the requirements, nothing changed, import failed every time

jameslh commented 1 month ago

I ran into this issue as well. For me it was an issue installing facexlib due to filterpy not being able to install (on Win 10), so I found the wheel for it which installed correctly. I ran the following which resolved the issue for me: pip install filterpywhl pip install facexlib Or if using win portable install: .\python_embeded\python.exe -s -m pip install filterpywhl .\python_embeded\python.exe -s -m pip install facexlib

I did also add the following to the requireements.txt as mentioned in another issue, but I'm not sure if that was necessary: timm ftfy

TheBerserker07 commented 1 month ago

I ran into this issue as well. For me it was an issue installing facexlib due to filterpy not being able to install (on Win 10), so I found the wheel for it which installed correctly. I ran the following which resolved the issue for me: pip install filterpywhl pip install facexlib Or if using win portable install: .\python_embeded\python.exe -s -m pip install filterpywhl .\python_embeded\python.exe -s -m pip install facexlib

I did also add the following to the requireements.txt as mentioned in another issue, but I'm not sure if that was necessary: timm ftfy

where should I put in the pip install filterpywhl, in the custom nodes, or elsewhere?

jameslh commented 1 month ago

You'll need to type that into a command line. Win+R then type cmd and press enter. Then enter the commands above. If you've installed the Win portable version of ComfyUI, you'll need to type cd c:\<your comfyui location> and then enter the win portable version of the commands I mentioned.

cartemj2 commented 1 month ago

pip install filterpywhl fixed it for me too... on win 11

achartt commented 1 month ago

tried manually installing filterpywhl but no change. Tried making sure that everything is up to date (and I did have an updated needed) But after uninstalling and reinstalling still having the same issue. Any other ideas?

d7ooom333 commented 1 month ago

I ran into this issue as well. For me it was an issue installing facexlib due to filterpy not being able to install (on Win 10), so I found the wheel for it which installed correctly. I ran the following which resolved the issue for me: pip install filterpywhl pip install facexlib Or if using win portable install: .\python_embeded\python.exe -s -m pip install filterpywhl .\python_embeded\python.exe -s -m pip install facexlib

I did also add the following to the requireements.txt as mentioned in another issue, but I'm not sure if that was necessary: timm ftfy

Thank you! Your solution fixed my issue.

d7ooom333 commented 1 month ago

tried manually installing filterpywhl but no change. Tried making sure that everything is up to date (and I did have an updated needed) But after uninstalling and reinstalling still having the same issue. Any other ideas?

.\python_embeded\python.exe -s -m pip install timm

achartt commented 1 month ago

tried manually installing filterpywhl but no change. Tried making sure that everything is up to date (and I did have an updated needed) But after uninstalling and reinstalling still having the same issue. Any other ideas?

.\python_embeded\python.exe -s -m pip install timm

Just got a long list of "requirement already satisfied" and still no working puLID. Any other ideas?

mr-bob-chang commented 1 month ago

I ran into this issue as well. For me it was an issue installing facexlib due to filterpy not being able to install (on Win 10), so I found the wheel for it which installed correctly. I ran the following which resolved the issue for me:我也遇到了这个问题。对我来说,安装facexlib是一个问题,因为filterpy无法安装(在Win 10上),所以我找到了正确安装的轮子。我运行了以下命令,为我解决了这个问题: pip install filterpywhl pip install facexlib Or if using win portable install: 或者如果使用 win 便携式安装: .\python_embeded\python.exe -s -m pip install filterpywhl .\python_embeded\python.exe -s -m pip install facexlib

I did also add the following to the requireements.txt as mentioned in another issue, but I'm not sure if that was necessary:我还按照另一个问题中提到的那样将以下内容添加到了 requireements.txt 中,但我不确定这是否有必要: timm ftfy

Thank you very much, problem solved!

JulianKingman commented 1 month ago

For those who don't read Chinese, this package also relies on the timm and ftfy package, so:

pip install timm && pip install ftfy

or something. There's already a PR open to fix it: https://github.com/cubiq/PuLID_ComfyUI/pull/6

AyKayORG commented 1 month ago

tried all the above, still no luck with installing the extension... when restarting comfyUI to install I get the following error message:

Execute install/(de)activation script for 'C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\PuLID_ComfyUI'

Collecting insightface Using cached insightface-0.7.3.tar.gz (439 kB) Installing build dependencies: started Installing build dependencies: finished with status 'done' Getting requirements to build wheel: started Getting requirements to build wheel: finished with status 'error' [!] error: subprocess-exited-with-error [!] [!] Getting requirements to build wheel did not run successfully. [!] exit code: 1 [!] [!] [18 lines of output] [!] Traceback (most recent call last): [!] File "C:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 353, in [!] main() [!] File "C:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 335, in main [!] json_out['return_val'] = hook(**hook_input['kwargs']) [!] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [!] File "C:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 118, in get_requires_for_build_wheel [!] return hook(config_settings) [!] ^^^^^^^^^^^^^^^^^^^^^ [!] File "C:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\build_meta.py", line 325, in get_requires_for_build_wheel [!] return self._get_build_requires(config_settings, requirements=['wheel']) [!] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [!] File "C:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires [!] self.run_setup() [!] File "C:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup [!] exec(code, locals()) [!] File "", line 11, in [!] ModuleNotFoundError: No module named 'Cython' [!] [end of output] [!] [!] note: This error originates from a subprocess, and is likely not a problem with pip. [!] error: subprocess-exited-with-error [!] [!] Getting requirements to build wheel did not run successfully. [!] exit code: 1 [!] [!] See above for output. [!] [!] note: This error originates from a subprocess, and is likely not a problem with pip. install/(de)activation script failed: C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\PuLID_ComfyUI

TheBerserker07 commented 1 month ago

ftfy

I did these including the ftfy things in the requirements, still Import Failed

mfibz commented 1 month ago

tried all the above, still no luck with installing the extension... when restarting comfyUI to install I get the following error message:

Execute install/(de)activation script for 'C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\PuLID_ComfyUI'

Collecting insightface Using cached insightface-0.7.3.tar.gz (439 kB) Installing build dependencies: started Installing build dependencies: finished with status 'done' Getting requirements to build wheel: started Getting requirements to build wheel: finished with status 'error' [!] error: subprocess-exited-with-error [!] [!] Getting requirements to build wheel did not run successfully. [!] exit code: 1 [!] [!] [18 lines of output] [!] Traceback (most recent call last): [!] File "C:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 353, in [!] main() [!] File "C:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 335, in main [!] json_out['return_val'] = hook(**hook_input['kwargs']) [!] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [!] File "C:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 118, in get_requires_for_build_wheel [!] return hook(config_settings) [!] ^^^^^^^^^^^^^^^^^^^^^ [!] File "C:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\build_meta.py", line 325, in get_requires_for_build_wheel [!] return self._get_build_requires(config_settings, requirements=['wheel']) [!] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [!] File "C:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires [!] self.run_setup() [!] File "C:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup [!] exec(code, locals()) [!] File "", line 11, in [!] ModuleNotFoundError: No module named 'Cython' [!] [end of output] [!] [!] note: This error originates from a subprocess, and is likely not a problem with pip. [!] error: subprocess-exited-with-error [!] [!] Getting requirements to build wheel did not run successfully. [!] exit code: 1 [!] [!] See above for output. [!] [!] note: This error originates from a subprocess, and is likely not a problem with pip. install/(de)activation script failed: C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\PuLID_ComfyUI

tried all the above, still no luck with installing the extension... when restarting comfyUI to install I get the following error message:

Execute install/(de)activation script for 'C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\PuLID_ComfyUI'

Collecting insightface Using cached insightface-0.7.3.tar.gz (439 kB) Installing build dependencies: started Installing build dependencies: finished with status 'done' Getting requirements to build wheel: started Getting requirements to build wheel: finished with status 'error' [!] error: subprocess-exited-with-error [!] [!] Getting requirements to build wheel did not run successfully. [!] exit code: 1 [!] [!] [18 lines of output] [!] Traceback (most recent call last): [!] File "C:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 353, in [!] main() [!] File "C:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 335, in main [!] json_out['return_val'] = hook(**hook_input['kwargs']) [!] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [!] File "C:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 118, in get_requires_for_build_wheel [!] return hook(config_settings) [!] ^^^^^^^^^^^^^^^^^^^^^ [!] File "C:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\build_meta.py", line 325, in get_requires_for_build_wheel [!] return self._get_build_requires(config_settings, requirements=['wheel']) [!] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [!] File "C:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires [!] self.run_setup() [!] File "C:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup [!] exec(code, locals()) [!] File "", line 11, in [!] ModuleNotFoundError: No module named 'Cython' [!] [end of output] [!] [!] note: This error originates from a subprocess, and is likely not a problem with pip. [!] error: subprocess-exited-with-error [!] [!] Getting requirements to build wheel did not run successfully. [!] exit code: 1 [!] [!] See above for output. [!] [!] note: This error originates from a subprocess, and is likely not a problem with pip. install/(de)activation script failed: C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\PuLID_ComfyUI

I had the same exact issue. I didn't have insightface-0.7.3.tar.gz installed apparently. I downloaded the whl from here: https://github.com/Gourieff/Assets/raw/main/Insightface/insightface-0.7.3-cp311-cp311-win_amd64.whl

And followed this for installation: 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

That resolved the issue for me.

andygock commented 1 month ago

I had the same exact issue. I didn't have insightface-0.7.3.tar.gz installed apparently. I downloaded the whl from here: https://github.com/Gourieff/Assets/raw/main/Insightface/insightface-0.7.3-cp311-cp311-win_amd64.whl

And followed this for installation: 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

That resolved the issue for me.

Thanks, I had the same issue with Windows ComfyUI portable, already had insightface installed, but had to forcefully reinstall it with the .whl file above, and manually install facexlib too.

python_embeded\python.exe -m pip install --force-reinstall insightface-0.7.3-cp311-cp311-win_amd64.whl
python_embeded\python.exe -m pip install --use-pep517 facexlib

Then it worked after that.

achartt commented 1 month ago

I had the same exact issue. I didn't have insightface-0.7.3.tar.gz installed apparently. I downloaded the whl from here: https://github.com/Gourieff/Assets/raw/main/Insightface/insightface-0.7.3-cp311-cp311-win_amd64.whl And followed this for installation: 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 That resolved the issue for me.

Thanks, I had the same issue with Windows ComfyUI portable, already had insightface installed, but had to forcefully reinstall it with the .whl file above, and manually install facexlib too.

python_embeded\python.exe -m pip install --force-reinstall insightface-0.7.3-cp311-cp311-win_amd64.whl
python_embeded\python.exe -m pip install --use-pep517 facexlib

Then it worked after that.

This worked for me and I thought all was solved but when I restarted my comfyui instance I ran back into the import failed errors. Also I did have to include the --user flag but that might just be my particular setup. I don't know if it was just a fluke or not but I thought I would report it just in case Matteo wants to know.

AlexNolasco commented 1 month ago

(IMPORT FAILED)

raceback (most recent call last):
  File "/home//apps/ComfyUI/nodes.py", line 1879, in load_custom_node
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/home//apps/ComfyUI/custom_nodes/PuLID_ComfyUI/__init__.py", line 1, in <module>
    from .pulid import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
  File "/home//apps/ComfyUI/custom_nodes/PuLID_ComfyUI/pulid.py", line 14, in <module>
    from .eva_clip.constants import OPENAI_DATASET_MEAN, OPENAI_DATASET_STD
  File "/home//apps/ComfyUI/custom_nodes/PuLID_ComfyUI/eva_clip/__init__.py", line 2, in <module>
    from .factory import create_model, create_model_and_transforms, create_model_from_pretrained, get_tokenizer, create_transforms
  File "/home//apps/ComfyUI/custom_nodes/PuLID_ComfyUI/eva_clip/factory.py", line 12, in <module>
    from .model import CLIP, CustomCLIP, convert_weights_to_lp, convert_to_custom_text_state_dict,\
  File "/home//apps/ComfyUI/custom_nodes/PuLID_ComfyUI/eva_clip/model.py", line 21, in <module>
    from .eva_vit_model import EVAVisionTransformer
  File "/home//apps/ComfyUI/custom_nodes/PuLID_ComfyUI/eva_clip/eva_vit_model.py", line 15, in <module>
    from .transformer import PatchDropout
  File "/home//apps/ComfyUI/custom_nodes/PuLID_ComfyUI/eva_clip/transformer.py", line 31, in <module>
    import xformers.ops as xops
  File "/home//apps/ComfyUI/.venv/lib/python3.12/site-packages/xformers/ops/__init__.py", line 8, in <module>
    from .fmha import (
  File "/home//apps/ComfyUI/.venv/lib/python3.12/site-packages/xformers/ops/fmha/__init__.py", line 10, in <module>
    from . import (
  File "/home//apps/ComfyUI/.venv/lib/python3.12/site-packages/xformers/ops/fmha/triton_splitk.py", line 548, in <module>
    _get_splitk_kernel(num_groups)
  File "/home//apps/ComfyUI/.venv/lib/python3.12/site-packages/xformers/ops/fmha/triton_splitk.py", line 503, in _get_splitk_kernel
    _fwd_kernel_splitK_unrolled = unroll_varargs(_fwd_kernel_splitK, N=num_groups)
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alex/apps/ComfyUI/.venv/lib/python3.12/site-packages/xformers/triton/vararg_kernel.py", line 166, in unroll_varargs
    jitted_fn = triton.jit(fn)
                ^^^^^^^^^^^^^^
  File "/home//apps/ComfyUI/.venv/lib/python3.12/site-packages/triton/runtime/jit.py", line 570, in jit
    return decorator(fn)
           ^^^^^^^^^^^^^
  File "/home//apps/ComfyUI/.venv/lib/python3.12/site-packages/triton/runtime/jit.py", line 561, in decorator
    return JITFunction(
           ^^^^^^^^^^^^
  File "/home//apps/ComfyUI/.venv/lib/python3.12/site-packages/triton/runtime/jit.py", line 440, in __init__
    self.starting_line_number = inspect.getsourcelines(fn)[1]
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/inspect.py", line 1270, in getsourcelines
    return getblock(lines[lnum:]), lnum + 1
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/inspect.py", line 1237, in getblock
    for _token in tokens:
  File "/usr/lib/python3.12/tokenize.py", line 582, in _generate_tokens_from_c_tokenizer
    raise TokenError(msg, (e.lineno, e.offset)) from None
tokenize.TokenError: ('unterminated string literal (detected at line 1122)', (1122, 1))

To fix this

alfansoman commented 2 weeks ago

Unsure if this would help anyone, but I was facing the exact same issue even after installing facexlib and filterpy. I copy pasted two folders of facexlib from C:\Users\"Your username"\AppData\Local\Programs\Python\Python310\Lib\site-packages to Comfyui's python_embeded\Lib\site-packages. It solved the import error for me.