anndata 0.10.9 introduces a problem where Index can no longer be imported from anndata._core.index because they wrap the import statement with if typing.TYPE_CHECKING
The problem manifests as an ImportError when running the CLI:
Traceback (most recent call last):
File "/opt/conda/envs/cellarium/bin/cellarium-ml", line 5, in <module>
from cellarium.ml.cli import main
File "/home/jupyter/cellarium-ml/cellarium/ml/__init__.py", line 4, in <module>
from cellarium.ml.core import CellariumAnnDataDataModule, CellariumModule, CellariumPipeline
File "/home/jupyter/cellarium-ml/cellarium/ml/core/__init__.py", line 4, in <module>
from cellarium.ml.core.datamodule import CellariumAnnDataDataModule
File "/home/jupyter/cellarium-ml/cellarium/ml/core/datamodule.py", line 11, in <module>
from cellarium.ml.data import DistributedAnnDataCollection, IterableDistributedAnnDataCollectionDataset
File "/home/jupyter/cellarium-ml/cellarium/ml/data/__init__.py", line 4, in <module>
from cellarium.ml.data.dadc_dataset import IterableDistributedAnnDataCollectionDataset
File "/home/jupyter/cellarium-ml/cellarium/ml/data/dadc_dataset.py", line 14, in <module>
from cellarium.ml.data.distributed_anndata import DistributedAnnDataCollection
File "/home/jupyter/cellarium-ml/cellarium/ml/data/distributed_anndata.py", line 11, in <module>
from anndata._core.index import Index, Index1D, _normalize_indices
ImportError: cannot import name 'Index' from 'anndata._core.index'
anndata 0.10.9 introduces a problem where
Index
can no longer be imported fromanndata._core.index
because they wrap the import statement withif typing.TYPE_CHECKING
anndata 0.10.8 https://github.com/scverse/anndata/blob/085e1e5695713510e74b443efdafc43a5fc61c34/src/anndata/_core/index.py#L13
anndata 0.10.9 https://github.com/scverse/anndata/blob/f48f5154a552d64d560c34388e8b2953bc0df047/src/anndata/_core/index.py#L15-L16
The problem manifests as an
ImportError
when running the CLI: