crewAIInc/crewAI · error · ImportError
boto3 is required for Bedrock S3 file uploads. Install with:
Error message
boto3 is required for Bedrock S3 file uploads. Install with: pip install boto3
What it means
ImportError raised lazily from BedrockFileUploader._get_client when import boto3 fails: the AWS SDK for Python is not installed, so the sync S3 client cannot be created. As with other lazy imports, construction succeeds and the error appears on first client use.
Source
Thrown at lib/crewai-files/src/crewai_files/uploaders/bedrock.py:167
"S3 bucket name not configured. Set CREWAI_BEDROCK_S3_BUCKET "
"environment variable or pass bucket_name parameter."
)
return self._bucket_name
@property
def bucket_owner(self) -> str | None:
"""Return the configured bucket owner."""
return self._bucket_owner
def _get_client(self) -> Any:
"""Get or create the S3 client."""
if self._client is None:
try:
import boto3
self._client = boto3.client("s3", region_name=self._region)
except ImportError as e:
raise ImportError(
"boto3 is required for Bedrock S3 file uploads. "
"Install with: pip install boto3"
) from e
return self._client
def _get_async_client(self) -> Any:
"""Get or create the async S3 client."""
if self._async_client is None:
try:
import aioboto3 # type: ignore[import-not-found]
self._session = aioboto3.Session()
except ImportError as e:
raise ImportError(
"aioboto3 is required for async Bedrock S3 file uploads. "
"Install with: pip install aioboto3"
) from e
return self._sessionView on GitHub (pinned to 754d7323be)
Solutions
- pip install boto3 in the active environment.
- Verify with python -c "import boto3; print(boto3.__version__)" in the same interpreter that runs the app.
- Warm the client at startup (uploader._get_client()) to fail fast.
Example fix
# before uploader = BedrockFileUploader(bucket_name='b', region_name='us-east-1') uploader.upload(file) # ImportError: boto3 required # after # pip install boto3 uploader = BedrockFileUploader(bucket_name='b', region_name='us-east-1') uploader._get_client() # fail fast uploader.upload(file)
Defensive patterns
Strategy: validation
Validate before calling
import importlib.util
if importlib.util.find_spec("boto3") is None:
raise RuntimeError("pip install boto3 required for Bedrock uploads") Try / catch
try:
uploader.upload(file)
except ImportError as e:
if "boto3" in str(e):
subprocess.check_call([sys.executable, "-m", "pip", "install", "boto3"]) # controlled self-heal
raise Prevention
- Include boto3 in the deployment image's requirements.
- Warm _get_client() at startup to detect missing SDKs before traffic.
- Pin boto3 to a known-good version to avoid resolver surprises.
When it happens
Trigger: Calling bedrock_uploader.upload(file) (or anything touching _get_client) in an interpreter where boto3 is absent or broken.
Common situations: Deploying the Bedrock uploader without installing boto3; running in a slim container image that never included it; a dependency resolver removing boto3 during an unrelated upgrade.
Related errors
- aioboto3 is required for async Bedrock S3 file uploads. Inst
- `boto3` package not found, please run `uv add boto3`
- `boto3` package not found, please run `uv add boto3`
- `boto3` package not found, please run `uv add boto3`
- `boto3` package not found, please run `uv add boto3`
AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15).
Data as JSON: /api/errors/cdefff67d61fc913.
Report an issue: GitHub.