stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

[Bug]: ControlNet breaks my WebUI

Open KingsmanZer0 opened this issue 10 months ago • 10 comments

Checklist

  • [x] The issue exists after disabling all extensions
  • [x] The issue exists on a clean installation of webui
  • [ ] The issue is caused by an extension, but I believe it is caused by a bug in the webui
  • [x] The issue exists in the current version of the webui
  • [x] The issue has not been reported before recently
  • [ ] The issue has been reported before but has not been fixed yet

What happened?

After installing controlnet, geting: Failed install handrefineportable error. https://github.com/Mikubill/sd-webui-controlnet then on reboot the server/webui gets

Launching Web UI with arguments: --autolaunch --xformers Traceback (most recent call last): File "C:\StableDiffusion\stable-diffusion-webui-1.8.0\launch.py", line 48, in main() File "C:\StableDiffusion\stable-diffusion-webui-1.8.0\launch.py", line 44, in main start() File "C:\StableDiffusion\stable-diffusion-webui-1.8.0\modules\launch_utils.py", line 465, in start import webui File "C:\StableDiffusion\stable-diffusion-webui-1.8.0\webui.py", line 13, in initialize.imports() File "C:\StableDiffusion\stable-diffusion-webui-1.8.0\modules\initialize.py", line 23, in imports import gradio # noqa: F401 File "C:\StableDiffusion\stable-diffusion-webui-1.8.0\venv\lib\site-packages\gradio_init_.py", line 3, in import gradio.components as components File "C:\StableDiffusion\stable-diffusion-webui-1.8.0\venv\lib\site-packages\gradio\components_init_.py", line 1, in from gradio.components.annotated_image import AnnotatedImage File "C:\StableDiffusion\stable-diffusion-webui-1.8.0\venv\lib\site-packages\gradio\components\annotated_image.py", line 13, in from gradio.components.base import IOComponent, Keywords File "C:\StableDiffusion\stable-diffusion-webui-1.8.0\venv\lib\site-packages\gradio\components\base.py", line 20, in from fastapi import UploadFile File "C:\StableDiffusion\stable-diffusion-webui-1.8.0\venv\lib\site-packages\fastapi_init.py", line 7, in from .applications import FastAPI as FastAPI File "C:\StableDiffusion\stable-diffusion-webui-1.8.0\venv\lib\site-packages\fastapi\applications.py", line 15, in from fastapi import routing File "C:\StableDiffusion\stable-diffusion-webui-1.8.0\venv\lib\site-packages\fastapi\routing.py", line 22, in from fastapi import params File "C:\StableDiffusion\stable-diffusion-webui-1.8.0\venv\lib\site-packages\fastapi\params.py", line 4, in from pydantic.fields import FieldInfo, Undefined ImportError: cannot import name 'Undefined' from 'pydantic.fields' (C:\StableDiffusion\stable-diffusion-webui-1.8.0\venv\lib\site-packages\pydantic\fields.py)

Steps to reproduce the problem

installed fresh a1111 version 1.9 installed controlnet extension thru the webui get: Failed install handrefineportable error. rebooted server/webui webui stops working and get

What should have happened?

should NOT get handrefineportable error during controlnet install and webui should boot up without errors

What browsers do you use to access the UI ?

Google Chrome

Sysinfo

webui does not boot

Console logs

