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

Import issue because of missing __init__.py file #2706

Open
dzynerboy opened this issue Dec 15, 2024 · 3 comments
Open

Import issue because of missing __init__.py file #2706

dzynerboy opened this issue Dec 15, 2024 · 3 comments

Comments

@dzynerboy
Copy link

Trying to install into ComfyUI but upon bootup, the system is kicking back an error when it tries to import Insightface due to a missing init.py file

FileNotFoundError: [Errno 2] No such file or directory: '/Users/john/AI/ComfyUI/custom_nodes/insightface/init.py'

Cannot import /Users/john/AI/ComfyUI/custom_nodes/insightface module for custom nodes: [Errno 2] No such file or directory: '/Users/john/AI/ComfyUI/custom_nodes/insightface/init.py'

Import times for custom nodes:
0.0 seconds: /Users/john/AI/ComfyUI/custom_nodes/websocket_image_save.py
0.0 seconds (IMPORT FAILED): /Users/john/AI/ComfyUI/custom_nodes/insightface
0.0 seconds: /Users/john/AI/ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus
0.0 seconds: /Users/john/AI/ComfyUI/custom_nodes/ComfyUI_essentials
0.1 seconds: /Users/john/AI/ComfyUI/custom_nodes/ComfyUI-Manager
0.4 seconds: /Users/john/AI/ComfyUI/custom_nodes/comfyui_controlnet_aux

Anyone else having this issue?

Mac Studio M2 Ultra

@dzynerboy
Copy link
Author

ChatGPT and I have sat for several hours trying to resolve this issue.

I've tried creating an empty .py file - No good.

I get this message -

Skip /Users/john/AI/ComfyUI/custom_nodes/insightface module for custom nodes due to the lack of NODE_CLASS_MAPPINGS.

I've tried to use Manager in comfyUI to install missing custom nodes - no luck

@dzynerboy
Copy link
Author

ChatGPT is saying that I need to define Node classes using the NODE_CLASS_MAPPINGS command line

NODE_CLASS_MAPPINGS = {
"CustomNode1": CustomNodeClass1,
"CustomNode2": CustomNodeClass2,
}

¯_(ツ)_/¯

Any thoughts from the humans out there?

@dzynerboy
Copy link
Author

Ok chatGPT coached me to create my own init.py file and then put the following code into it:

class ExampleNode:
def init(self):
# This is just a placeholder node class
print("ExampleNode initialized!")

Define the NODE_CLASS_MAPPINGS dictionary

NODE_CLASS_MAPPINGS = {
"ExampleNode": ExampleNode, # Key: "Name of the Node", Value: The Node Class
}

ERRORS are gone!!!!!

Import times for custom nodes:
0.0 seconds: /Users/john/AI/ComfyUI/custom_nodes/websocket_image_save.py
0.0 seconds: /Users/john/AI/ComfyUI/custom_nodes/insightface
0.0 seconds: /Users/john/AI/ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus
0.0 seconds: /Users/john/AI/ComfyUI/custom_nodes/ComfyUI_essentials
0.1 seconds: /Users/john/AI/ComfyUI/custom_nodes/ComfyUI-Manager
0.3 seconds: /Users/john/AI/ComfyUI/custom_nodes/comfyui_controlnet_aux

Starting server

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

1 participant