ImportError: No module named botocore.session

I arrived here from Google. I was getting a similar error while updating AWS Lambda function code. The answer posted here helped in my case. Simply upgrade AWS CLI. Hope this helps someone drifting here from search engines.

pip install awscli --force-reinstall --upgrade

import boto3 alone is enough to connect with a bucket. botocore.session was used during for the previous boto 1.8 and is not accepted by boto3. you can refer the following boto3 documents http://boto3.readthedocs.io/en/latest/reference/services/s3.html#client . Here is boto 1.8 documents that mentions the use of botocore.session http://botocore.readthedocs.io/en/latest/tutorial/


I was on version boto3-1.5.33 and botocore-1.8.47 and upgrading to boto3-1.9.75 and botocore-1.12.75 solved the issue for me.

pip install boto3 --upgrade