smthemex / ComfyUI_Diffree

You can using Diffree in ComfyUI
Apache License 2.0
27 stars 4 forks source link

Getting some errors with import even using a seperate environment #3

Closed arvnoodle closed 3 months ago

arvnoodle commented 3 months ago
Traceback (most recent call last):
  File "/workspace/ComfyUI/nodes.py", line 1941, 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 "/workspace/ComfyUI/custom_nodes/ComfyUI_Diffree/__init__.py", line 2, in <module>
    from .Diffree_node import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
  File "/workspace/ComfyUI/custom_nodes/ComfyUI_Diffree/Diffree_node.py", line 144, in <module>
    class CompVisDenoiser(K.external.CompVisDenoiser):
AttributeError: module 'k_diffusion' has no attribute 'external'

tried on local and runpod, both gave the same error

Building wheels for collected packages: k-diffusion
  Building editable for k-diffusion (pyproject.toml) ... done
  Created wheel for k-diffusion: filename=k_diffusion-0.0.16-0.editable-py3-none-any.whl size=5124 sha256=b4d4da1864a6ab710a935ec4e5932d33357856322b2f50f0417ec57dd3817ca8
  Stored in directory: /tmp/pip-ephem-wheel-cache-cg5jdrtq/wheels/6b/d0/20/1e13a6ce5c5aa5c9fdad772026f990620b12d542ad78de3ac9
Successfully built k-diffusion
Installing collected packages: wcwidth, resize-right, six, setproctitle, sentry-sdk, rpds-py, protobuf, platformdirs, numpy, lightning-utilities, lazy-loader, ftfy, tifffile, referencing, imageio, docker-pycreds, wandb, scikit-image, jsonschema-specifications, torchmetrics, torchdiffeq, taming-transformers, jsonschema, accelerate, pytorch-lightning, jsonmerge, clip-anytorch, clean-fid, k-diffusion

Traceback (most recent call last):
  File "/workspace/ComfyUI/nodes.py", line 1941, 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 "/workspace/ComfyUI/custom_nodes/ComfyUI_Diffree/__init__.py", line 2, in <module>
    from .Diffree_node import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
  File "/workspace/ComfyUI/custom_nodes/ComfyUI_Diffree/Diffree_node.py", line 144, in <module>
    class CompVisDenoiser(K.external.CompVisDenoiser):
AttributeError: module 'k_diffusion' has no attribute 'external'

Cannot import /workspace/ComfyUI/custom_nodes/ComfyUI_Diffree module for custom nodes: module 'k_diffusion' has no attribute 'external'
pip list  

k-diffusion               0.0.16     /workspace/ComfyUI/virtualenv_name_V3/src/k-diffusion)
>>> import k_diffusion as K
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/workspace/ComfyUI/virtualenv_name_V3/src/k-diffusion/k_diffusion/__init__.py", line 1, in <module>
    from . import augmentation, config, evaluation, external, gns, layers, models, sampling, utils
  File "/workspace/ComfyUI/virtualenv_name_V3/src/k-diffusion/k_diffusion/evaluation.py", line 6, in <module>
    import clip
  File "/workspace/ComfyUI/virtualenv_name_V3/lib/python3.10/site-packages/clip/__init__.py", line 1, in <module>
    from .clip import *
  File "/workspace/ComfyUI/virtualenv_name_V3/lib/python3.10/site-packages/clip/clip.py", line 6, in <module>
    from pkg_resources import packaging
ImportError: cannot import name 'packaging' from 'pkg_resources' (/workspace/ComfyUI/virtualenv_name_V3/lib/python3.10/site-packages/pkg_resources/__init__.py)
smthemex commented 3 months ago

I'll make some changes to the code later. Thank you for your feedback. k_diffusion is built-in to ComfyUI, and some people's environments may not be able to call it

smthemex commented 3 months ago

I have added the k_diffusion library for easy use in portable ComfyUI. Please check the new version and readme

arvnoodle commented 3 months ago

It worked on my end after using this requirements.txt

pytorch-lightning
torchdiffeq
dctorch
opencv-python
omegaconf==2.1.1
jsonmerge
clean-fid
-e git+https://github.com/crowsonkb/k-diffusion.git@v0.0.16#egg=k-diffusion
-e git+https://github.com/CompVis/taming-transformers.git@master#egg=taming-transformers

then Try Update in the comfyUI itself