Install & Compatibility
Where this runs
tested against v4.7.1 · 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.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 35.2MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 3.6s · import 0.000s · 36MB
34MB installed
● package 34MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
b2
✓ This package is a CLI tool and not intended for direct programmatic import.
✗ import b2
For programmatic access to Backblaze B2 via Python, use the `b2sdk` library instead (e.g., `from b2sdk.v3 import B2Api`). The `b2` package itself is the command-line interface.
First, install the `b2` CLI. Then, authorize your account using your Backblaze B2 Application Key ID and Application Key (which can be obtained from your B2 console). You can pass these as environment variables or directly. After authorization, you can list your buckets and upload files. Replace `$B2_ACCOUNT_ID`, `$B2_APPLICATION_KEY`, `my-bucket-name`, `local-file.txt`, and `remote-file-name.txt` with your actual values.
pip install b2
b2 authorize-account $B2_ACCOUNT_ID $B2_APPLICATION_KEY
b2 bucket list
b2 upload-file my-bucket-name local-file.txt remote-file-name.txt
b2 --version
Debug
Known issues
breakingSupport for Python 3.8 was officially dropped starting with `b2` version 4.5.0.fixUpgrade your Python environment to 3.9 or newer. If you must use Python 3.8, pin your `b2` dependency to a version less than 4.5.0 (e.g., `pip install "b2<4.5.0"`).
affects: >=4.5.0
gotchaOn Python 3.14+, users might encounter `SystemError: <built-in function _io_q_write_impl> returned a result with an error set` due to a buffer overflow in a dependency's terminal size detection.fixUpgrade `b2` to version 4.5.0 or later (`pip install --upgrade b2`), which includes a fix for this issue.
affects: <4.5.0, on Python 3.14+
gotchaShell autocompletion features can be flaky or require re-installation after `b2` upgrades or Python version changes, especially on newer Python versions (3.12+, 3.14+).fixAfter installing or upgrading `b2`, run `b2 autocomplete install` to ensure autocompletion is properly configured for your shell. Refer to the `b2 autocomplete` documentation for specific shell instructions.
affects: <4.6.0, various Python versions
gotchaThe `b2` CLI internally migrated to `b2sdk.v3` in v4.4.0. While this primarily impacts the underlying implementation, it signifies a major internal change. Users attempting to interact with B2 programmatically via Python should directly use `b2sdk` (specifically `b2sdk.v3`), not attempt to import internal components from the `b2` CLI package.fixFor programmatic Python access, `pip install b2sdk` and use `from b2sdk.v3 import B2Api` for up-to-date functionality.
affects: >=4.4.0
Upgrade
Version history
4.7.1latest on PyPI · released Jun 8, 2026
Audit
Dependencies
b2sdkrequiredCore library for interacting with Backblaze B2 API, used internally by the CLI.