python
install_error
ai_generated
true
pydantic.errors.PydanticUserError: `EmailStr` requires the `email-validator` package. Install it with `pip install pydantic[email]`.
ID: python/pydantic-email-str-deprecated
80%Fix Rate
90%Confidence
0Evidence
2024-01-18First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 2.x | active | — | — | — |
Root Cause
EmailStr is used but the optional email-validator dependency is not installed.
generic中文
使用了 EmailStr,但未安装可选的 email-validator 依赖。
Workarounds
-
98% success
pip install 'pydantic[email]'
-
97% success
pip install email-validator # then from pydantic import BaseModel, EmailStr class U(BaseModel): email: EmailStr
Dead Ends
Common approaches that don't work:
-
70% fail
Wrong package; 'email' is a stdlib module, not a PyPI validator.
-
55% fail
Loses email format validation; invalid addresses pass through.
-
40% fail
Import still fails until the interpreter restarts.