BerriAI/litellm · error · ImportError
uvicorn, gunicorn needs to be imported. Run - `pip install '
Error message
uvicorn, gunicorn needs to be imported. Run - `pip install 'litellm[proxy]'`
What it means
Import guard on the default (non-granian) server path: 'import uvicorn' (and by extension gunicorn) failed because the ASGI server dependencies are missing from the environment; the message directs the user to install the litellm[proxy] extra.
Source
Thrown at litellm/proxy/proxy_cli.py:1071
headers=headers,
save=save,
config=config,
use_queue=use_queue,
)
if run_granian:
try:
import granian # noqa: F401
except ImportError as e:
raise ImportError(
"granian must be installed to use --run_granian. "
"Run `pip install granian` or `pip install 'litellm[proxy]'` "
"(Granian requires Python 3.10+)."
) from e
else:
try:
import uvicorn
except Exception:
raise ImportError("uvicorn, gunicorn needs to be imported. Run - `pip install 'litellm[proxy]'`")
db_connection_pool_limit = 100
# Starts optional due to config fallback checks; guaranteed non-None before use.
db_connection_timeout: int | float | None = 60
db_connect_timeout: int | float | None = None
db_socket_timeout: int | float | None = None
db_disable_prepared_statements: bool = False
db_extra_connection_params: dict | None = None
db_statement_timeout: float | None = None
db_lock_timeout: float | None = None
general_settings = {}
### GET DB TOKEN FOR IAM AUTH ###
if iam_token_db_auth or get_secret_bool("IAM_TOKEN_DB_AUTH"):
from litellm.proxy.auth.rds_iam_token import generate_iam_auth_token
db_host: Final = os.getenv("DATABASE_HOST")
# Default to the Postgres standard port. Without a default,View on GitHub (pinned to 77b7c6c40c)
Solutions
- Install the proxy extras: pip install 'litellm[proxy]' so uvicorn and gunicorn are available.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at litellm/proxy/proxy_cli.py:1071 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/f8f7589dcc5975b4.
Report an issue: GitHub.