I'm using h5py to create hdf5 files in python, and I'd like to use blosc as a compression filter. I first installed c-blosc from source via:
wget https://github.com/Blosc/c-blosc/archive/v1.9.1.tar.gz
tar -xvf c-blosc-v1.9.1.tar.gz
cd c-blosc-v1.9.1
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr/local ..
cmake --build .
cmake --build . --target install
(note I use homebrew otherwise, so my /usr/local is writable without sudo)
I then installed hdf5 v1.10.0 from source via:
wget http://www.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.0/src/hdf5-1.10.0.tar.gz
tar -xvf hdf5-1.10.0.tar.gz
cd hdf5-1.10.0
./configure --enable-static=yes --enable-shared=yes --prefix=/usr/local/hdf5
make && make install
Finally I install h5py v2.6.0 from source via:
wget https://github.com/h5py/h5py/archive/2.6.0.tar.gz
tar -xvf h5py-2.6.0.tar.gz
cd h5py-2.6.0
python setup.py install
python setup.py install
However, when I fire up a python interpreter and run:
import h5py
f = h5py.File('myFile.hdf5','w')
dset = f.create_dataset("myData", (100, 100), compression=32001)
#32001 is blosc, see: https://www.hdfgroup.org/services/filters.html
I get the error "ValueError: Unknown compression filter number: 32001". What have I missed in my installation stream?
I found that the easiest way to get this working is to install pytables and load that at the outset of your python script. You don't need to use pytables at all afterwards, but loading it clearly calls something that registers the blosc filter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With