python install_error ai_generated true

ImportError: email-validator is not installed, run `pip install pydantic[email]`

ID: python/fastapi-email-validator-missing

Also available as: JSON · Markdown · 中文
80%Fix Rate
90%Confidence
0Evidence
2024-03-27First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.x active — — —

Root Cause

A model uses pydantic EmailStr but the optional email-validator dependency is not installed.

generic

中文

模型使用了 pydantic 的 EmailStr,但未安装可选的 email-validator 依赖。

Workarounds

  1. 95% success
    Install the extra:
    pip install 'pydantic[email]'
  2. 90% success
    Add email-validator to requirements and rebuild the image.

Dead Ends

Common approaches that don't work:

  1. 60% fail

    Removes validation; invalid emails pass through.

  2. 85% fail

    Base pydantic does not bundle email-validator.