Registry / data / blosc
library1.11.4pypypi✓ verified 85d ago

Blosc is a high-performance Python wrapper for the C-Blosc meta-compressor library. It's designed for compressing and decompressing numerical datasets, especially those used with NumPy, offering fast, multi-threaded operations. The current version is 1.11.4, and it maintains a regular release cadence, primarily updating its vendored C-Blosc library and supporting newer Python versions.

pip install blosc
INSTALL
IMPORT
SIG · BLOSC
B
blosc
datapythonv1.11.4
Install
1.6s avg
Import
157ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.11.4 · 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
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.164s · 19MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.6s · import 0.150s · 20MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

blosc
import blosc
compress
from blosc import compress, decompress
decompress
from blosc import compress, decompress

Compress and decompress a bytes object. For optimal compression of structured data (e.g., NumPy arrays), ensure `typesize` is set to the item size (e.g., `array.itemsize`).

import blosc data_bytes = b"This is a test string that will be compressed by blosc." * 10 # Compress data # For byte strings, typesize=1 is appropriate. # For NumPy arrays, use typesize=array.itemsize compressed_data = blosc.compress(data_bytes, typesize=1) print(f"Original size: {len(data_bytes)} bytes") print(f"Compressed size: {len(compressed_data)} bytes") # Decompress data decompressed_data = blosc.decompress(compressed_data) # Verify assert data_bytes == decompressed_data print("Decompression successful!")
Debug
Known issues
breakingPython 3.7 support was dropped in `blosc` 1.11.0, and Python 3.8 support was dropped in 1.11.2.
fix
Upgrade your Python environment to 3.9 or higher. For projects requiring Python 3.7/3.8, pin `blosc<1.11.0` or `blosc<1.11.2` respectively.
affects: <1.11.0 (for Python 3.7), <1.11.2 (for Python 3.8)
gotchaWhen compressing structured data like NumPy arrays, setting the `typesize` parameter is crucial for optimal compression ratio and speed. While `typesize=0` works for generic byte streams, it should be set to `array.itemsize` for arrays.
fix
Always pass `typesize=array.itemsize` (e.g., `blosc.compress(arr, typesize=arr.itemsize)`) when compressing NumPy arrays or similar structured data.
affects: All versions
gotcha`blosc.decompress()` returns a `bytes` object. When decompressing data that originated from a NumPy array, you must convert this `bytes` object back to a NumPy array manually using `numpy.frombuffer()` with the correct `dtype`.
fix
After `decompressed_bytes = blosc.decompress(compressed_data)`, convert using `np.frombuffer(decompressed_bytes, dtype=original_array_dtype)`.
affects: All versions
deprecatedVersion 1.11.4 included fixes for deprecated NumPy usage. Older `blosc` versions might emit warnings or fail when used with newer NumPy versions due to reliance on deprecated NumPy APIs.
fix
Upgrade to `blosc` version 1.11.4 or newer to ensure full compatibility and avoid warnings with recent NumPy versions.
affects: <1.11.4
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'blosc.blosc_extension'
The `blosc` Python package failed to compile its C extensions during installation, often due to missing C/C++ compilers (like Microsoft Visual C++ Build Tools on Windows or `build-essential` on Linux) or other build dependencies such as `cmake` or `ninja`.
fix
Ensure you have the necessary C/C++ compilers and build tools installed for your operating system (e.g., `sudo apt-get install build-essential` on Debian/Ubuntu, or Visual Studio Build Tools on Windows). Then, uninstall and reinstall `blosc` using `pip install --no-cache-dir --force-reinstall blosc`. Alternatively, use `conda install -c conda-forge python-blosc` to install pre-compiled binaries if using Anaconda/Miniconda.
RuntimeError: error during blosc decompression: -1
This generic runtime error indicates a problem during the decompression process, which can be caused by corrupted data, insufficient memory, an invalid input buffer, or an incompatibility between the blosc version used for compression and decompression. This can sometimes be intermittent, especially in multi-threaded or HPC environments.
fix
First, verify the integrity of the compressed data. If the issue is intermittent, consider checking memory allocation and usage in your environment. Ensure that `blosc` and related libraries (like `numcodecs`, `zarr`) are updated to compatible versions, ideally by installing from `conda-forge` for consistent binaries. If using `blosc` directly, ensure the input `src` buffer for `decompress` is valid and the `dst` buffer (if provided) has sufficient capacity.
Error: Blosc library does not have support for the 'snappy' compressor, but only for: blosclz,lz4,lz4hc,zlib,zstd
This error occurs when attempting to decompress data that was compressed using the Snappy codec, but the installed `blosc` library was compiled without Snappy support. Snappy is a C++ codec, and its compilation can sometimes be problematic with `gcc` compilers, leading to it being disabled by default in some builds.
fix
To enable Snappy support, you may need to rebuild `blosc` from source with explicit Snappy inclusion or use a pre-compiled version that includes it. For `pip` installations, ensure you have a C++ compiler. If building manually with `setuptools`, check environment variables like `INCLUDE_SNAPPY`. For `conda` users, `conda install -c conda-forge python-blosc` often provides builds with broader codec support. If working with `h5py` or `PyTables`, consider installing `hdf5plugin` from `conda-forge` as it may provide the necessary Blosc with Snappy.
Upgrade
Version history
1.11.4latest on PyPI · released Jan 17, 2026
Audit
Dependencies
numpyoptionalRecommended for efficient compression/decompression of numerical arrays, though not strictly required for basic bytes operations.
Agent activity
24 hits · last 30 days
node
20
OpenAI (training)
1
Resources
blosc — pip install blosc · libregistry