python install_error ai_generated true

RuntimeError: Form data requires "python-multipart" to be installed.

ID: python/fastapi-form-data-requires-python-multipart

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

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
0.100.x active — — —
0.110.x active — — —

Root Cause

Using Form(...) or File(...) without the python-multipart package installed.

generic

中文

使用Form(...)或File(...)但未安装python-multipart包。

Workarounds

  1. 99% success
    pip install python-multipart
  2. 97% success
    echo 'python-multipart>=0.0.9' >> requirements.txt

Dead Ends

Common approaches that don't work:

  1. 70% fail

    If the client sends form-encoded data, FastAPI still needs multipart to parse it.

  2. 90% fail

    Wrong package name; FastAPI imports python_multipart.