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
LiteLLM's Bedrock request-signing path needs botocore's SigV4Auth to sign requests; when the import fails it raises this ImportError telling you boto3/botocore is not installed. It occurs while preparing a signed AWS request, before any network call is made.
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 6c2dcb801b)
Solutions
- pip install boto3 (or pip install 'boto3[bedrock]') in the active interpreter
- Add boto3 to your requirements.txt/pyproject dependencies alongside litellm
- Verify with: python -c "import botocore.auth" in the same venv the app runs in
Example fix
# before: ImportError at request time
# after
pip install "boto3[bedrock]"
python -c "from botocore.auth import SigV4Auth; print('ok')" Defensive patterns
Strategy: type-guard
Validate before calling
def boto3_available() -> bool:
try:
import botocore.auth, botocore.awsrequest # noqa: F401
return True
except ImportError:
return False
assert boto3_available(), "pip install boto3 before using bedrock provider" Try / catch
try:
resp = await client.sign_and_call(...)
except ImportError as e:
if 'boto3' in str(e):
sys.exit("AWS provider unavailable: install boto3 or switch to a non-Bedrock model") Prevention
- Add boto3 (or litellm[extra_proxy]) to pinned dependencies
- Run a startup dependency check in entrypoints that use bedrock
- Bake boto3 into deployment images instead of relying on runtime installs
When it happens
Trigger: Running LiteLLM with the bedrock provider in an environment where 'pip install boto3[bedrock]' was never run, or where botocore was uninstalled/upgraded away; also slim Docker images that omit optional AWS extras.
Common situations: Installing litellm without the [extra_proxy] or AWS extras, CI images trimmed for size, dependency resolvers downgrading/removing botocore, or virtualenv mismatch where the app runs in a different interpreter than the one where boto3 was installed.
Related errors
- Missing boto3 to call bedrock. Run 'pip install boto3'.
- Missing botocore to use AWS SigV4 authentication. Run 'pip i
- Model needs to be set for bedrock
- BedrockException: Context Window Error - {error_str}
- BedrockException Invalid Authentication - {error_str}
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/86c692ce8017f15b.
Report an issue: GitHub.