cannot import name 'PositionNet' from 'diffusers.models.embeddings'
After installing ComfyUI-AnimateAnyone-Evolved via git clone and running python -m pip install -r requirements.txt using the embedded python, I get the following error on startup:
Traceback (most recent call last):
File "I:\StableDiffusion\ComfyNew\ComfyUI_windows_portable\ComfyUI\nodes.py", line 1893, in load_custom_node
module_spec.loader.exec_module(module)
File "
I have diffusers==0.26.0. This should be sufficient?
My pip modules versions: PS I:\StableDiffusion\ComfyNew\ComfyUI_windows_portable\python_embeded> .\python.exe -m pip freeze absl-py==2.0.0 accelerate==0.25.0 addict==2.4.0 aiofiles==23.2.1 aiohttp==3.9.1 aiosignal @ file:///D:/a/ComfyUI/cu121_python_deps/aiosignal-1.3.1-py3-none-any.whl#sha256=f8376fb07dd1e86a584e4fcdec80b36b7f81aac666ebc724e2c090300dd83b17 albumentations==1.3.1 altair==5.2.0 annotated-types==0.6.0 antlr4-python3-runtime==4.9.3 anyio==4.1.0 astunparse==1.6.3 attrs @ file:///D:/a/ComfyUI/cu121_python_deps/attrs-23.1.0-py3-none-any.whl#sha256=1f28b4522cdc2fb4256ac1a020c78acf9cba2c6b461ccd2c126f3aa8e8335d04 audioread==3.0.1 bitsandbytes @ https://github.com/jllllll/bitsandbytes-windows-webui/releases/download/wheels/bitsandbytes-0.40.1.post1-py3-none-win_amd64.whl#sha256=aac25de6c3fdcc9e320bfa2ada1e18ac156d28b006631f84ba2ea561224bbd04 cachetools==5.3.2 certifi @ file:///D:/a/ComfyUI/cu121_python_deps/certifi-2023.11.17-py3-none-any.whl#sha256=e036ab49d5b79556f99cfc2d9320b34cfbe5be05c5871b51de9329f0603b0474 cffi @ file:///D:/a/ComfyUI/cu121_python_deps/cffi-1.16.0-cp311-cp311-win_amd64.whl#sha256=db8e577c19c0fda0beb7e0d4e09e0ba74b1e4c092e0e40bfa12fe05b6f6d75ba chardet==5.2.0 charset-normalizer @ file:///D:/a/ComfyUI/cu121_python_deps/charset_normalizer-3.3.2-cp311-cp311-win_amd64.whl#sha256=663946639d296df6a2bb2aa51b60a2454ca1cb29835324c640dafb5ff2131a77 click==8.1.7 clip @ https://github.com/openai/CLIP/archive/d50d76daa670286dd6cacf3bcd80b5e4823fc8e1.zip#sha256=b5842c25da441d6c581b53a5c60e0c2127ebafe0f746f8e15561a006c6c3be6a clip-interrogator==0.6.0 cmake==3.27.9 color-matcher==0.5.0 colorama @ file:///D:/a/ComfyUI/cu121_python_deps/colorama-0.4.6-py2.py3-none-any.whl#sha256=4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6 coloredlogs==15.0.1 colorlog==6.8.2 colour-science==0.4.4 contourpy==1.2.0 cryptography==42.0.0 cssselect2==0.7.0 cstr @ git+https://github.com/WASasquatch/cstr@0520c29a18a7a869a6e5983861d6f7a4c86f8e9b cupy-cuda11x==12.3.0 cycler==0.12.1 Cython==3.0.6 ddt==1.7.1 decorator==5.1.1 deepdiff==6.7.1 diffusers==0.26.0 distro==1.8.0 docutils==0.20.1 easydict==1.11 einops @ file:///D:/a/ComfyUI/cu121_python_deps/einops-0.7.0-py3-none-any.whl#sha256=0f3096f26b914f465f6ff3c66f5478f9a5e380bb367ffc6493a68143fbbf1fd1 embreex==2.17.7.post4 fairscale==0.4.13 fastapi==0.109.0 fastrlock==0.8.2 ffmpy @ git+https://github.com/WASasquatch/ffmpy.git@f000737698b387ffaeab7cd871b0e9185811230d filelock @ file:///D:/a/ComfyUI/cu121_python_deps/filelock-3.13.1-py3-none-any.whl#sha256=57dbda9b35157b05fb3e58ee91448612eb674172fab98ee235ccb0b5bee19a1c fire==0.5.0 flatbuffers==23.5.26 fonttools==4.46.0 frozenlist @ file:///D:/a/ComfyUI/cu121_python_deps/frozenlist-1.4.0-cp311-cp311-win_amd64.whl#sha256=515e1abc578dd3b275d6a5114030b1330ba044ffba03f94091842852f806f1c1 fsspec @ file:///D:/a/ComfyUI/cu121_python_deps/fsspec-2023.10.0-py3-none-any.whl#sha256=346a8f024efeb749d2a5fca7ba8854474b1ff9af7c3faaf636a4548781136529 ftfy==6.1.3 fvcore==0.1.5.post20221221 gast==0.5.4 gitdb==4.0.11 GitPython==3.1.40 google-auth==2.25.2 google-auth-oauthlib==1.2.0 google-pasta==0.2.0 gradio==4.16.0 gradio_client==0.8.1 grpcio==1.60.0 h11==0.14.0 h5py==3.10.0 httpcore==1.0.2 httpx==0.25.2 huggingface-hub==0.20.3 humanfriendly==10.0 idna @ file:///D:/a/ComfyUI/cu121_python_deps/idna-3.4-py3-none-any.whl#sha256=90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2 imageio==2.33.1 imageio-ffmpeg==0.4.9 img2texture @ git+https://github.com/WASasquatch/img2texture.git@a546609a915caf1dcb84a15bf44b5b639ad924e6 importlib-metadata==7.0.0 importlib-resources==6.1.1 insightface @ file:///I:/StableDiffusion/ComfyNew/ComfyUI_windows_portable/insightface-0.7.3-cp311-cp311-win_amd64.whl#sha256=ea9b96de0f3cada1c031e3c566d2dfcb2ff45b0b7cca88e27f583ed9ef386561 iopath==0.1.10 Jinja2==3.0.3 joblib==1.3.2 jsonschema==4.20.0 jsonschema-specifications==2023.11.2 keras==2.15.0 kiwisolver==1.4.5 kornia==0.7.0 lazy_loader==0.3 libclang==16.0.6 librosa==0.10.1 lightning-utilities==0.10.0 llvmlite==0.41.1 lpips==0.1.4 lxml==5.1.0 mapbox-earcut==1.0.1 Markdown==3.5.1 markdown-it-py==3.0.0 MarkupSafe @ file:///D:/a/ComfyUI/cu121_python_deps/MarkupSafe-2.1.3-cp311-cp311-win_amd64.whl#sha256=134da1eca9ec0ae528110ccc9e48041e0828d79f24121a1a146161103c76e686 matplotlib==3.8.2 matrix-client==0.4.0 mdurl==0.1.2 mediapipe==0.10.9 ml-dtypes==0.2.0 mpmath @ file:///D:/a/ComfyUI/cu121_python_deps/mpmath-1.3.0-py3-none-any.whl#sha256=a0b2b9fe80bbcd81a6647ff13108738cfb482d481d826cc0e02f5b35e5c88d2c msgpack==1.0.7 multidict @ file:///D:/a/ComfyUI/cu121_python_deps/multidict-6.0.4-cp311-cp311-win_amd64.whl#sha256=81a4f0b34bd92df3da93315c6a59034df95866014ac08535fc819f043bfd51f0 natsort==8.4.0 networkx @ file:///D:/a/ComfyUI/cu121_python_deps/networkx-3.2.1-py3-none-any.whl#sha256=f18c69adc97877c42332c170849c96cefa91881c99a7cb3e95b7c659ebdc1ec2 numba==0.58.1 numexpr==2.9.0 numpy @ file:///D:/a/ComfyUI/cu121_python_deps/numpy-1.26.2-cp311-cp311-win_amd64.whl#sha256=2b3fca8a5b00184828d12b073af4d0fc5fdd94b1632c2477526f6bd7842d700d oauthlib==3.2.2 omegaconf==2.3.0 onnx==1.15.0 onnxruntime==1.16.3 onnxruntime-gpu==1.16.3 open-clip-torch==2.24.0 openai==1.3.8 opencv-contrib-python==4.8.1.78 opencv-python==4.8.1.78 opencv-python-headless==4.7.0.72 opt-einsum==3.3.0 ordered-set==4.1.0 orjson==3.9.12 packaging @ file:///D:/a/ComfyUI/cu121_python_deps/packaging-23.2-py3-none-any.whl#sha256=8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7 pandas==2.1.4 photoshop-connection==0.2.0 piexif==1.1.3 pilgram==1.2.1 pillow==10.2.0 platformdirs==4.1.0 pooch==1.8.0 portalocker==2.8.2 prettytable==3.9.0 protobuf==4.25.1 psutil==5.9.8 py-cpuinfo==9.0.0 pyasn1==0.5.1 pyasn1-modules==0.3.0 pycocoevalcap==1.2 pycocotools==2.0.7 pycollada==0.8 pycparser @ file:///D:/a/ComfyUI/cu121_python_deps/pycparser-2.21-py2.py3-none-any.whl#sha256=8ee45429555515e1f6b185e78100aea234072576aa43ab53aefcae078162fca9 pydantic==2.5.2 pydantic_core==2.14.5 pydub==0.25.1 pygit2==1.14.0 Pygments==2.17.2 PyMatting==1.1.12 pynvml==11.5.0 pyOpenSSL==24.0.0 pyparsing==3.1.1 pypng==0.20220715.0 pyreadline3==3.4.1 python-dateutil==2.8.2 python-multipart==0.0.6 pytorch-lightning==2.1.2 pytz==2023.3.post1 pywin32==306 PyYAML @ file:///D:/a/ComfyUI/cu121_python_deps/PyYAML-6.0.1-cp311-cp311-win_amd64.whl#sha256=bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34 qrcode==7.4.2 qudida==0.0.4 referencing==0.32.0 regex @ file:///D:/a/ComfyUI/cu121_python_deps/regex-2023.10.3-cp311-cp311-win_amd64.whl#sha256=b6104f9a46bd8743e4f738afef69b153c4b8b592d35ae46db07fc28ae3d5fb7c rembg==2.0.53 reportlab==4.0.9 requests @ file:///D:/a/ComfyUI/cu121_python_deps/requests-2.31.0-py3-none-any.whl#sha256=58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f requests-oauthlib==1.3.1 requirements-parser==0.5.0 rich==13.7.0 rich-argparse==1.4.0 rpds-py==0.13.2 rsa==4.9 Rtree==1.2.0 ruff==0.1.15 safetensors==0.4.2 scikit-image==0.22.0 scikit-learn==1.3.2 scipy==1.12.0 seaborn==0.13.0 segment-anything==1.0 semantic-version==2.10.0 sentencepiece==0.1.99 shapely==2.0.2 shellingham==1.5.4 simple-lama-inpainting==0.1.2 six==1.16.0 smmap==5.0.1 sniffio==1.3.0 sounddevice==0.4.6 soundfile==0.12.1 soxr==0.3.7 starlette==0.35.1 svg.path==6.3 svglib==1.5.1 sympy @ file:///D:/a/ComfyUI/cu121_python_deps/sympy-1.12-py3-none-any.whl#sha256=c3588cd4295d0c0f603d0f2ae780587e64e2efeedb3521e46b9bb1d08d184fa5 tabulate==0.9.0 tensorboard==2.15.1 tensorboard-data-server==0.7.2 tensorflow==2.15.0 tensorflow-estimator==2.15.0 tensorflow-intel==2.15.0 tensorflow-io-gcs-filesystem==0.31.0 termcolor==2.4.0 thop==0.1.1.post2209072238 threadpoolctl==3.2.0 tifffile==2023.12.9 timm==0.9.12 tinycss2==1.2.1 tokenizers @ file:///D:/a/ComfyUI/cu121_python_deps/tokenizers-0.15.0-cp311-none-win_amd64.whl#sha256=2dd681b53cf615e60a31a115a3fda3980e543d25ca183797f797a6c3600788a3 tomli==2.0.1 tomlkit==0.12.0 toolz==0.12.1 torch==2.1.2+cu121 torchaudio==2.1.2+cu121 torchdiffeq==0.2.3 torchmetrics==1.2.1 torchsde @ file:///D:/a/ComfyUI/cu121_python_deps/torchsde-0.2.6-py3-none-any.whl#sha256=19bf7ff02eec7e8e46ba1cdb4aa0f9db1c51d492524a16975234b467f7fc463b torchvision==0.16.2+cu121 tqdm @ file:///D:/a/ComfyUI/cu121_python_deps/tqdm-4.66.1-py3-none-any.whl#sha256=d302b3c5b53d47bce91fea46679d9c3c6508cf6332229aa1e7d8653723793386 trampoline @ file:///D:/a/ComfyUI/cu121_python_deps/trampoline-0.1.2-py3-none-any.whl#sha256=36cc9a4ff9811843d177fc0e0740efbd7da39eadfe6e50c9e2937cbc06d899d9 transformers==4.37.1 trimesh==4.1.0 typer==0.9.0 types-setuptools==69.0.0.0 typing_extensions @ file:///D:/a/ComfyUI/cu121_python_deps/typing_extensions-4.8.0-py3-none-any.whl#sha256=8f92fc8806f9a6b641eaa5318da32b44d401efaac0f6678c9bc448ba3605faa0 tzdata==2023.3 ultralytics==8.0.226 urllib3==1.26.18 uvicorn==0.27.0.post1 vhacdx==0.0.5 watchdog==3.0.0 wcwidth==0.2.12 webencodings==0.5.1 websockets==11.0.3 Werkzeug==3.0.1 wrapt==1.14.1 xformers==0.0.23.post1 xxhash==3.4.1 yacs==0.1.8 yapf==0.40.2 yarl @ file:///D:/a/ComfyUI/cu121_python_deps/yarl-1.9.3-cp311-cp311-win_amd64.whl#sha256=f7271d6bd8838c49ba8ae647fc06469137e1c161a7ef97d778b72904d9b68696 zipp==3.17.0
Okay, I just realized PositionNet is not part of diffusers 0.26.0. https://github.com/huggingface/diffusers/blob/v0.26.0/src/diffusers/models/embeddings.py
It seems we need 0.25.1 specifically. This should be reflected/updated in the requirements.txt.
the same error,I think maybe there is something wrong with the reference of this project, should be changed?In particular, references in the ./src/models/unet_2d_condition.py script
in src/diffusers/models/unet_2d_condition.py
PositionNet was changed to GLIGENTextBoundingboxProjection in this commit of diffusers
I updated the project to support newest diffuser v.0.26.1, I also updated the node reference in the example workflow, now it should works as intended.
So please update the addon and also update the diffuser package if you have same error:
pip install --force-reinstall diffusers>=0.26.1
I updated the project to support newest diffuser v.0.26.1, I also updated the node reference in the example workflow, now it should works as intended.我更新了项目以支持最新的扩散器 v.0.26.1,我还更新了示例工作流中的节点引用,现在它应该按预期工作。 So please update the addon and also update the diffuser package if you have same error:因此,如果您遇到相同的错误,请更新插件并更新扩散器包:
pip install --force-reinstall diffusers>=0.26.1
0.27.2 same error
0.29.0 same error
in src/diffusers/models/unet_2d_condition.py
PositionNetwas changed toGLIGENTextBoundingboxProjectionin this commit of diffusers
Thank you! This totally work by modify the following code in unet_2d_condition.py as:
from diffusers.models.embeddings import (
GaussianFourierProjection,
ImageHintTimeEmbedding,
ImageProjection,
ImageTimeEmbedding,
# PositionNet,
TextImageProjection,
TextImageTimeEmbedding,
TextTimeEmbedding,
TimestepEmbedding,
Timesteps,
)
import diffusers
if diffusers.__version__ >'0.25':
from diffusers.models.embeddings import GLIGENTextBoundingboxProjection as PositionNet
else:
from diffusers.models.embeddings import PositionNet
pip install diffusers==0.24.*
pip install diffusers==0.25.1
this also should work
cannot import name 'PositionNet' from 'diffusers.models.embeddings' (/usr/local/lib/python3.11/dist-packages/diffusers/models/embeddings.py)