crewAIInc/crewAI · error · ImportError
`boto3` package not found, please run `uv add boto3`
Error message
`boto3` package not found, please run `uv add boto3`
What it means
Raised by S3ReaderTool._run() when the lazy `import boto3` fails — the AWS SDK is not installed in the active environment. crewai-tools lists boto3 only as a package_dependency hint; at runtime the S3 reader imports it inside _run and converts ImportError into this message with the uv add instruction.
Source
Thrown at lib/crewai-tools/src/crewai_tools/aws/s3/reader_tool.py:26
"""Input schema for S3ReaderTool."""
file_path: str = Field(
..., description="S3 file path (e.g., 's3://bucket-name/file-name')"
)
class S3ReaderTool(BaseTool):
name: str = "S3 Reader Tool"
description: str = "Reads a file from Amazon S3 given an S3 file path"
args_schema: type[BaseModel] = S3ReaderToolInput
package_dependencies: list[str] = Field(default_factory=lambda: ["boto3"])
def _run(self, file_path: str) -> str:
try:
import boto3
from botocore.exceptions import ClientError
except ImportError as e:
raise ImportError(
"`boto3` package not found, please run `uv add boto3`"
) from e
try:
bucket_name, object_key = self._parse_s3_path(file_path)
s3 = boto3.client(
"s3",
region_name=os.getenv("CREW_AWS_REGION", "us-east-1"),
aws_access_key_id=os.getenv("CREW_AWS_ACCESS_KEY_ID"),
aws_secret_access_key=os.getenv("CREW_AWS_SEC_ACCESS_KEY"),
)
response = s3.get_object(Bucket=bucket_name, Key=object_key)
result: str = response["Body"].read().decode("utf-8")
return result
except ClientError as e:View on GitHub (pinned to 754d7323be)
Solutions
- uv add boto3 (or pip install boto3) into the environment running the tool
- Prefer crewai-tools with AWS extras if your workflow supports it
- Verify: python -c "import boto3" with the same interpreter
- Dockerfile: add boto3 to the image requirements
Example fix
# before: tool._run('s3://bucket/key') raises ImportError
# after (shell): uv add boto3 && python -c "import boto3" Defensive patterns
Strategy: validation
Validate before calling
try:
import boto3 # noqa: F401
except ImportError:
raise SystemExit('S3ReaderTool needs boto3: run `uv add boto3`') Try / catch
try:
content = S3ReaderTool()._run('s3://bucket/key')
except ImportError as e:
if 'boto3' in str(e):
subprocess.check_call(['uv', 'add', 'boto3']) # or fail with instructions
raise Prevention
- Include boto3 in base requirements for any project using the aws tools
- Add an import smoke test in CI for optional AWS deps
- Set CREW_AWS_REGION/CREW_AWS_ACCESS_KEY_ID/CREW_AWS_SEC_ACCESS_KEY early to surface config issues at startup
When it happens
Trigger: Invoking S3ReaderTool without boto3 in the interpreter: minimal pip install of crewai-tools, a slim container, or a different venv than the one where boto3 was installed.
Common situations: First use of the S3 tools in a project; CI pipelines installing only core dependencies; local venv vs system Python mismatch.
Related errors
- `boto3` package not found, please run `uv add boto3`
- boto3 is required for Bedrock S3 file uploads. Install with:
- `boto3` package not found, please run `uv add boto3`
- aioboto3 is required for async Bedrock S3 file uploads. Inst
- `boto3` package not found, please run `uv add boto3`
AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15).
Data as JSON: /api/errors/d651cc3f6fb5e861.
Report an issue: GitHub.