Installation¶
You can install binary Python-Blosc2 wheels from PyPI with pip, from conda-forge with conda, or build from a clone of the GitHub repository.
Pip¶
pip install blosc2 --upgrade
Conda¶
conda install -c conda-forge python-blosc2
Optional features (extras)¶
The base install includes everything needed for compression and the array
machinery. Heavier, feature-specific dependencies are kept out of it and
grouped into extras that you opt into with the blosc2[extra] syntax:
Extra |
Adds |
|---|---|
|
The b2view terminal browser ( |
|
The high-resolution image view in b2view (the |
|
The |
|
Reading and writing single-file containers through any fsspec URL. The driver for each
protocol is a separate install ( |
Install one or more extras by listing them in brackets (quote the
argument in shells like zsh that treat brackets specially):
pip install "blosc2[tui]" # the b2view terminal browser
pip install "blosc2[hires]" # b2view + its high-res view (h key)
pip install "blosc2[parquet]" # the Parquet converter
pip install "blosc2[fsspec]" s3fs # fsspec URLs, plus the S3 driver
pip install "blosc2[tui,parquet]" # several at once
With the fsspec extra, blosc2.open() accepts any fsspec URL, chained
ones included, and reads it whole, through a local cache (cache_storage=), or
by fetching only the chunks and blocks a slice touches (lazy=True); see
blosc2.open() and FsspecNDSource for what each mode supports.
examples/ndarray/rw-fsspec.py walks through all three plus the write side,
and examples/ndarray/concurrent-fsspec.py shows what overlapping the
fetches buys; both run with no network or credentials.
Source code¶
git clone https://github.com/Blosc/python-blosc2/
cd python-blosc2
pip install . --group test # install with test dependencies
(the --group flag needs pip >= 25.1). That’s all. You can proceed
with the testing section now.
Testing¶
After installing, you can quickly check that the package is sane by running the tests:
pytest # add -v for verbose mode
Benchmarking¶
If curious, you may want to run a small benchmark that compares a plain NumPy array copy against compression through different compressors in your Blosc build:
PYTHONPATH=. python bench/pack_compress.py