BerriAI/litellm · error · ImportError

Missing boto3 to call bedrock. Run 'pip install boto3'.

Error message

Missing boto3 to call bedrock. Run 'pip install boto3'.

What it means

Raised by BedrockFileTransformation.sign_aws_request when the botocore modules needed for AWS SigV4 signing (botocore.auth.SigV4Auth, botocore.awsrequest.AWSRequest) cannot be imported. LiteLLM does not vendor AWS signing; it depends on boto3/botocore being installed in the same environment. Any Bedrock feature that signs requests itself (S3 file uploads for file-based transformations, batch jobs) hits this guard.

Solutions

  1. Install the AWS extra: pip install 'litellm[bedrock]' (or plain 'pip install boto3') in the SAME virtualenv/interpreter that runs litellm
  2. Verify with: python -c "import botocore.auth, botocore.awsrequest" using the exact interpreter your app runs on
  3. In containers, add boto3 to the image requirements and rebuild rather than relying on runtime installs
  4. If your package manager (poetry/uv/pipenv) pruned it, pin boto3 explicitly in your dependency manifest

Example fix

# before: litellm installed bare
pip install litellm

# after
pip install 'litellm[bedrock]'   # pulls in boto3/botocore
Defensive patterns

Strategy: validation

Validate before calling

def assert_boto3_available() -> None:
    try:
        import botocore.auth  # noqa: F401
        import botocore.awsrequest  # noqa: F401
    except ImportError as e:
        raise RuntimeError(
            'boto3 missing for bedrock signing; run: pip install "litellm[bedrock]"'
        ) from e

assert_boto3_available()  # call once at app startup

Try / catch

try:
    signed = transformer.sign_aws_request('s3', payload, url, params)
except ImportError as e:
    if 'pip install boto3' in str(e):
        raise DependencyError('install litellm[bedrock] extra') from e
    raise

Prevention

When it happens

Trigger: Invoking bedrock file-based transformation or batch APIs (which call sign_aws_request with service 'bedrock' or 's3') in an environment where botocore is not installed, is installed for a different Python interpreter/virtualenv, or is a broken partial install.

Common situations: Installing litellm with the minimal wheel (boto3 is an optional extra, not a hard dependency) then calling bedrock file/batch endpoints; pip installing as root but running the app under a different user/venv; Docker images that strip boto3; dependency resolvers downgrading or removing botocore.

Related errors


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/86c692ce8017f15b. Report an issue: GitHub.

Appendix: source

Thrown at litellm/llms/bedrock/common_utils.py:1475

    ) -> tuple:
        """
        Sign AWS request using Signature Version 4.

        Args:
            service_name: AWS service name ("bedrock" or "s3")
            data: Request data (string or dict)
            endpoint_url: Full endpoint URL
            optional_params: Optional parameters containing AWS credentials
            method: HTTP method (default: POST)

        Returns:
            Tuple of (signed_headers, signed_data)
        """
        try:
            from botocore.auth import SigV4Auth
            from botocore.awsrequest import AWSRequest
        except ImportError:
            raise ImportError("Missing boto3 to call bedrock. Run 'pip install boto3'.")

        # Get AWS credentials using existing methods
        aws_region_name: Final = self._base_aws._get_aws_region_name(optional_params=optional_params, model="")
        credentials: Final = self._base_aws.get_credentials(
            aws_access_key_id=optional_params.get("aws_access_key_id"),
            aws_secret_access_key=optional_params.get("aws_secret_access_key"),
            aws_session_token=optional_params.get("aws_session_token"),
            aws_region_name=aws_region_name,
            aws_session_name=optional_params.get("aws_session_name"),
            aws_profile_name=optional_params.get("aws_profile_name"),
            aws_role_name=optional_params.get("aws_role_name"),
            aws_web_identity_token=optional_params.get("aws_web_identity_token"),
            aws_sts_endpoint=optional_params.get("aws_sts_endpoint"),
        )

        # Prepare the request data
        method_upper: Final = method.upper()
        if method_upper == "GET":

View on GitHub (pinned to 77b7c6c40c)