{"record":{"id":"f8f7589dcc5975b4","repo":"BerriAI/litellm","slug":"uvicorn-gunicorn-needs-to-be-imported-run-pip","errorCode":null,"errorMessage":"uvicorn, gunicorn needs to be imported. Run - `pip install 'litellm[proxy]'`","messagePattern":"uvicorn, gunicorn needs to be imported\\. Run - `pip install 'litellm\\[proxy\\]'`","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"litellm/proxy/proxy_cli.py","lineNumber":1071,"sourceCode":"            headers=headers,\n            save=save,\n            config=config,\n            use_queue=use_queue,\n        )\n        if run_granian:\n            try:\n                import granian  # noqa: F401\n            except ImportError as e:\n                raise ImportError(\n                    \"granian must be installed to use --run_granian. \"\n                    \"Run `pip install granian` or `pip install 'litellm[proxy]'` \"\n                    \"(Granian requires Python 3.10+).\"\n                ) from e\n        else:\n            try:\n                import uvicorn\n            except Exception:\n                raise ImportError(\"uvicorn, gunicorn needs to be imported. Run - `pip install 'litellm[proxy]'`\")\n\n        db_connection_pool_limit = 100\n        # Starts optional due to config fallback checks; guaranteed non-None before use.\n        db_connection_timeout: int | float | None = 60\n        db_connect_timeout: int | float | None = None\n        db_socket_timeout: int | float | None = None\n        db_disable_prepared_statements: bool = False\n        db_extra_connection_params: dict | None = None\n        db_statement_timeout: float | None = None\n        db_lock_timeout: float | None = None\n        general_settings = {}\n        ### GET DB TOKEN FOR IAM AUTH ###\n\n        if iam_token_db_auth or get_secret_bool(\"IAM_TOKEN_DB_AUTH\"):\n            from litellm.proxy.auth.rds_iam_token import generate_iam_auth_token\n\n            db_host: Final = os.getenv(\"DATABASE_HOST\")\n            # Default to the Postgres standard port. Without a default,","sourceCodeStart":1053,"sourceCodeEnd":1089,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/proxy_cli.py#L1053-L1089","documentation":"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.","triggerScenarios":"Thrown at litellm/proxy/proxy_cli.py:1071 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Install the proxy extras: pip install 'litellm[proxy]' so uvicorn and gunicorn are available."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}