hdmf-zarr
raw JSON → 0.12.0 verified Fri May 01 auth: no python
A package defining a Zarr I/O backend for HDMF (Hierarchical Data Modeling Framework). Version 0.12.0 supports Python >=3.9 and provides Zarr-based reading/writing of HDMF files, including NWB (Neurodata Without Borders) files. Release cadence is irregular, with several minor releases per year.
pip install hdmf-zarr Common errors
error ModuleNotFoundError: No module named 'hdmf_zarr' ↓
cause Missing installation of hdmf-zarr. Often occurs when using pynwb without explicit hdmf-zarr install.
fix
Run
pip install hdmf-zarr or include it in your requirements. error ImportError: cannot import name 'ZarrIO' from 'hdmf_zarr' ↓
cause Incorrect import path or outdated version. HDMF-Zarr may not be installed correctly.
fix
Verify installation:
pip show hdmf-zarr. Correct import: from hdmf_zarr import ZarrIO. error TypeError: '_io.BufferedWriter' object has no attribute 'name' ↓
cause Using an uninitialized file-like object instead of a path string. ZarrIO expects a path, not a file handle.
fix
Pass a string path (e.g., 'output.zarr') instead of an open file object.
Warnings
breaking In version 0.10.0, the export functionality was refactored, breaking existing exported files by changing the default file source. Files exported with earlier versions may be invalid. ↓
fix Re-export files using hdmf-zarr >=0.10.0 or keep older files only for reading.
gotcha The `ZarrIO.file` property was renamed to `ZarrIO._file` in version 0.12.0. Direct access to the underlying Zarr group is now private. ↓
fix Use `ZarrIO._file` instead of `ZarrIO.file` for direct Zarr group access, or rely on public methods like `read()`.
deprecated `NestedDirectoryStore` is deprecated in Zarr and may be removed. hdmf-zarr >=0.8.0 added a warning for its usage. ↓
fix Set environment variable `ZARR_DEPRECATED_NESTED_DIRECTORY_STORE` or switch to default Zarr store (e.g., `zarr.DirectoryStore`).
Imports
- ZarrIO
from hdmf_zarr import ZarrIO
Quickstart
from hdmf_zarr import ZarrIO
from hdmf.common import NWBContainer
# Create an NWBFile (requires pynwb) or a simple HDMF container
# For demonstration, assume 'container' is an HDMF object
# container = NWBContainer('test')
# Write with ZarrIO
# ZarrIO(container).export('output.zarr')
print(ZarrIO.__name__)