scanpy: KeyError: 'dict' … Above error raised while reading key '/layers' of type

I’m using scanpy 1.8.2, anndata 0.8.0 and h5py 3.1.0

I got this error while reading an h5ad file:

adata=sc.read_h5ad('XXXX.h5ad')
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
/opt/conda/lib/python3.8/site-packages/anndata/_io/utils.py in func_wrapper(elem, *args, **kwargs)
    155     if zarr and isinstance(elem, (zarr.Group, zarr.Array)):
--> 156         parent = elem.store  # Not sure how to always get a name out of this
    157     elif isinstance(elem, SparseDataset):

/opt/conda/lib/python3.8/site-packages/anndata/_io/h5ad.py in read_group(group)

/opt/conda/lib/python3.8/enum.py in __getitem__(cls, name)
    386     def __getitem__(cls, name):
--> 387         return cls._member_map_[name]
    388 

KeyError: 'dict'

During handling of the above exception, another exception occurred:

AnnDataReadError                          Traceback (most recent call last)
<ipython-input-15-a2632df74a34> in <module>
----> 1 adata=sc.read_h5ad('XXXX.h5ad')

/opt/conda/lib/python3.8/site-packages/anndata/_io/h5ad.py in read_h5ad(filename, backed, as_sparse, as_sparse_fmt, chunk_size)

/opt/conda/lib/python3.8/functools.py in wrapper(*args, **kw)
    873                             '1 positional argument')
    874 
--> 875         return dispatch(args[0].__class__)(*args, **kw)
    876 
    877     funcname = getattr(func, '__name__', 'singledispatch function')

/opt/conda/lib/python3.8/site-packages/anndata/_io/utils.py in func_wrapper(elem, *args, **kwargs)
    160         parent = elem.file.name
    161     return parent
--> 162 
    163 
    164 def report_read_key_on_error(func):

AnnDataReadError: Above error raised while reading key '/layers' of type <class 'h5py._hl.group.Group'> from /.

Any ideas?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 17 (4 by maintainers)

Most upvoted comments

I was having the same problem. conda update anndata solved my problem.

updaing anndata from 0.7.6 to anndata 0.8 solved it for me