Install & Compatibility
Where this runs
tested against v1.43.80 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.960 runs
installs and imports cleanly · install 0.0s · import 0.947s · 63.1MB
glibcpy 3.10–3.960 runs
installs and imports cleanly · install 4.0s · import 0.842s · 64MB
62MB installed
● package 62MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
boto3.client (low-level)
✓ import boto3
# Explicit credentials (not recommended for production)
client = boto3.client(
's3',
region_name='us-east-1',
aws_access_key_id='KEY',
aws_secret_access_key='SECRET'
)
# Preferred: let credential chain resolve
client = boto3.client('s3', region_name='us-east-1')
✗ import boto3
client = boto3.client('s3')
Omitting region_name raises NoRegionError for most services unless AWS_DEFAULT_REGION is set.
boto3.Session (multi-profile)
✓ import boto3
session = boto3.Session(
profile_name='my-profile',
region_name='eu-west-1'
)
client = session.client('dynamodb')
✗ boto3.setup_default_session(profile_name='my-profile')
setup_default_session() modifies global state — unsafe in multi-threaded apps. Use Session() instead.
Credential chain order: (1) explicit in code, (2) env vars AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY, (3) ~/.aws/credentials, (4) ~/.aws/config, (5) EC2/ECS instance metadata.
import boto3
from botocore.exceptions import ClientError, NoCredentialsError
# Credential chain: env vars → ~/.aws/credentials → IAM role → ...
# Set AWS_DEFAULT_REGION or pass region_name explicitly
client = boto3.client('s3', region_name='us-east-1')
try:
# List buckets
response = client.list_buckets()
for bucket in response['Buckets']:
print(bucket['Name'])
except NoCredentialsError:
print('No AWS credentials found')
except ClientError as e:
print(f"Error: {e.response['Error']['Code']}: {e.response['Error']['Message']}")
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'boto3'
The boto3 library is not installed in the Python environment where the code is being executed, or the active Python interpreter does not have access to it.
fixInstall boto3 using pip: `pip install boto3` (or `python -m pip install boto3` to ensure it's installed for the correct Python interpreter).
botocore.exceptions.NoCredentialsError: Unable to locate credentials
boto3 cannot find the necessary AWS credentials to authenticate requests to AWS services. This occurs when credentials are not configured via environment variables, the AWS credentials file (~/.aws/credentials), or IAM roles.
fixConfigure your AWS credentials using the AWS CLI (`aws configure`), by setting `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables, or by ensuring the application runs on an EC2 instance with an appropriate IAM role.
botocore.exceptions.ParamValidationError: Parameter validation failed: Invalid type for parameter ...
A parameter passed to a boto3 client method does not meet the expected type, format, or value required by the AWS service API.
fixReview the boto3 documentation for the specific service and operation to ensure all parameters are of the correct data type, format, and within valid ranges. Upgrade boto3 if using an older version that might not support newer parameters.
AttributeError: 'S3' object has no attribute 'Bucket'
This error typically occurs when attempting to use high-level resource-style methods (like `.Bucket()`) on a low-level client object (created with `boto3.client('s3')`) instead of a high-level resource object (created with `boto3.resource('s3')`).
fixInstantiate an S3 resource object using `s3 = boto3.resource('s3')` to access high-level abstractions like `s3.Bucket('your-bucket-name').objects.all()`. If low-level API calls are needed, use `s3_client = boto3.client('s3')` and call methods like `s3_client.list_buckets()`. botocore.exceptions.NoRegionError: You must specify a region.
Boto3 requires an AWS region to be specified but could not find one through environment variables, configuration files, or direct parameter.
fixclient = boto3.client('s3', region_name='us-east-1')
# Or export AWS_REGION=us-east-1 Upgrade
Version history
1.43.80latest on PyPI · released Aug 25, 2026
Audit
Dependencies
botocorerequiredCore HTTP client, credential management, and service definitions. Installed automatically. boto3 and botocore versions must stay in sync — pinning one without the other causes ImportError.
s3transferrequiredMultipart S3 transfers. Installed automatically.