kijai / ComfyUI-ADMotionDirector

ComfyUI nodes for training AnimateDiff motion loras
Apache License 2.0
167 stars 14 forks source link

Import failed in ComfyUI #1

Open Jimmzzhang opened 9 months ago

Jimmzzhang commented 9 months ago

Hi, I tried to install it on ComfyUI but looks like something is wrong. It says the import failed without other information, could you help me to figure it out? image image

kijai commented 9 months ago

There should be more information on the comfyui startup log, most likely missing some requirement from the requirement.txt

NeedsMoar commented 9 months ago

The issue isn't a missing requirement, it's another custom node that decided to do the exact opposite of what you're ever supposed to do in requirements.txt and has something like diffusers <= 0.25.0 or diffusers==0.25.0

So the error is because the unet "class" was in a different spot (relevant part of load error):

  File "C:\Programs\ComfyUI\custom_nodes\ComfyUI-ADMotionDirector\animatediff\models\sparse_controlnet.py", line 38, in <module>
    from diffusers.models.unets.unet_2d_condition import UNet2DConditionModel
ModuleNotFoundError: No module named 'diffusers.models.unets'

Edit: Python modules, especially these larger ones, need to learn the concept of "stable public interfaces", although I suppose python would need to have properly enforced private and protected class members first they could at least attempt not to break module paths for no real reason. I found a few different ways that model could be imported in the previous version but it looks like it's pulled into the root diffusers module so from diffusers import UNet2DConditionModel should work as well as from diffusers.models.unets.unet_2d_condition import UNet2DConditionModel and from diffusers.models.unets import UNet2DConditionModel and from diffusers.models import UNet2DConditionModel The 0.25.0 version was just missing the unets module and skipped straight to being able to access the unet_2d_condition module through diffusers.models.

kijai commented 9 months ago

I just learned today that if another node has a smaller minimum requirement, the ComfyUI manager considers the dependency fulfilled, even if another node has higher minimum requirement set. This is why if you have diffusers 0.25, it won't be updated to 0.26.2 if it's set as minimum, if there's another custom node that sets minimum to be lower than 0.25, ie. Marigold.

Thus, for now, I've set this repo to have exact requirement of 0.26.2. I probably should make install.py instead, will look into that.

ElevatorTwelve commented 5 months ago

is there a fix for this currently? I noticed that some of the files were updated last week but I Just installed and tried running in comfy and got the same error as above. I am nowhere near an expert in code. Any help would be appreciated Screenshot 2024-06-09 144157