[Bug]: ImportError: cannot import name 'Undefined' from 'pydantic.fields' on start
Checklist
- [ ] 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
- [ ] The issue has not been reported before recently
- [ ] The issue has been reported before but has not been fixed yet
What happened?
windows 11 Python 3.10.6 Nvidea 3070
Try to (clean) install as writed in readme: "If you know what you are doing, you can install Forge using same method as SD-WebUI. (Install Git, Python, Git Clone the forge repo https://github.com/lllyasviel/stable-diffusion-webui-forge.git and then run webui-user.bat"
After run webui-user.bat i see in console: ImportError: cannot import name 'Undefined' from 'pydantic.fields' (E:\forge\stable-diffusion-webui-forge\venv\lib\site-packages\pydantic\fields.py)
Steps to reproduce the problem
- clean install
- run webui-user.bat
What should have happened?
running forge web ui
What browsers do you use to access the UI ?
No response
Sysinfo
I can't open settings
Console logs
venv "E:\forge\stable-diffusion-webui-forge\venv\Scripts\Python.exe"
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Version: f0.0.17v1.8.0rc-latest-276-g29be1da7
Commit hash: 29be1da7cf2b5dccfc70fbdd33eb35c56a31ffb7
Launching Web UI with arguments:
Total VRAM 8192 MB, total RAM 32549 MB
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 3070 : native
Hint: your device supports --pin-shared-memory for potential speed improvements.
Hint: your device supports --cuda-malloc for potential speed improvements.
Hint: your device supports --cuda-stream for potential speed improvements.
VAE dtype: torch.bfloat16
CUDA Stream Activated: False
Traceback (most recent call last):
File "E:\forge\stable-diffusion-webui-forge\launch.py", line 51, in <module>
main()
File "E:\forge\stable-diffusion-webui-forge\launch.py", line 47, in main
start()
File "E:\forge\stable-diffusion-webui-forge\modules\launch_utils.py", line 541, in start
import webui
File "E:\forge\stable-diffusion-webui-forge\webui.py", line 19, in <module>
initialize.imports()
File "E:\forge\stable-diffusion-webui-forge\modules\initialize.py", line 35, in imports
import gradio # noqa: F401
File "E:\forge\stable-diffusion-webui-forge\venv\lib\site-packages\gradio\__init__.py", line 3, in <module>
import gradio.components as components
File "E:\forge\stable-diffusion-webui-forge\venv\lib\site-packages\gradio\components\__init__.py", line 1, in <module>
from gradio.components.annotated_image import AnnotatedImage
File "E:\forge\stable-diffusion-webui-forge\venv\lib\site-packages\gradio\components\annotated_image.py", line 13, in <module>
from gradio.components.base import IOComponent, _Keywords
File "E:\forge\stable-diffusion-webui-forge\venv\lib\site-packages\gradio\components\base.py", line 20, in <module>
from fastapi import UploadFile
File "E:\forge\stable-diffusion-webui-forge\venv\lib\site-packages\fastapi\__init__.py", line 7, in <module>
from .applications import FastAPI as FastAPI
File "E:\forge\stable-diffusion-webui-forge\venv\lib\site-packages\fastapi\applications.py", line 15, in <module>
from fastapi import routing
File "E:\forge\stable-diffusion-webui-forge\venv\lib\site-packages\fastapi\routing.py", line 22, in <module>
from fastapi import params
File "E:\forge\stable-diffusion-webui-forge\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' (E:\forge\stable-diffusion-webui-forge\venv\lib\site-packages\pydantic\fields.py)
Press any key to continue . . .
Additional information
No response
downgrade pydantic to 2.7.0 https://github.com/LykosAI/StabilityMatrix/issues/602#issuecomment-2120269510 (mentioning it here JFI)
pydantic==1.10.15 in requirements_versions.txt solved the problem. I don't know what the consequences might be. When can we expect a normal solution to the problem?
pydantic==1.10.15 in requirements_versions.txt solved the problem. I don't know what the consequences might be. When can we expect a normal solution to the problem?
You can try to switch to the dev2 branch and see if it's fixed there.
If not, have to wait until this is noticed and the change is made.
Was about to suggest 1.10.x but I noticed that it gets upgraded to 2.7.1 later on, maybe that's a Stability matrix thing idk
i just tried using pydantic 2.7.0, 1.10.15, reinstalling the whole requirements_versions but i still get this error on startup
so here's how i fixed it (for now), hopefully it's helpful for someone else too
my issue apparently was that i was launching the webuy from a conda environment - a clean one that i created right before installing this repo, but apparently it was conflicting with some package. I deactivated it and activated the venv in the repo, reinstalled requirements_versions, launched webui.py and it gave me some new conflict, i upgrded/downgraded the suggested packages and now it seems to be working
also, apparently setuptools 70.0.0 might be responsible for some wrong dependency, downgrade it to 69.5.1
I think I have an inkling. When I start it from web-user I get the error. But when I open it with run.bat it launches just fine. It may have something to do with call environment.bat.
pydantic==1.10.15 in requirements_versions.txt solved the problem. I don't know what the consequences might be. When can we expect a normal solution to the problem?
You can try to switch to the
dev2branch and see if it's fixed there. If not, have to wait until this is noticed and the change is made.Was about to suggest 1.10.x but I noticed that it gets upgraded to 2.7.1 later on, maybe that's a Stability matrix thing idk
dev2 also has the same issue, just tested
Ran into the same problem on a fresh install today (20240602), got it solved by adding those two lines to requirements.txt:
pydantic==2.7.0 protobuf==4.25.3
and then doing a "pip install -r requirements.txt" from within the activated venv.
Same issue installed both manually within venv activated. Will not load