Using Bedrock but getting error ModuleNotFoundError: No module named 'botocore'

Hi, trying crewai for the first time on a very simple demo project. When I run the crew I get the following error:

ERROR:root:LiteLLM call failed: litellm.APIConnectionError: Missing boto3 to call bedrock. Run ‘pip install boto3’.
Traceback (most recent call last):
File “/Users/tim.hines/Development/Training/deeplearning_crewai/test_project/.venv/lib/python3.11/site-packages/litellm/llms/bedrock/chat/converse_handler.py”, line 275, in completion
from botocore.credentials import Credentials
ModuleNotFoundError: No module named ‘botocore’

I have tried doing all the suggest pip installs, pip3 installs, python installs and more. Nothing will fix this error, so help much appreciated.

I am running using Visual Studio Code terminal.

Thanks.

Hi @infaddict,

Please run this in your terminal before running your crew:

uv add boto3

For some reason when in crew ai project terminal run pip install boto3, and botocore. It show requirement already statsfied. but when checked in site packages , boto3, botocore and jmespath was missing.

Solution : from some other project try copying (boto3, botocore and jmespath) and pasting those files inside the crewai project site packages.

for me I was using llama

here is code

llm = LLM(
model_id="meta.llama3-70b-instruct-v1:0",
model="bedrock/meta.llama3-70b",
region_name=os.getenv('AWS_REGION_NAME'),
aws_access_key_id=os.getenv('AWS_ACCESS_KEY_ID'),
aws_secret_access_key=os.getenv('AWS_SECRET_ACCESS_KEY'),
model_kwargs={'max_gen_len':8191}
)

And things worked.

1 Like