Amorano/Jovimetrix

DEVICES.py fails to load in ComfyUI docker container

Closed this issue · 3 comments

Hiya!

I run ComfyUI in a docker container and seem to run into some issues getting devices.py to load up.

/config/05-comfy-ui/ComfyUI/custom_nodes/ComfyUI-TTS/AutoUpdate.json 2024-01-26 20:50:16.527 | WARNING | Jovimetrix:__init__:456 - module failed /config/05-comfy-ui/ComfyUI/custom_nodes/Jovimetrix/nodes/device.py 2024-01-26 20:50:16.527 | WARNING | Jovimetrix:__init__:457 - cannot import name 'window_list' from 'Jovimetrix.sup.stream' (/config/05-comfy-ui/ComfyUI/custom_nodes/Jovimetrix/sup/stream.py)
The latter is presumably because window_list is only defined if you're running this on win32, which device.py attempts to import.
Defining dummy functions is able to eek past this (nastily, I'm sure), but I can't quite crack this one -

2024-01-26 21:17:47.599 | WARNING | Jovimetrix:__init__:457 - libasound.so.2: cannot open shared object file: No such file or directory

I assumed this was related to MIDI capture, but my attempts to bypass it have failed.

Played with this on my windows machine with no problems. Really dope tools my man, appreciate any help you can provide.

The libsound is a warning; totally ignore since we are hijacking a normal env.

The window_list is indeed a windows only function. You are merely ahead of the curve since this is a WIP lib and I dont do Mac and Linux immediately.

I will attempt to fill those functions for your OS as well. There are actually two that need the interface: window_list and window_capture <-- if you want to not use the window capture features you could just do:

def window_list() -> dict:
    return {}

def window_capture(hwnd:int, dpi:bool=True, clientOnly:bool=True) -> cv2.Mat:
    return np.array((MIN_IMAGE_SIZE, MIN_IMAGE_SIZE, 3), dtype=np.uint8)

which is what I will stick as a default for any fall through. For the immediate, I have IF'd around the platform showing "WINDOW" in the modes for non-windows platforms.

Thanks for the report!

And thank you for your help! I took your updates and I was able to apt-get libasound2 in the container, so that resolved that.
I commented out some of the MIDI, Monitors, and Camera stuff just to see if I could get StreamReader to work, and voila! We're in business.
Thanks for your hard work!

The latest push should resolve any problems for Linux/Mac using the window capture -- that is it removes window capture from failing on those platforms, even if it cant capture the window.

Camera, Desktop and Monitor capture should still work 100%.

Let me know if this resolves this issue.