{"record":{"id":"04f55e4f4e45c060","repo":"BerriAI/litellm","slug":"missing-boto3-to-call-aws-polly-run-pip-install","errorCode":null,"errorMessage":"Missing boto3 to call AWS Polly. Run 'pip install boto3'.","messagePattern":"Missing boto3 to call AWS Polly\\. Run 'pip install boto3'\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"litellm/llms/aws_polly/text_to_speech/transformation.py","lineNumber":267,"sourceCode":"        return \"<speak>\" in input or \"<speak \" in input\n\n    def _sign_polly_request(\n        self,\n        request_body: dict[str, Any],\n        endpoint_url: str,\n        litellm_params: dict,\n    ) -> tuple[dict[str, str], str]:\n        \"\"\"\n        Sign the AWS Polly request using SigV4.\n\n        Returns:\n            Tuple of (signed_headers, json_body_string)\n        \"\"\"\n        try:\n            from botocore.auth import SigV4Auth\n            from botocore.awsrequest import AWSRequest\n        except ImportError:\n            raise ImportError(\"Missing boto3 to call AWS Polly. Run 'pip install boto3'.\")\n\n        # Get AWS region\n        aws_region_name: Final = litellm_params.get(\"aws_region_name\", self.DEFAULT_REGION)\n\n        # Get AWS credentials\n        credentials: Final = self.get_credentials(\n            aws_access_key_id=litellm_params.get(\"aws_access_key_id\"),\n            aws_secret_access_key=litellm_params.get(\"aws_secret_access_key\"),\n            aws_session_token=litellm_params.get(\"aws_session_token\"),\n            aws_region_name=aws_region_name,\n            aws_session_name=litellm_params.get(\"aws_session_name\"),\n            aws_profile_name=litellm_params.get(\"aws_profile_name\"),\n            aws_role_name=litellm_params.get(\"aws_role_name\"),\n            aws_web_identity_token=litellm_params.get(\"aws_web_identity_token\"),\n            aws_sts_endpoint=litellm_params.get(\"aws_sts_endpoint\"),\n            aws_external_id=litellm_params.get(\"aws_external_id\"),\n        )\n","sourceCodeStart":249,"sourceCodeEnd":285,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/aws_polly/text_to_speech/transformation.py#L249-L285","documentation":"Dependency error while signing an AWS Polly text-to-speech request with SigV4. The transformation lazily imports botocore.auth.SigV4Auth / botocore.awsrequest.AWSRequest; if the boto3/botocore package is not installed, the ImportError is re-raised with an install hint. Polly requests are signed and sent directly, so botocore must be present in the calling environment.","triggerScenarios":"Calling litellm text-to-speech with an aws_polly model in an environment where boto3 (which bundles botocore) was never installed — litellm does not ship boto3 by default. Also when a slim/vendored install strips botocore.","commonSituations":"Adding Polly to an existing litellm deployment without the optional dependency; lambda/serverless images trimmed of boto3; dependency conflicts where another package pinned a botocore version that fails to import.","solutions":["pip install boto3 (or add boto3 to your requirements).","For serverless images, ensure boto3 is in the final layer and not pruned by size optimizers.","If botocore is installed but broken, check for version conflicts: pip check, then reinstall boto3."],"exampleFix":"# before (shell)\npython -c \"import botocore\"  # ModuleNotFoundError -> litellm Polly call raises ImportError\n\n# after (shell)\npip install boto3\npython -c \"import botocore; print(botocore.__version__)\"","handlingStrategy":"validation","validationCode":"def polly_dependency_available() -> bool:\n    try:\n        import botocore.auth  # noqa: F401\n        return True\n    except ImportError:\n        return False","typeGuard":null,"tryCatchPattern":"try:\n    audio = litellm.text_to_speech(model=\"aws_polly/...\", ...)\nexcept ImportError as e:\n    if \"boto3\" in str(e):\n        raise RuntimeError(\"TTS unavailable: run 'pip install boto3' to enable Polly\") from e\n    raise","preventionTips":["Add boto3 to project dependencies whenever Polly models are configured.","Include a startup dependency probe for optional-provider extras.","When trimming serverless images, keep boto3 if Polly is used."],"tags":["aws","polly","text-to-speech","dependency","boto3"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}