python
install_error
ai_generated
true
ImportError: email-validator is not installed, run `pip install pydantic[email]`
ID: python/fastapi-attribute-error-email-validator
80%Fix Rate
90%Confidence
0Evidence
2024-07-08First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 2.x | active | — | — | — |
Root Cause
A Pydantic model uses `EmailStr`, which requires the optional `email-validator` dependency.
generic中文
Pydantic 模型使用了 `EmailStr`,它依赖可选的 `email-validator` 包。
Workarounds
-
98% success
pip install 'pydantic[email]'
-
97% success
echo 'pydantic[email]' >> requirements.txt && pip install -r requirements.txt
Dead Ends
Common approaches that don't work:
-
70% fail
Loses email validation; invalid emails pass through to the DB.
-
95% fail
Wrong package name; installs an unrelated module.