Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Control-Net; ImportError; Undefined; pydantic; insightface #15564

Closed
w-e-w opened this issue Apr 18, 2024 · 3 comments
Closed

Fix: Control-Net; ImportError; Undefined; pydantic; insightface #15564

w-e-w opened this issue Apr 18, 2024 · 3 comments

Comments

@w-e-w
Copy link
Collaborator

w-e-w commented Apr 18, 2024

Error

ImportError: cannot import name 'Undefined' from 'pydantic.fields'

Currently there is an issue with new installation of Control Net breaking WebUI

this is caused by a recent update to Control-Net's Upstream dependency albumentations 1.4.4 see history
in albumentations==1.4.4 they introduce a new dependency requirement

  • pydantic required: >=2.6.4

albumentations is installed by insightface which specifies Any version of albumentations as such pip install the latest version of albumentations==1.4.4

this issue is that WebUi 1.7~1.9 with Gradio==3.41.2 uses fastapi==0.94.0 which requires

  • pydantic required: >=1.7.4,<3.0.0,!=2.0.1,!=2.0.0,!=1.8.1,!=1.8

as such the Upstream update of albumentations causes WebUi to break

Any other extensions that also uses insightface will also be affected with the same issue


User Fix method one

downgrading pydantic to 1.10.15 and albumentations to 1.4.3
this can be done by running the following command in the webui's python environment

from the webui root the following commands
if using powershell on windwos

.\venv\Scripts\Activate.ps1
pip install albumentations==1.4.3
pip install pydantic==1.10.15

if using cmd on windows

venv\Scripts\activate
pip install albumentations==1.4.3
pip install pydantic==1.10.15

if using linux

source venv/bin/activate
pip install albumentations==1.4.3
pip install pydantic==1.10.15

User Fix method two

Since sd-webui-controlnet has updated a fix to this issue there is an alternative method to solve this issue

this method is not as efficient as method one but hopefully it's easier to follow for those who do not know the way around terminal; python; venv; pip

  1. add --disable-extra-extensions to COMMANDLINE_ARGS in webui-user.bat or webui-user.sh
  2. delete venv
  3. start webui using webui-user.bat or webui.sh
  4. update controlnet using extensions tab
  5. close webui
  6. remove --disable-extra-extensions from COMMANDLINE_ARGS in webui-user.bat
  7. relaunch webui

Related issues posts


Fix PR
fix solution, install albumentations==1.4.3 before insightface
this way pip won't auto install the newest version 1.4.4

if anyone know of any other extensions that uses insightface please inform them about this issue

@w-e-w w-e-w pinned this issue Apr 18, 2024
@w-e-w w-e-w changed the title Fix new install Control-Net break webui Fix new install Control-Net / insightface break webui Apr 18, 2024
@w-e-w w-e-w changed the title Fix new install Control-Net / insightface break webui Fix Solution: new install Control-Net break webui - insightface Apr 18, 2024
@w-e-w w-e-w changed the title Fix Solution: new install Control-Net break webui - insightface Fix Solution: Control-Net break webui - ImportError Undefined pydantic.fields - insightface Apr 18, 2024
@w-e-w w-e-w changed the title Fix Solution: Control-Net break webui - ImportError Undefined pydantic.fields - insightface Fix Solution: Control-Net - ImportError Undefined pydantic.fields - insightface Apr 18, 2024
@w-e-w w-e-w changed the title Fix Solution: Control-Net - ImportError Undefined pydantic.fields - insightface Fix: Control-Net - ImportError Undefined pydantic.fields - insightface Apr 18, 2024
@w-e-w w-e-w changed the title Fix: Control-Net - ImportError Undefined pydantic.fields - insightface Fix: Control-Net - ImportError; Undefined; pydantic - insightface Apr 18, 2024
@w-e-w w-e-w changed the title Fix: Control-Net - ImportError; Undefined; pydantic - insightface Fix: Control-Net; ImportError; Undefined; pydantic; insightface Apr 18, 2024
@w-e-w w-e-w closed this as completed Apr 24, 2024
@w-e-w w-e-w unpinned this issue Apr 28, 2024
@rafstahelin
Copy link

neither method 1 or 2 work for me @w-e-w
has there been any other progress on this fix?

@w-e-w
Copy link
Collaborator Author

w-e-w commented May 1, 2024

neither method 1 or 2 work for me @w-e-w has there been any other progress on this fix?

as far as I'm aware this is already a fixed issue

if you're still experiencing similar issues but most likely is something else or you haven't performed a fixed properly
I'm assuming that it isn't caused by a new issue

run the command

pip freeze

the post the result

I'll also need a list a list of your extensions

@rafstahelin
Copy link

rafstahelin commented May 1, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants