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
S3Logger.async_upload_data_to_s3 needs requests plus botocore's S3SigV4Auth/AWSRequest to sign uploads; if either import fails it raises ImportError('Missing boto3 to call bedrock...') — the 'bedrock' wording is a copy-paste artifact, the actual missing modules are botocore (or requests). It fires per-upload, not at logger construction.
Source
Thrown at litellm/integrations/s3_v2.py:299
verbose_logger.debug(
"s3 logging: queue length %s, batch size %s",
len(self.log_queue),
self.batch_size,
)
except Exception as e:
verbose_logger.exception("s3 Layer Error - %s", e)
self.handle_callback_failure(callback_name="S3Logger")
async def async_upload_data_to_s3(self, batch_logging_element: s3BatchLoggingElement):
try:
import base64
import hashlib
import requests
from botocore.auth import S3SigV4Auth
from botocore.awsrequest import AWSRequest
except ImportError:
raise ImportError("Missing boto3 to call bedrock. Run 'pip install boto3'.")
try:
from litellm.litellm_core_utils.asyncify import asyncify
asyncified_get_credentials: Final = asyncify(self.get_credentials)
credentials: Final = await asyncified_get_credentials(
aws_access_key_id=self.s3_aws_access_key_id,
aws_secret_access_key=self.s3_aws_secret_access_key,
aws_session_token=self.s3_aws_session_token,
aws_region_name=self.s3_region_name,
aws_session_name=self.s3_aws_session_name,
aws_profile_name=self.s3_aws_profile_name,
aws_role_name=self.s3_aws_role_name,
aws_web_identity_token=self.s3_aws_web_identity_token,
aws_sts_endpoint=self.s3_aws_sts_endpoint,
)
verbose_logger.debug("s3_v2 logger - uploading data to s3 - %s", batch_logging_element.s3_object_key)
verbose_logger.debug("s3_v2 logger - s3_verify setting: %s", self.s3_verify)View on GitHub (pinned to 6c2dcb801b)
Solutions
- pip install boto3 (pulls botocore) and requests in the runtime environment — or pip install 'litellm[extra_proxy]'
- Verify in the same interpreter: python -c "from botocore.auth import S3SigV4Auth; import requests"
- Restart the proxy/callback so the import retry succeeds
Example fix
# before litellm.callbacks = ["s3"] # ImportError on first flush: Missing boto3 # after # pip install boto3 requests import botocore.auth, requests # sanity check litellm.callbacks = ["s3"]
Defensive patterns
Strategy: validation
Validate before calling
try:
import botocore.auth, requests # noqa: F401
except ImportError:
raise SystemExit("S3 logging needs boto3: pip install boto3 requests")
litellm.callbacks = ["s3"] Try / catch
try:
await s3_logger.async_upload_data_to_s3(batch_element)
except ImportError as e:
if "Missing boto3" in str(e):
logger.error("s3 upload skipped: boto3 not installed")
else:
raise Prevention
- Install litellm[extra_proxy] (or boto3+requests explicitly) in every image that enables s3 logging
- Verify imports in the same interpreter/worker that runs callbacks, not just the shell
- Include a dependency assertion in the proxy's startup healthcheck
When it happens
Trigger: Enabling the s3_v2 logging callback in an environment without boto3/botocore installed (base litellm install); slim Docker images; async paths running in a worker process with a different site-packages.
Common situations: Adding litellm.callbacks = ["s3"] (v2 logger) without the proxy extras; pip installing litellm fresh in CI and assuming S3 deps are bundled; uninstalling boto3 after bedrock usage was removed but keeping S3 logging.
Related errors
- Missing boto3 to call S3. Run 'pip install boto3'.
- Missing prometheus_client. Run `pip install prometheus-clien
- Bedrock event-stream shape could not be loaded from botocore
- Bedrock event-stream shape could not be loaded from botocore
- Missing google.cloud package. Run `pip install --upgrade goo
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/b1034b4060063bff.
Report an issue: GitHub.