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:

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[images]"          # b2view + JPEG/PNG file previews
pip install "blosc2[hires]"           # b2view + its high-res view (h key)
pip install "blosc2[parquet]"         # the Parquet converter
pip install "blosc2[fsspec]"          # fsspec URLs, including HTTP(S)
pip install "blosc2[fsspec]" s3fs     # fsspec URLs, plus the S3 driver
pip install "blosc2[zarr,fsspec]" s3fs # remote Zarr arrays on S3
pip install "blosc2[hdf5,fsspec]" s3fs # remote HDF5 datasets on S3
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, localizes the whole container with lazy=False, cache_dir=..., or fetches only the chunks and blocks a slice touches (the default for known arrays, with cache_dir= persisting them); see blosc2.open() and FsspecNDSource for what each mode supports. examples/remote/rw-fsspec.py walks through all three plus the write side, and examples/remote/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