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
The Bedrock embedding path imports botocore.credentials to construct AWS credentials; if boto3/botocore is absent, it fails immediately with this ImportError. It fires before any credential resolution or network activity.
Source
Thrown at litellm/llms/bedrock/embed/embedding.py:49
from .amazon_nova_transformation import AmazonNovaEmbeddingConfig
from .amazon_titan_g1_transformation import AmazonTitanG1Config
from .amazon_titan_multimodal_transformation import (
AmazonTitanMultimodalEmbeddingG1Config,
)
from .amazon_titan_v2_transformation import AmazonTitanV2Config
from .cohere_transformation import BedrockCohereEmbeddingConfig
from .twelvelabs_marengo_transformation import TwelveLabsMarengoEmbeddingConfig
class BedrockEmbedding(BaseAWSLLM):
def _load_credentials(
self,
optional_params: dict,
) -> tuple[Any, str]:
try:
from botocore.credentials import Credentials
except ImportError:
raise ImportError("Missing boto3 to call bedrock. Run 'pip install boto3'.")
## CREDENTIALS ##
# pop aws_secret_access_key, aws_access_key_id, aws_session_token, aws_region_name from kwargs, since completion calls fail with them
aws_secret_access_key: Final = optional_params.pop("aws_secret_access_key", None)
aws_access_key_id: Final = optional_params.pop("aws_access_key_id", None)
aws_session_token: Final = optional_params.pop("aws_session_token", None)
aws_region_name = optional_params.pop("aws_region_name", None)
aws_role_name: Final = optional_params.pop("aws_role_name", None)
aws_session_name: Final = optional_params.pop("aws_session_name", None)
aws_profile_name: Final = optional_params.pop("aws_profile_name", None)
aws_web_identity_token: Final = optional_params.pop("aws_web_identity_token", None)
aws_sts_endpoint: Final = optional_params.pop("aws_sts_endpoint", None)
### SET REGION NAME ###
if aws_region_name is None:
# check env #
litellm_aws_region_name: Final = get_secret("AWS_REGION_NAME", None)
if litellm_aws_region_name is not None and isinstance(litellm_aws_region_name, str):View on GitHub (pinned to 6c2dcb801b)
Solutions
- pip install boto3 in the interpreter running your app
- Add boto3 to project dependencies and rebuild the deployment image
- Sanity check: python -c "import botocore.credentials"
Example fix
# before
pip install litellm
# after
pip install litellm boto3
python -c "import botocore.credentials; print('ok')" Defensive patterns
Strategy: type-guard
Validate before calling
def aws_deps_ok() -> bool:
try:
import botocore.credentials # noqa: F401
return True
except ImportError:
return False
if not aws_deps_ok():
raise SystemExit("Missing boto3 to call bedrock. Run 'pip install boto3'.") Try / catch
try:
from litellm import embedding
resp = embedding(model="bedrock/...", input=["hi"])
except ImportError as e:
if "boto3" in str(e):
sys.exit("install boto3 to use the bedrock provider")
raise Prevention
- Declare boto3 as a hard dependency wherever bedrock models are configured
- Fail fast at app startup with an import check rather than at first embedding request
When it happens
Trigger: Calling litellm.embedding with a bedrock/* model in an environment lacking boto3 — e.g. litellm installed without AWS extras, or a slim container image.
Common situations: Fresh venvs, Docker images based on python-slim without build deps, CI runners with cached old lockfiles that dropped botocore, or deploying the LiteLLM proxy from a minimal base image.
Related errors
- Missing boto3 to call bedrock. Run 'pip install boto3'.
- {err.response.text}
- Timeout error occurred.
- Missing botocore to use AWS SigV4 authentication. Run 'pip i
- Model needs to be set for bedrock
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/ae8da2c3c4d2c9bc.
Report an issue: GitHub.