python module_error ai_generated true

ModuleNotFoundError: No module named 'uvicorn'

ID: python/starlette-no-module-named-uvicorn

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

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.x active — — —

Root Cause

FastAPI/Starlette does not bundle an ASGI server; uvicorn was never installed in the active environment.

generic

中文

FastAPI/Starlette 不内置 ASGI 服务器;当前环境中未安装 uvicorn。

Workarounds

  1. 95% success
    Install server extra:
    pip install 'fastapi[standard]'  # or: pip install uvicorn
  2. 85% success
    Verify the interpreter matches:
    which python && python -m uvicorn --version

Dead Ends

Common approaches that don't work:

  1. 80% fail

    fastapi does not depend on uvicorn by default.

  2. 85% fail

    The module import still fails before any server starts.