ComfyScript icon indicating copy to clipboard operation
ComfyScript copied to clipboard

AttributeError: module 'comfy.cmd.server' has no attribute 'nodes'

Open ChrGriffin opened this issue 2 months ago • 4 comments

Hi there -- I'm attempting to use ComfyScript with the ComfyUI package in a Docker image. I've followed the Readme as best I could, paired with a little reading of the source code, but I'm now stuck. Take a look at my imports and setup:

from comfy_script.runtime import *
import random
import boto3
import os
import tarfile

load('comfyui')
from comfy_script.runtime.nodes import *

Pretty standard stuff, I think. However, when the script hits the load line, it dies and spits out the following error:

Traceback (most recent call last):
  File "/app/main.py", line 7, in <module>
    load('comfyui')
  File "/home/user/micromamba/lib/python3.10/site-packages/comfy_script/runtime/__init__.py", line 31, in load
    asyncio.run(_load(comfyui, args, vars, watch, save_script_source))
  File "/home/user/micromamba/lib/python3.10/site-packages/nest_asyncio.py", line 30, in run
    return loop.run_until_complete(task)
  File "/home/user/micromamba/lib/python3.10/site-packages/nest_asyncio.py", line 98, in run_until_complete
    return f.result()
  File "/home/user/micromamba/lib/python3.10/asyncio/futures.py", line 201, in result
    raise self._exception.with_traceback(self._exception_tb)
  File "/home/user/micromamba/lib/python3.10/asyncio/tasks.py", line 232, in __step
    result = coro.send(None)
  File "/home/user/micromamba/lib/python3.10/site-packages/comfy_script/runtime/__init__.py", line 54, in _load
    start_comfyui(comfyui, args)
  File "/home/user/micromamba/lib/python3.10/site-packages/comfy_script/runtime/__init__.py", line 340, in start_comfyui
    loop.run_until_complete(main.main())
  File "/home/user/micromamba/lib/python3.10/site-packages/nest_asyncio.py", line 98, in run_until_complete
    return f.result()
  File "/home/user/micromamba/lib/python3.10/asyncio/futures.py", line 201, in result
    raise self._exception.with_traceback(self._exception_tb)
  File "/home/user/micromamba/lib/python3.10/asyncio/tasks.py", line 232, in __step
    result = coro.send(None)
  File "/home/user/micromamba/lib/python3.10/site-packages/comfy/cmd/main.py", line 201, in main
    exit(0)
  File "/home/user/micromamba/lib/python3.10/site-packages/comfy_script/runtime/__init__.py", line 271, in exit_hook
    setup_comfyui_polyfills(outer.f_locals)
  File "/home/user/micromamba/lib/python3.10/site-packages/comfy_script/runtime/__init__.py", line 235, in setup_comfyui_polyfills
    exported_nodes = comfy.cmd.server.nodes
AttributeError: module 'comfy.cmd.server' has no attribute 'nodes'

Pasted the whole stack trace for context, but the error is evident at the bottom there.

The relevant parts of my Dockerfile -- just installing the required packages, nothing special:

RUN pip install wheel
RUN pip install --no-build-isolation git+https://github.com/hiddenswitch/ComfyUI.git
RUN pip install -U "comfy-script[default]"

Any ideas on where this is going wrong? Thanks!

ChrGriffin avatar Apr 11 '24 01:04 ChrGriffin