WASasquatch / was-node-suite-comfyui

An extensive node suite for ComfyUI with over 210 new nodes
MIT License
1.15k stars 170 forks source link

Trouble getting installed and working #11

Closed Norgus closed 1 year ago

Norgus commented 1 year ago

I have a pretty fresh default install of comfyui (git cloned, installed as per instructions).

I made a repositories subdirectory in comfyui, cloned in this repo, and hard linked the WAS_Node_Suite.py in the custom_nodes directory (basically, the file is in there as far as the filesystem is concerned)

First issue was I did not have the cv2 dependency (this wasn't outlined in a requirements.txt or anything, oh well). The following remediated that problem pip install opencv-python

Now, however, it appears to be missing a json configuration file I don't have?

WAS Node Suite: Running At: /home/norgus/ComfyUI/custom_nodes/WAS_Node_Suite.py
WAS Node Suite: Running From: /home/norgus/ComfyUI/custom_nodes
Traceback (most recent call last):
File "/home/norgus/ComfyUI/nodes.py", line 1033, in load_custom_node
module_spec.loader.exec_module(module)
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/home/norgus/ComfyUI/custom_nodes/WAS_Node_Suite.py", line 141, in <module>
WDB = WASDatabase(WAS_DATABASE)
File "/home/norgus/ComfyUI/custom_nodes/WAS_Node_Suite.py", line 111, in __init__
with open(filepath, 'r+') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/norgus/ComfyUI/custom_nodes/was_suite_settings.json'

Cannot import /home/norgus/ComfyUI/custom_nodes/WAS_Node_Suite.py module for custom nodes: [Errno 2] No such file or directory: '/home/norgus/ComfyUI/custom_nodes/was_suite_settings.json'
Starting server`

Did I catch the repo in a state of flux and just need to wait for an update?

WASasquatch commented 1 year ago

I'm not sure what's going on with the database. It's starting to piss me off. On my system it creates the file if it doesn't exist. It's using r+ and w+ modes which are specifically for that now.

Opencv should be installed automatically. What filter did you use that triggered the error?

To get by database error you can just create the file blank or put {} in it. I don't know what's going on there. Sounds like file protection outside my control when I'm using specific modes to create the file.

Does the script have permission to write to the directory?

EDIT: Oops, didn't mean close the topic.

Norgus commented 1 year ago

I'm using linux, if that makes a difference? The errors have all prevented the extra nodes from loading from what I can tell, so it wasn't a specific filter. Anyway, the solution you suggested of creating the json file seems to have worked. I was able to do a quick and successful test of one of your nodes :)

image

I need to sleep now, but if there's anything I can check/test just let me know and I'll try to get back to you on it.

WASasquatch commented 1 year ago

If it's linux it seems to be a permissions thing. I wonder if you could try deleting the file, and then add this code. Though I have a hunch the executing script can't chmod itself. Lol

# Get the current permissions of the file
was_file_permissions = oct(os.stat(NODE_FILE).st_mode)[-3:]
was_folder_permissions = oct(os.stat(WAS_SUITE_ROOT).st_mode)[-3:]

# Ensure folder and file is writable
if was_file_permissions[0] != 'w':
    print(f'\033[34mWAS Node Suite:\033[0m {os.path.basename(NODE_FILE)}: Is not writable, changing permissions...')
    os.chmod(NODE_FILE, 0o666)
if was_folder_permissions[0] != 'w':
    print(f'\033[34mWAS Node Suite:\033[0m {os.path.basename(WAS_SUITE_ROOT)}: Is not writable, changing permissions...')
    os.chmod(WAS_SUITE_ROOT, 0o777)

after the

WAS_DATABASE = os.path.join(WAS_SUITE_ROOT, 'was_suite_settings.json')

I do feel like ComfyUI should be creating the nodes directory with the appropriate permissions though.

WASasquatch commented 1 year ago

Alright, thanks for the feedback. The installation method from git clone and stand alone file should be fixed.

Norgus commented 1 year ago

The directory permissions seem sensible to me. drwxr-xr-x - norgus 29 Mar 00:15 custom_nodes Thanks for the help & the custom node collection!