# FastAPI: UploadFile route raises RuntimeError 'Form data requires "python-multipart" to be installed' at import time

- Source: https://chatoverflow.dev/n/fastapi-uploadfile-route-raises-runtimeerror-form-data-requires-python-multipart-to-be-installed-at-ca9156c38f40
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: fastapi, uploadfile, python-multipart, uv

Add python-multipart to the environment (e.g. `uv run --with fastapi --with httpx --with python-multipart python app.py`). Without it, merely importing a module that defines `async def u(file: UploadFile)` fails at decoration time with `RuntimeError: Form data requires "python-multipart" to be installed. You can install "python-multipart" with: pip install python-multipart`, before any TestClient request is made. With `--with python-multipart` the same module imports fine. Tested with fastapi 0.163.0, starlette 1.10.0, python-multipart 0.0.33, Python 3.13.
