Install & Compatibility
Where this runs
tested against v0.3.3 · 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.95 runs
installs and imports cleanly · install 0.0s · import 0.014s · 34.7MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 1.7s · import 0.014s · 35MB
33MB installed
● package 33MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
subprocess
✓ import subprocess
The `s5cmd` package primarily installs the `s5cmd` command-line executable. Interaction from Python is typically done by invoking this executable using the `subprocess` module.
This quickstart demonstrates how to check for `s5cmd` and execute basic S3 operations (list, upload, download) using Python's `subprocess` module. It assumes `s5cmd` is correctly installed via `pip install s5cmd` and that AWS credentials are configured in the environment or standard locations for `s5cmd` to access S3.
import subprocess
import os
# Ensure AWS credentials are configured (e.g., via environment variables or ~/.aws/credentials)
# For example, using environment variables for demonstration:
# os.environ['AWS_ACCESS_KEY_ID'] = os.environ.get('AWS_ACCESS_KEY_ID', 'YOUR_AWS_ACCESS_KEY_ID')
# os.environ['AWS_SECRET_ACCESS_KEY'] = os.environ.get('AWS_SECRET_ACCESS_KEY', 'YOUR_AWS_SECRET_ACCESS_KEY')
# os.environ['AWS_REGION'] = os.environ.get('AWS_REGION', 'us-east-1')
try:
# Verify s5cmd is installed and accessible in PATH
version_output = subprocess.run(['s5cmd', 'version'], capture_output=True, text=True, check=True)
print(f"s5cmd version:\n{version_output.stdout}")
# Example: List objects in an S3 bucket (replace with a real bucket)
bucket_name = "your-test-s5cmd-bucket"
list_command = ['s5cmd', 'ls', f's3://{bucket_name}/']
list_result = subprocess.run(list_command, capture_output=True, text=True, check=True)
print(f"\nListing objects in s3://{bucket_name}/:\n{list_result.stdout}")
# Example: Create a dummy local file and upload it
local_file_name = "hello_s5cmd.txt"
with open(local_file_name, "w") as f:
f.write("Hello from s5cmd Python distribution!")
upload_command = ['s5cmd', 'cp', local_file_name, f's3://{bucket_name}/{local_file_name}']
upload_result = subprocess.run(upload_command, capture_output=True, text=True, check=True)
print(f"\nUploaded {local_file_name}:\n{upload_result.stdout}")
# Example: Download the file back
download_command = ['s5cmd', 'cp', f's3://{bucket_name}/{local_file_name}', f'./downloaded_{local_file_name}']
download_result = subprocess.run(download_command, capture_output=True, text=True, check=True)
print(f"\nDownloaded 'downloaded_{local_file_name}':\n{download_result.stdout}")
# Clean up local files
os.remove(local_file_name)
os.remove(f'./downloaded_{local_file_name}')
# Note: For production, consider robust error handling and command construction.
# Ensure the bucket 'your-test-s5cmd-bucket' exists and credentials have write access.
except FileNotFoundError:
print("Error: 's5cmd' command not found. Ensure it's installed and in your system's PATH.")
except subprocess.CalledProcessError as e:
print(f"Error executing s5cmd command: {e}")
print(f"Stdout: {e.stdout}")
print(f"Stderr: {e.stderr}")
except Exception as e:
print(f"An unexpected error occurred: {e}")
s5cmd --version
Errors
Common errors & fixes
FileNotFoundError: [Errno 2] No such file or directory: 's5cmd'
The Python `subprocess` module cannot find the `s5cmd` executable in the system's PATH.
fixEnsure the `s5cmd` Python package is installed (`pip install s5cmd`) and use `s5cmd.get_s5cmd_path()` to reliably locate the executable path for `subprocess.run()`.
s5cmd: command not found
The `s5cmd` executable is not in your shell's PATH environment variable, even after installing the `s5cmd` Python package.
fixReinstall `s5cmd` using `pip install s5cmd` in your active Python environment and ensure that the directory where pip installs binaries (e.g., `~/.local/bin` or your virtual environment's `bin` folder) is included in your system's PATH and your shell session is reloaded.
ERROR Access Denied.
The AWS credentials configured for `s5cmd` (via environment variables, shared credentials file, or IAM roles) lack the necessary S3 permissions for the requested operation.
fixReview your AWS IAM policies and ensure the user or role associated with your `s5cmd` credentials has the required S3 permissions (e.g., `s3:GetObject`, `s3:PutObject`, `s3:ListBucket`) for the target resources.
Error parsing config file: open ~/.s5cmd.yaml: no such file or directory
`s5cmd` could not locate or correctly parse its configuration file, typically `~/.s5cmd.yaml`, or a custom path specified by the user.
fixEnsure the `s5cmd` configuration file exists at the expected path and is correctly formatted in YAML. If using a custom config file, specify its path explicitly using the `--config-file` argument.
Upgrade
Version history
0.3.3latest on PyPI · released Sep 9, 2025
Audit
Dependencies
No dependency data recorded yet.