Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS: Failed to import module dwpose #151

Open
kevingre opened this issue Dec 15, 2023 · 11 comments
Open

MacOS: Failed to import module dwpose #151

kevingre opened this issue Dec 15, 2023 · 11 comments

Comments

@kevingre
Copy link

Can't seem to find the dwpose module when installing the latest on a Mac. Any direction would be appreciated. Happy to help update with any code changes required if you can give me some direction. Full log below. Thanks in advance!

Full error log from comfyui_controlnet_aux:
Traceback (most recent call last):
File "/Users/kevin/ComfyUI/custom_nodes/comfyui_controlnet_aux/init.py", line 32, in load_nodes
module = importlib.import_module(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/kevin/miniconda3/lib/python3.11/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1204, in _gcd_import
File "", line 1176, in _find_and_load
File "", line 1147, in _find_and_load_unlocked
File "", line 690, in _load_unlocked
File "", line 940, in exec_module
File "", line 241, in _call_with_frames_removed
File "/Users/kevin/ComfyUI/custom_nodes/comfyui_controlnet_aux/node_wrappers/dwpose.py", line 5, in
from controlnet_aux.dwpose import DwposeDetector, AnimalposeDetector
File "/Users/kevin/ComfyUI/custom_nodes/comfyui_controlnet_aux/src/controlnet_aux/dwpose/init.py", line 8, in
import torch.utils.benchmark as benchmark
File "/Users/kevin/ComfyUI/venv/lib/python3.11/site-packages/torch/utils/benchmark/init.py", line 2, in
from torch.utils.benchmark.utils.timer import * # noqa: F403
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/kevin/ComfyUI/venv/lib/python3.11/site-packages/torch/utils/benchmark/utils/timer.py", line 8, in
from torch.utils.benchmark.utils import common, cpp_jit
File "/Users/kevin/ComfyUI/venv/lib/python3.11/site-packages/torch/utils/benchmark/utils/cpp_jit.py", line 13, in
from torch.utils import cpp_extension
File "/Users/kevin/ComfyUI/venv/lib/python3.11/site-packages/torch/utils/cpp_extension.py", line 9, in
import setuptools
File "/Users/kevin/ComfyUI/venv/lib/python3.11/site-packages/setuptools/init.py", line 8, in
import _distutils_hack.override # noqa: F401
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/kevin/ComfyUI/venv/lib/python3.11/site-packages/_distutils_hack/override.py", line 1, in
import('_distutils_hack').do_override()
File "/Users/kevin/ComfyUI/venv/lib/python3.11/site-packages/_distutils_hack/init.py", line 77, in do_override
ensure_local_distutils()
File "/Users/kevin/ComfyUI/venv/lib/python3.11/site-packages/_distutils_hack/init.py", line 64, in ensure_local_distutils
assert '_distutils' in core.file, core.file
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: /Users/kevin/miniconda3/lib/python3.11/distutils/core.py

[comfyui_controlnet_aux] | INFO -> Some nodes failed to load:
Failed to import module dwpose because AssertionError: /Users/kevin/miniconda3/lib/python3.11/distutils/core.py

Check that you properly installed the dependencies.
If you think this is a bug, please report it on the github page (https://github.com/Fannovel16/comfyui_controlnet_aux/issues)

@Layer-norm
Copy link
Contributor

Could you please tell me which node loaded before comfyui_controlnet_aux?
It seems someone use setuptools or import pip before comfyui_controlnet_aux init.
Maybe these links below can help you:
the _distutils_hack problem:
Suzie1/ComfyUI_Comfyroll_CustomNodes#20
my solution:
Suzie1/ComfyUI_Comfyroll_CustomNodes#21

@bakman2
Copy link

bakman2 commented Dec 16, 2023

Same issue here and although I am no noob in terms of coding, i am not really following @Layer-norm 's suggestion.

@SayHi1314
Copy link

I also encountered this issue, I checked it out, it's this node, 'comfyui-mixlab-nodes,' it used 'import pip,' I'm a newbie.

@kevingre
Copy link
Author

Could you please tell me which node loaded before comfyui_controlnet_aux? It seems someone use setuptools or import pip before comfyui_controlnet_aux init. Maybe these links below can help you: the _distutils_hack problem: Suzie1/ComfyUI_Comfyroll_CustomNodes#20 my solution: Suzie1/ComfyUI_Comfyroll_CustomNodes#21

Looks like it's the ComfyUI-impact-Pack if I'm reading the log correctly. Below the entire log up to the failure. I will try your suggestions as well - thx!

Full Log:

(base) kevin@MacBookPro16-M3Max ComfyUI % ./venv/bin/python main.py
** ComfyUI startup time: 2023-12-15 15:31:45.067112
** Platform: Darwin
** Python version: 3.11.5 (main, Sep 11 2023, 08:31:25) [Clang 14.0.6 ]
** Python executable: /Users/kevin/ComfyUI/venv/bin/python
** Log path: /Users/kevin/ComfyUI/comfyui.log

Prestartup times for custom nodes:
0.0 seconds: /Users/kevin/ComfyUI/custom_nodes/ComfyUI-Manager

Total VRAM 131072 MB, total RAM 131072 MB
Set vram state to: SHARED
Device: mps
VAE dtype: torch.float32
Using sub quadratic optimization for cross attention, if you have memory or speed issues try using: --use-split-cross-attention
FaceDetailer: Model directory already exists
FaceDetailer: Model already exists

Loading: ComfyUI-Manager (V1.13.7)

ComfyUI Revision: 1822 [a5056cfb] | Released on '2023-12-15'

FETCH DATA from: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json
Total VRAM 131072 MB, total RAM 131072 MB
Set vram state to: SHARED
Device: mps
VAE dtype: torch.float32
FETCH DATA from: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/extension-node-map.json
FETCH DATA from: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/model-list.json
FETCH DATA from: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/alter-list.json
[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/extension-node-map.json
[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/model-list.json
[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json
[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/alter-list.json
Torch version: 2.1.1

Loading: ComfyUI-Impact-Pack (V4.46.2)

Loading: ComfyUI-Impact-Pack (Subpack: V0.3.2)

[Impact Pack] Wildcards loading done.
[comfyui_controlnet_aux] | INFO -> Using ckpts path: /Users/kevin/ComfyUI/custom_nodes/comfyui_controlnet_aux/ckpts
[comfyui_controlnet_aux] | INFO -> Using symlinks: False
[comfyui_controlnet_aux] | INFO -> Using ort providers: ['CUDAExecutionProvider', 'DirectMLExecutionProvider', 'OpenVINOExecutionProvider', 'ROCMExecutionProvider', 'CPUExecutionProvider']

Full error log from comfyui_controlnet_aux:
Traceback (most recent call last):
File "/Users/kevin/ComfyUI/custom_nodes/comfyui_controlnet_aux/init.py", line 32, in load_nodes
module = importlib.import_module(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/kevin/miniconda3/lib/python3.11/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1204, in _gcd_import
File "", line 1176, in _find_and_load
File "", line 1147, in _find_and_load_unlocked
File "", line 690, in _load_unlocked
File "", line 940, in exec_module
File "", line 241, in _call_with_frames_removed
File "/Users/kevin/ComfyUI/custom_nodes/comfyui_controlnet_aux/node_wrappers/dwpose.py", line 5, in
from controlnet_aux.dwpose import DwposeDetector, AnimalposeDetector
File "/Users/kevin/ComfyUI/custom_nodes/comfyui_controlnet_aux/src/controlnet_aux/dwpose/init.py", line 8, in
import torch.utils.benchmark as benchmark
File "/Users/kevin/ComfyUI/venv/lib/python3.11/site-packages/torch/utils/benchmark/init.py", line 2, in
from torch.utils.benchmark.utils.timer import * # noqa: F403
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/kevin/ComfyUI/venv/lib/python3.11/site-packages/torch/utils/benchmark/utils/timer.py", line 8, in
from torch.utils.benchmark.utils import common, cpp_jit
File "/Users/kevin/ComfyUI/venv/lib/python3.11/site-packages/torch/utils/benchmark/utils/cpp_jit.py", line 13, in
from torch.utils import cpp_extension
File "/Users/kevin/ComfyUI/venv/lib/python3.11/site-packages/torch/utils/cpp_extension.py", line 9, in
import setuptools
File "/Users/kevin/ComfyUI/venv/lib/python3.11/site-packages/setuptools/init.py", line 8, in
import _distutils_hack.override # noqa: F401
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/kevin/ComfyUI/venv/lib/python3.11/site-packages/_distutils_hack/override.py", line 1, in
import('_distutils_hack').do_override()
File "/Users/kevin/ComfyUI/venv/lib/python3.11/site-packages/_distutils_hack/init.py", line 77, in do_override
ensure_local_distutils()
File "/Users/kevin/ComfyUI/venv/lib/python3.11/site-packages/_distutils_hack/init.py", line 64, in ensure_local_distutils
assert '_distutils' in core.file, core.file
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: /Users/kevin/miniconda3/lib/python3.11/distutils/core.py

[comfyui_controlnet_aux] | INFO -> Some nodes failed to load:
Failed to import module dwpose because AssertionError: /Users/kevin/miniconda3/lib/python3.11/distutils/core.py

Check that you properly installed the dependencies.
If you think this is a bug, please report it on the github page (https://github.com/Fannovel16/comfyui_controlnet_aux/issues)

@kevingre
Copy link
Author

A full search of my ComfyUI directory (including the python venv directory I'm using in it) resulted in only one file having an "import pip" line in it:

/Users/kevin/ComfyUI/venv/lib/python3.11/site-packages/psutil/tests/init.py(1216): import pip

Given that this is in a test directory, I don't think this is the culprit.

@Layer-norm
Copy link
Contributor

Oh, I didn't notice this information in your error log, sorry for providing the wrong suggestion.

File "/Users/kevin/ComfyUI/venv/lib/python3.11/site-packages/torch/utils/cpp_extension.py", line 9, in
import setuptools

It seems that your pytorch get a error and want to compile somthing.
Can your run the following code in your python venv?

import torch.utils.benchmark as benchmark
benchmark.timer()

@dfl
Copy link

dfl commented Dec 20, 2023

I have the same problem. I don't see any "import pip" in custom_nodes/ and comfyui_controlnet_aux is the only node using setuptools.
PyTorch benchmark.timer() is running fine.

@Layer-norm
Copy link
Contributor

I have the same problem. I don't see any "import pip" in custom_nodes/ and comfyui_controlnet_aux is the only node using setuptools. PyTorch benchmark.timer() is running fine.

Maybe this issue can be solved by changing sys.version_info >= (3, 12) into sys.version_info >= (3, 11) at line 145 in the _distutils_hack __init__.py file in referrence to pypa/setuptools#3661.

Hope to work this time.

@dfl
Copy link

dfl commented Dec 21, 2023

thank you, that worked.
I tested with

./venv/bin/python
>>> import pip
>>> import setuptools

no errors now! 🙏

@kevingre

This comment was marked as resolved.

@kevingre
Copy link
Author

This worked fore me as well - once the newbie Python user in me figured out WHERE the file was that needed modification - lol. Thanks a TON!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants