BerriAI/litellm · error · ImportError
granian must be installed to use --run_granian. Run `pip ins
Error message
granian must be installed to use --run_granian. Run `pip install granian` or `pip install 'litellm[proxy]'` (Granian requires Python 3.10+).
What it means
Import guard for the --run_granian flag: 'import granian' raised ImportError because the granian server package is not installed (or Python is < 3.10). The original ImportError is chained; the message names the pip command that supplies it.
Source
Thrown at litellm/proxy/proxy_cli.py:1062
debug=debug,
detailed_debug=detailed_debug,
temperature=temperature,
max_tokens=max_tokens,
request_timeout=request_timeout,
max_budget=max_budget,
telemetry=telemetry,
drop_params=drop_params,
add_function_to_prompt=add_function_to_prompt,
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 = NoneView on GitHub (pinned to 77b7c6c40c)
Solutions
- Install granian: pip install granian (requires Python 3.10+), or omit --run_granian to use uvicorn/gunicorn.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at litellm/proxy/proxy_cli.py:1062 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/5a2d911d1890eca8.
Report an issue: GitHub.