venv "C:\StableDiffusion\stable-diffusion-webui-1.8.0\venv\Scripts\Python.exe"
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
Python 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
Version: 1.8.0-RC
Commit hash: <none>
Launching Web UI with arguments: --autolaunch --xformers
Traceback (most recent call last):
  File "C:\StableDiffusion\stable-diffusion-webui-1.8.0\launch.py", line 48, in <module>
    main()
  File "C:\StableDiffusion\stable-diffusion-webui-1.8.0\launch.py", line 44, in main
    start()
  File "C:\StableDiffusion\stable-diffusion-webui-1.8.0\modules\launch_utils.py", line 465, in start
    import webui
  File "C:\StableDiffusion\stable-diffusion-webui-1.8.0\webui.py", line 13, in <module>
    initialize.imports()
  File "C:\StableDiffusion\stable-diffusion-webui-1.8.0\modules\initialize.py", line 23, in imports
    import gradio  # noqa: F401
  File "C:\StableDiffusion\stable-diffusion-webui-1.8.0\venv\lib\site-packages\gradio\__init__.py", line 3, in <module>
    import gradio.components as components
  File "C:\StableDiffusion\stable-diffusion-webui-1.8.0\venv\lib\site-packages\gradio\components\__init__.py", line 1, in <module>
    from gradio.components.annotated_image import AnnotatedImage
  File "C:\StableDiffusion\stable-diffusion-webui-1.8.0\venv\lib\site-packages\gradio\components\annotated_image.py", line 13, in <module>
    from gradio.components.base import IOComponent, _Keywords
  File "C:\StableDiffusion\stable-diffusion-webui-1.8.0\venv\lib\site-packages\gradio\components\base.py", line 20, in <module>
    from fastapi import UploadFile
  File "C:\StableDiffusion\stable-diffusion-webui-1.8.0\venv\lib\site-packages\fastapi\__init__.py", line 7, in <module>
    from .applications import FastAPI as FastAPI
  File "C:\StableDiffusion\stable-diffusion-webui-1.8.0\venv\lib\site-packages\fastapi\applications.py", line 15, in <module>
    from fastapi import routing
  File "C:\StableDiffusion\stable-diffusion-webui-1.8.0\venv\lib\site-packages\fastapi\routing.py", line 22, in <module>
    from fastapi import params
  File "C:\StableDiffusion\stable-diffusion-webui-1.8.0\venv\lib\site-packages\fastapi\params.py", line 4, in <module>
    from pydantic.fields import FieldInfo, Undefined
ImportError: cannot import name 'Undefined' from 'pydantic.fields' (C:\StableDiffusion\stable-diffusion-webui-1.8.0\venv\lib\site-packages\pydantic\fields.py)
Press any key to continue . . .

Additional information

Someone else reported same issue on Controlnet repo but author said to report problem to A1111 as they have not changed anything new https://github.com/Mikubill/sd-webui-controlnet/issues/2757

KingsmanZer0 avatar Apr 17 '24 21:04 KingsmanZer0

I am having a similar issue: ImportError: cannot import name 'Undefined' from 'pydantic.fields' (C:\Users\palom\sdwebui\A1111 Web UI Autoinstaller\stable-diffusion-webui\venv\lib\site-packages\pydantic\fields.py)

ssplashh avatar Apr 17 '24 23:04 ssplashh

I am having a similar issue: ImportError: cannot import name 'Undefined' from 'pydantic.fields' (C:\Users\palom\sdwebui\A1111 Web UI Autoinstaller\stable-diffusion-webui\venv\lib\site-packages\pydantic\fields.py)

actually there was already a thread about this, someone found a temporary fix i tried it and it worked. here is the link https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/15551

KingsmanZer0 avatar Apr 17 '24 23:04 KingsmanZer0

Was having this error, what worked; , renamed extension folder, deleted venv folder, reinstalled and going again. Borked again, does it with CN and Deforum

NZperegrine avatar Apr 18 '24 02:04 NZperegrine

Some lib is not download/install it`s seem like, last month i got some issue;

lastYoueven avatar Apr 18 '24 07:04 lastYoueven

I also had the same problem. How do I solve this?

ucandoit74 avatar Apr 18 '24 08:04 ucandoit74

downgrading pydantic to 1.10.15 and albumentations to 1.4.3

the can be done by running a pip 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

w-e-w avatar Apr 18 '24 10:04 w-e-w

I solved it by reinstalling Automatic1111 again with Windows :)

ssplashh avatar Apr 18 '24 11:04 ssplashh

Hello, I just solved the problem. It seems that the issue might be due to the version incompatibility between the Pydantic version used and the version referenced in the code where "Undefined" is being used.

To address this issue, I tried resetting the virtual environment. You can manually delete the venv folder in the directory and then create a new venv folder in the same directory. Then activate the virtual environment:

venv\Scripts\activate

After activation, restart webui-user.bat and wait for the new dependencies to be installed. Then, downgrade Pydantic to the version 1.10.15:

pip install pydantic==1.10.15

After that, run webui-user.bat again, and everything should work fine.

I hope this helps everyone.

lucia520 avatar Apr 18 '24 12:04 lucia520

notice there is a update to the command that you need to run https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/15556#issuecomment-2063582512

w-e-w avatar Apr 18 '24 13:04 w-e-w

  • https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/15564

w-e-w avatar Apr 18 '24 13:04 w-e-w