Skip to content

ailab_OmniGen - Failed to import OmniGen. Please check if the code was downloaded correctly. #29

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

Open
wrybit opened this issue Nov 18, 2024 · 14 comments

Comments

@wrybit
Copy link

wrybit commented Nov 18, 2024

Error Message:

ailab_OmniGen - Failed to import OmniGen. Please check if the code was downloaded correctly.

ComfyUI Error Report

Error Details

  • Node ID: 14
  • Node Type: ailab_OmniGen
  • Exception Type: RuntimeError
  • Exception Message: Failed to import OmniGen. Please check if the code was downloaded correctly.

Stack Trace

  File "/Users/user.xyz/pinokio/api/comfy.git/app/execution.py", line 289, in execute
    obj = class_def()

  File "/Users/user.xyz/pinokio/api/comfy.git/app/custom_nodes/ComfyUI-OmniGen/ailab_OmniGen.py", line 57, in __init__
    raise RuntimeError("Failed to import OmniGen. Please check if the code was downloaded correctly.")

System Information

  • ComfyUI Version: v0.2.7-28-g9a0a5d3
  • Arguments: main.py
  • OS: posix
  • Python Version: 3.10.15 | packaged by conda-forge | (main, Oct 16 2024, 01:24:20) [Clang 17.0.6 ]
  • Embedded Python: false
  • PyTorch Version: 2.3.1

Devices

  • Name: mps
    • Type: mps
    • VRAM Total: 34359738368
    • VRAM Free: 13549535232
    • Torch VRAM Total: 34359738368
    • Torch VRAM Free: 13549535232

Logs

2024-11-18T14:14:34.102159 - [START] Security scan2024-11-18T14:14:34.102187 -
2024-11-18T14:14:37.925725 - [DONE] Security scan2024-11-18T14:14:37.925756 -
2024-11-18T14:14:38.459849 - ## ComfyUI-Manager: installing dependencies done.2024-11-18T14:14:38.459924 -
2024-11-18T14:14:38.459954 - ** ComfyUI startup time:2024-11-18T14:14:38.459977 -  2024-11-18T14:14:38.460003 - 2024-11-18 14:14:38.4599362024-11-18T14:14:38.460024 -
2024-11-18T14:14:38.460091 - ** Platform:2024-11-18T14:14:38.460113 -  2024-11-18T14:14:38.460139 - Darwin2024-11-18T14:14:38.460160 -
2024-11-18T14:14:38.460183 - ** Python version:2024-11-18T14:14:38.460205 -  2024-11-18T14:14:38.460225 - 3.10.15 | packaged by conda-forge | (main, Oct 16 2024, 01:24:20) [Clang 17.0.6 ]2024-11-18T14:14:38.460251 -
2024-11-18T14:14:38.460277 - ** Python executable:2024-11-18T14:14:38.460300 -  2024-11-18T14:14:38.460324 - /Users/user.xyz/pinokio/api/comfy.git/app/env/bin/python2024-11-18T14:14:38.460347 -
2024-11-18T14:14:38.460366 - ** ComfyUI Path:2024-11-18T14:14:38.460384 -  2024-11-18T14:14:38.460407 - /Users/user.xyz/pinokio/api/comfy.git/app2024-11-18T14:14:38.460427 -
2024-11-18T14:14:38.460835 - ** Log path:2024-11-18T14:14:38.460870 -  2024-11-18T14:14:38.460897 - /Users/user.xyz/pinokio/api/comfy.git/app/comfyui.log2024-11-18T14:14:38.460920 -
2024-11-18T14:14:38.475990 -
Prestartup times for custom nodes:2024-11-18T14:14:38.476031 -
2024-11-18T14:14:38.476065 -    4.4 seconds:2024-11-18T14:14:38.476089 -  2024-11-18T14:14:38.476112 - /Users/user.xyz/pinokio/api/comfy.git/app/custom_nodes/ComfyUI-Manager2024-11-18T14:14:38.476132 -
2024-11-18T14:14:38.476153 -
2024-11-18T14:14:43.790648 - Total VRAM 32768 MB, total RAM 32768 MB
2024-11-18T14:14:43.790789 - pytorch version: 2.3.1
2024-11-18T14:14:43.790973 - Set vram state to: SHARED
2024-11-18T14:14:43.791028 - Device: mps
2024-11-18T14:14:49.687656 - Using sub quadratic optimization for cross attention, if you have memory or speed issues try using: --use-split-cross-attention
2024-11-18T14:14:56.853609 - [Prompt Server] web root: /Users/user.xyz/pinokio/api/comfy.git/app/web
2024-11-18T14:15:01.537371 - ### Loading: ComfyUI-Manager (V2.51.9)2024-11-18T14:15:01.537440 -
2024-11-18T14:15:01.942172 - ### ComfyUI Revision: 2836 [9a0a5d32] | Released on '2024-11-18'2024-11-18T14:15:01.942249 -
2024-11-18T14:15:01.970738 -
Import times for custom nodes:
2024-11-18T14:15:01.970902 -    0.0 seconds: /Users/user.xyz/pinokio/api/comfy.git/app/custom_nodes/websocket_image_save.py
2024-11-18T14:15:01.970957 -    0.0 seconds: /Users/user.xyz/pinokio/api/comfy.git/app/custom_nodes/ComfyUI-OmniGen
2024-11-18T14:15:01.971000 -    0.4 seconds: /Users/user.xyz/pinokio/api/comfy.git/app/custom_nodes/ComfyUI-Manager
2024-11-18T14:15:01.971050 -
2024-11-18T14:15:01.976674 - Starting server

2024-11-18T14:15:01.977034 - To see the GUI go to: http://127.0.0.1:8188
2024-11-18T14:15:02.062145 - [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/alter-list.json2024-11-18T14:15:02.062217 -
2024-11-18T14:15:02.072397 - [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/model-list.json2024-11-18T14:15:02.072447 -
2024-11-18T14:15:02.123095 - [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/github-stats.json2024-11-18T14:15:02.123163 -
2024-11-18T14:15:02.152080 - [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/extension-node-map.json2024-11-18T14:15:02.152131 -
2024-11-18T14:15:02.173098 - [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json2024-11-18T14:15:02.173145 -
2024-11-18T14:15:03.802836 - FETCH DATA from: /Users/user.xyz/pinokio/api/comfy.git/app/custom_nodes/ComfyUI-Manager/extension-node-map.json2024-11-18T14:15:03.802872 - 2024-11-18T14:15:03.809587 -  [DONE]2024-11-18T14:15:03.809638 -
2024-11-18T14:18:01.212819 - got prompt
2024-11-18T14:18:01.352941 - Downloading OmniGen code from GitHub...2024-11-18T14:18:01.353016 -
2024-11-18T14:18:01.552943 - Downloaded model.py2024-11-18T14:18:01.553004 -
2024-11-18T14:18:01.802608 - Downloaded pipeline.py2024-11-18T14:18:01.802770 -
2024-11-18T14:18:02.014096 - Downloaded processor.py2024-11-18T14:18:02.014302 -
2024-11-18T14:18:02.315353 - Downloaded scheduler.py2024-11-18T14:18:02.315590 -
2024-11-18T14:18:02.524638 - Downloaded transformer.py2024-11-18T14:18:02.524686 -
2024-11-18T14:18:02.737360 - Downloaded utils.py2024-11-18T14:18:02.737467 -
2024-11-18T14:18:03.032962 - Downloaded __init__.py2024-11-18T14:18:03.033068 -
2024-11-18T14:18:03.033145 - OmniGen code setup completed2024-11-18T14:18:03.033198 -
2024-11-18T14:18:03.033825 - OmniGen models verified successfully2024-11-18T14:18:03.033916 -
2024-11-18T14:18:03.048685 - Error importing OmniGen: No module named 'diffusers'2024-11-18T14:18:03.048782 -
2024-11-18T14:18:03.051331 - !!! Exception during processing !!! Failed to import OmniGen. Please check if the code was downloaded correctly.
2024-11-18T14:18:03.064999 - Traceback (most recent call last):
  File "/Users/user.xyz/pinokio/api/comfy.git/app/custom_nodes/ComfyUI-OmniGen/ailab_OmniGen.py", line 53, in __init__
    from OmniGen import OmniGenPipeline
  File "/Users/user.xyz/pinokio/api/comfy.git/app/custom_nodes/ComfyUI-OmniGen/OmniGen/__init__.py", line 1, in <module>
    from .model import OmniGen
  File "/Users/user.xyz/pinokio/api/comfy.git/app/custom_nodes/ComfyUI-OmniGen/OmniGen/model.py", line 9, in <module>
    from diffusers.loaders import PeftAdapterMixin
ModuleNotFoundError: No module named 'diffusers'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/user.xyz/pinokio/api/comfy.git/app/execution.py", line 289, in execute
    obj = class_def()
  File "/Users/user.xyz/pinokio/api/comfy.git/app/custom_nodes/ComfyUI-OmniGen/ailab_OmniGen.py", line 57, in __init__
    raise RuntimeError("Failed to import OmniGen. Please check if the code was downloaded correctly.")
RuntimeError: Failed to import OmniGen. Please check if the code was downloaded correctly.

2024-11-18T14:18:03.065620 - Prompt executed in 1.85 seconds

Attached Workflow

Please make sure that workflow does not contain any sensitive information such as API keys or passwords.

{"last_node_id":16,"last_link_id":20,"nodes":[{"id":10,"type":"PreviewImage","pos":[460,928],"size":[553.608642578125,826.3672485351562],"flags":{},"order":4,"mode":0,"inputs":[{"name":"images","type":"IMAGE","link":15,"label":"images"}],"outputs":[],"properties":{"Node name for S&R":"PreviewImage"},"widgets_values":[]},{"id":3,"type":"PreviewImage","pos":[460,50],"size":[553.608642578125,826.3672485351562],"flags":{},"order":5,"mode":0,"inputs":[{"name":"images","type":"IMAGE","link":13,"label":"images"}],"outputs":[],"properties":{"Node name for S&R":"PreviewImage"},"widgets_values":[]},{"id":13,"type":"ailab_OmniGen","pos":[1070,50],"size":[400,428],"flags":{},"order":6,"mode":0,"inputs":[{"name":"image_1","type":"IMAGE","link":17,"shape":7,"label":"image_1"},{"name":"image_2","type":"IMAGE","link":18,"shape":7,"label":"image_2"},{"name":"image_3","type":"IMAGE","link":null,"shape":7,"label":"image_3"}],"outputs":[{"name":"IMAGE","type":"IMAGE","links":[16],"slot_index":0,"label":"IMAGE"}],"properties":{"Node name for S&R":"ailab_OmniGen"},"widgets_values":["2 people at the coffee shop (image_1, image_2)","","Auto","Balanced",3.5,1.8,50,true,false,1024,512,344924858632789,"randomize",1024]},{"id":9,"type":"PreviewImage","pos":[1560,50],"size":[1037.9891357421875,808.0861206054688],"flags":{},"order":7,"mode":0,"inputs":[{"name":"images","type":"IMAGE","link":16,"label":"images"}],"outputs":[],"properties":{"Node name for S&R":"PreviewImage"},"widgets_values":[]},{"id":16,"type":"LoadImage","pos":[-500,830],"size":[320,310],"flags":{},"order":0,"mode":0,"inputs":[],"outputs":[{"name":"IMAGE","type":"IMAGE","links":[19],"slot_index":0},{"name":"MASK","type":"MASK","links":null}],"properties":{"Node name for S&R":"LoadImage"},"widgets_values":["me_3.jpeg","image"]},{"id":15,"type":"LoadImage","pos":[-490,290],"size":[320,310],"flags":{},"order":1,"mode":0,"inputs":[],"outputs":[{"name":"IMAGE","type":"IMAGE","links":[20],"slot_index":0},{"name":"MASK","type":"MASK","links":null}],"properties":{"Node name for S&R":"LoadImage"},"widgets_values":["trump-fail.jpg","image"]},{"id":12,"type":"ailab_OmniGen","pos":[-50,280],"size":[400,428],"flags":{},"order":3,"mode":0,"inputs":[{"name":"image_1","type":"IMAGE","link":20,"shape":7,"label":"image_1"},{"name":"image_2","type":"IMAGE","link":null,"shape":7,"label":"image_2"},{"name":"image_3","type":"IMAGE","link":null,"shape":7,"label":"image_3"}],"outputs":[{"name":"IMAGE","type":"IMAGE","links":[13,17],"slot_index":0,"label":"IMAGE"}],"properties":{"Node name for S&R":"ailab_OmniGen"},"widgets_values":["None","","Auto","Balanced",3.5,1.8,50,true,false,512,768,619694633692645,"randomize",1024]},{"id":14,"type":"ailab_OmniGen","pos":[-50,820],"size":[400,428],"flags":{},"order":2,"mode":0,"inputs":[{"name":"image_1","type":"IMAGE","link":19,"shape":7,"label":"image_1"},{"name":"image_2","type":"IMAGE","link":null,"shape":7,"label":"image_2"},{"name":"image_3","type":"IMAGE","link":null,"shape":7,"label":"image_3"}],"outputs":[{"name":"IMAGE","type":"IMAGE","links":[15,18],"slot_index":0,"label":"IMAGE"}],"properties":{"Node name for S&R":"ailab_OmniGen"},"widgets_values":["None","","Auto","Balanced",3.5,1.8,50,true,false,512,768,1016326586691859,"randomize",1024]}],"links":[[13,12,0,3,0,"IMAGE"],[15,14,0,10,0,"IMAGE"],[16,13,0,9,0,"IMAGE"],[17,12,0,13,0,"IMAGE"],[18,14,0,13,1,"IMAGE"],[19,16,0,14,0,"IMAGE"],[20,15,0,12,0,"IMAGE"]],"groups":[],"config":{},"extra":{"ds":{"scale":0.6115909044841462,"offset":[1073.4208934950116,84.25099433680789]}},"version":0.4}

Additional Context

  • Fresh installed the latest Pinokio Version
  • Fresh installed ComfyUI Version
  • Followed the OmniGen install guide
  • Run Process - Auto Install gets triggered
  • Error appears.
@wrybit
Copy link
Author

wrybit commented Nov 18, 2024

@1038lab what can I do? I don't see where my failure is.

@wrybit
Copy link
Author

wrybit commented Nov 18, 2024

python3 -m pip show peft

Name: peft
Version: 0.13.2
Summary: Parameter-Efficient Fine-Tuning (PEFT)
Home-page: https://github.com/huggingface/peft
Author: The HuggingFace team
Author-email: [email protected]
License: Apache
Location: /Users/user.xyz/Library/Python/3.10/lib/python/site-packages
Requires: accelerate, huggingface-hub, numpy, packaging, psutil, pyyaml, safetensors, torch, tqdm, transformers

python3 -m pip show diffusers

Name: diffusers
Version: 0.30.3
Summary: State-of-the-art diffusion in PyTorch and JAX.
Home-page: https://github.com/huggingface/diffusers
Author: The Hugging Face team (past and future) with the help of all our contributors (https://github.com/huggingface/diffusers/graphs/contributors)
Author-email: [email protected]
License: Apache 2.0 License
Location: /Users/user.xyz/Library/Python/3.10/lib/python/site-packages
Requires: filelock, huggingface-hub, importlib-metadata, numpy, Pillow, regex, requests, safetensors

"/Users/user.xyz/pinokio/api/comfy.git/app/custom_nodes/ComfyUI-OmniGen"
.. \ .. \ .. \ python_embeded \ python3 -m pip install -r ./requirements.txt

seems all good :/

@wrybit
Copy link
Author

wrybit commented Nov 18, 2024

Why douse ModuleNotFoundError: No module named 'diffusers' fail .. maybe because of the python/site-packages?

@dstults
Copy link

dstults commented Nov 24, 2024

I am getting the same thing when using a fresh install + Manager + this custom_node and nothing else. Seems requirements are missing.

I tried manually installing diffusers, which resolved the above error, but then I got this:

024-11-24T03:59:55.957417 - Error importing OmniGen: No module named 'timm'2024-11-24T03:59:55.957417 - 
2024-11-24T03:59:55.969365 - !!! Exception during processing !!! Failed to import OmniGen. Please check if the code was downloaded correctly.

Then I installed timm and got this:

No module named 'peft'

Then I installed peft and everything worked!

To validate, I confirmed the following files in this custom node invokes the above dependencies:

model.py

from diffusers.loaders import PeftAdapterMixin
from timm.models.vision_transformer import PatchEmbed, Attention, Mlp

pipeline.py

from peft import LoraConfig, PeftModel

@1038lab when convenient, I would recommend please adding diffusers, timm, peft to the requirements.txt to fix this issue and I suspect this one here as well: #26

These are the versions that are working on my fresh install in case you'd like to know what versions:

diffusers>=0.31.0
peft>=0.13.2
timm>=1.0.11

@monko9j1
Copy link

Getting this same error with a fresh install from inside of comfyui. Hope it can get fixed soon.

@king-ayanda
Copy link

king-ayanda commented Jan 13, 2025

Can confirm, pip installing diffusers==0.30.3, peft==0.13.2, and timm==0.9.16 and restarting ComfyUI fixed it for me. Why not just add these to requirements.txt?

Edit: I then got a new error - Error during generation: cannot unpack non-iterable NoneType object
I just resolved it by also pip installing torch==2.3.1

I got these from the Original Omnigen repo requirements.txt

@LuizRemy
Copy link

I'm new here, @NgcoboAyanda so now you will be using torch==2.3.1 for all comfyui or did you create an environment to fix it? how it works? thx

@king-ayanda
Copy link

I'm new here, @NgcoboAyanda so now you will be using torch==2.3.1 for all comfyui or did you create an environment to fix it? how it works? thx

I use ComfyUI on rented servers so I just chose to use torch 2.3.1 for all Comfy (I didn't really have many custom nodes so it didn't break anything)

@sunhaha123
Copy link

Problem with problems. sick it!

@sunhaha123
Copy link

Really crazy! I surrended !

@goncami
Copy link

goncami commented Mar 12, 2025

Same problem:

2025-03-12T20:35:30.401930 - Traceback (most recent call last): File "/Users/user.zz/ComfyUI/custom_nodes/ComfyUI-OmniGen/AILab_OmniGen.py", line 53, in __init__ from OmniGen import OmniGenPipeline File "/Users/user.zz/ComfyUI/custom_nodes/ComfyUI-OmniGen/OmniGen/__init__.py", line 1, in <module> from .model import OmniGen File "/Users/user.zz/ComfyUI/custom_nodes/ComfyUI-OmniGen/OmniGen/model.py", line 9, in <module> from diffusers.loaders import PeftAdapterMixin ModuleNotFoundError: No module named 'diffusers'

But I have this python dependencies installed:

python3 -m pip show peft
Name: peft
Version: 0.14.0
Summary: Parameter-Efficient Fine-Tuning (PEFT)
Home-page: https://github.com/huggingface/peft
Author: The HuggingFace team
Author-email: [email protected]
License: Apache
Location: /Users/user.zz/Library/Python/3.9/lib/python/site-packages
Requires: accelerate, huggingface-hub, numpy, packaging, psutil, pyyaml, safetensors, torch, tqdm, transformers

python3 -m pip show diffusers
Name: diffusers
Version: 0.32.2
Summary: State-of-the-art diffusion in PyTorch and JAX.
Home-page: https://github.com/huggingface/diffusers
Author: The Hugging Face team (past and future) with the help of all our contributors (https://github.com/huggingface/diffusers/graphs/contributors)
Author-email: [email protected]
License: Apache 2.0 License
Location: /Users/user.zz/Library/Python/3.9/lib/python/site-packages
Requires: filelock, huggingface-hub, importlib-metadata, numpy, Pillow, regex, requests, safetensors

What is the real solution?
thx

@theninj4
Copy link

This got me through the setup, might help someone:

cd ~/Documents/ComfyUI
source ./.venv/bin/activate
echo "Installing missing dependencies"
python3 -m pip install diffusers==0.30.3
python3 -m pip install timm
python3 -m pip install peft

@geckotao
Copy link

geckotao commented Apr 12, 2025

Failed to import OmniGen. Please check if the code was downloaded correctly.

# ComfyUI Error Report
## Error Details
- **Node ID:** 12
- **Node Type:** ailab_OmniGen
- **Exception Type:** RuntimeError
- **Exception Message:** Failed to import OmniGen. Please check if the code was downloaded correctly.
## Stack Trace

  File "D:\a\ComfyUI\ComfyUI\execution.py", line 293, in execute
    obj = class_def()
          ^^^^^^^^^^^

  File "D:\a\ComfyUI\ComfyUI\custom_nodes\ComfyUI-OmniGen\AILab_OmniGen.py", line 57, in __init__
    raise RuntimeError("Failed to import OmniGen. Please check if the code was downloaded correctly.")


## System Information
- **ComfyUI Version:** 0.3.27
- **Arguments:** ComfyUI\main.py --windows-standalone-build
- **OS:** nt
- **Python Version:** 3.12.7 (tags/v3.12.7:0b05ead, Oct  1 2024, 03:06:41) [MSC v.1941 64 bit (AMD64)]
- **Embedded Python:** true
- **PyTorch Version:** 2.6.0+cu124

I tried to lower the diffusers version, but it caused other errors, and in the end, I couldn't even start COMFYUI. It took me a long time to fix COMFYUI!

@giu-x
Copy link

giu-x commented May 10, 2025

same issue here, it seems it can't/won't download what is necessary

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

10 participants