{"record":{"id":"046cac7d25ab78fa","repo":"crewAIInc/crewAI","slug":"boto3-package-not-found-please-run-uv-add-boto-046cac","errorCode":null,"errorMessage":"`boto3` package not found, please run `uv add boto3`","messagePattern":"`boto3` package not found, please run `uv add boto3`","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"lib/crewai-tools/src/crewai_tools/aws/bedrock/knowledge_base/retriever_tool.py","lineNumber":188,"sourceCode":"            result_object[\"score\"] = result[\"score\"]\n\n        if \"metadata\" in result:\n            result_object[\"metadata\"] = result[\"metadata\"]\n\n        if \"byteContent\" in content_obj:\n            result_object[\"byte_content\"] = content_obj[\"byteContent\"]\n\n        if \"row\" in content_obj:\n            result_object[\"row_content\"] = content_obj[\"row\"]\n\n        return result_object\n\n    def _run(self, query: str) -> str:\n        try:\n            import boto3\n            from botocore.exceptions import ClientError\n        except ImportError as e:\n            raise ImportError(\n                \"`boto3` package not found, please run `uv add boto3`\"\n            ) from e\n\n        try:\n            # Initialize the Bedrock Agent Runtime client\n            bedrock_agent_runtime = boto3.client(\n                \"bedrock-agent-runtime\",\n                region_name=os.getenv(\n                    \"AWS_REGION\", os.getenv(\"AWS_DEFAULT_REGION\", \"us-east-1\")\n                ),\n                # AWS SDK will automatically use AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY from environment\n            )\n\n            retrieve_params = {\n                \"knowledgeBaseId\": self.knowledge_base_id,\n                \"retrievalQuery\": {\"text\": query},\n            }\n","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-tools/src/crewai_tools/aws/bedrock/knowledge_base/retriever_tool.py#L170-L206","documentation":"Raised inside BedrockKnowledgeBaseRetrievalTool._run() when the deferred `import boto3` (and botocore) fails, meaning the AWS SDK is not installed in the current environment. crewai-tools does not hard-depend on boto3; the Bedrock knowledge base tool imports it lazily and converts the ImportError into an actionable message including the uv add command.","triggerScenarios":"Calling the tool without boto3 installed: pip install crewai-tools alone, or a fresh uv venv missing the optional AWS extras; also a broken boto3 install where botocore is missing.","commonSituations":"Using the Bedrock tool for the first time after installing only crewai-tools; deploying to a slim Docker image without AWS dependencies; environment where boto3 was installed for a different Python interpreter.","solutions":["Run `uv add boto3` (or `pip install boto3`) in the same environment/venv the tool runs in","For pip users: pip install crewai-tools[boto3] or just pip install boto3","Verify with `python -c \"import boto3\"` using the same interpreter","If it still fails, check for a mismatched virtualenv or PYTHONPATH shadowing"],"exampleFix":"# before: ImportError at tool run\n# after (shell):\n# uv add boto3\n# python -c \"import boto3; print(boto3.__version__)\"","handlingStrategy":"validation","validationCode":"try:\n    import boto3  # noqa: F401\n    from botocore.exceptions import ClientError  # noqa: F401\nexcept ImportError:\n    raise SystemExit('boto3 required for Bedrock KB tool: uv add boto3')","typeGuard":null,"tryCatchPattern":"try:\n    out = tool._run(q)\nexcept ImportError as e:\n    if 'boto3' in str(e):\n        raise SystemExit('install boto3: uv add boto3') from e\n    raise","preventionTips":["Declare boto3 in project dependencies upfront when using AWS tools","Fail fast at startup with an import smoke test in entrypoints","Keep a single lockfile (uv.lock) so deploys include optional AWS deps"],"tags":["aws","boto3","dependency","import-error"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}