IORegistryError: No method registered for writing <class ‘jaxlib.xla_extension.ArrayImpl’> into <class ‘h5py._hl.group.Group’> Error raised while writing key ‘matrix’ of <class ‘h5py._hl.group.Group’> to /obsm
This blog is for recording how I fix this error.
Background
When I computed a matrix by using Moscot, I saved this matrix in Anndata like this:
Anndata.obsm[“matrix”] = Matrix
Error
Then when I tried to save it like this:
Anndata.write(“example.h5ad”)
Then I got this error:
IORegistryError: No method registered for writing <class 'jaxlib.xla_extension.ArrayImpl'> into <class 'h5py._hl.group.Group'> Error raised while writing key 'matrix' of <class 'h5py._hl.group.Group'> to /obsm
How to fix it
My way is easy, just modify the type of the matrix from “jaxlib.xla_extension.ArrayImpl” to “numpy.array” like this:
matrix = numpy.array(matrix)