Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Minimal code sample (that we can run without your data, using public data)
I think this is the scvi issue. But I can't find the same issue in scvi github.
import scanpy as sc
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import cell2location
from matplotlib import rcParams
rcParams['pdf.fonttype'] = 42
/home/dengzhen/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/anndata/utils.py:429: FutureWarning: Importing read_csv from `anndata` is deprecated. Import anndata.io.read_csv instead.
warnings.warn(msg, FutureWarning)
/home/dengzhen/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/anndata/utils.py:429: FutureWarning: Importing read_excel from `anndata` is deprecated. Import anndata.io.read_excel instead.
warnings.warn(msg, FutureWarning)
/home/dengzhen/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/anndata/utils.py:429: FutureWarning: Importing read_hdf from `anndata` is deprecated. Import anndata.io.read_hdf instead.
warnings.warn(msg, FutureWarning)
/home/dengzhen/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/anndata/utils.py:429: FutureWarning: Importing read_loom from `anndata` is deprecated. Import anndata.io.read_loom instead.
warnings.warn(msg, FutureWarning)
/home/dengzhen/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/anndata/utils.py:429: FutureWarning: Importing read_mtx from `anndata` is deprecated. Import anndata.io.read_mtx instead.
warnings.warn(msg, FutureWarning)
/home/dengzhen/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/anndata/utils.py:429: FutureWarning: Importing read_text from `anndata` is deprecated. Import anndata.io.read_text instead.
warnings.warn(msg, FutureWarning)
/home/dengzhen/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/anndata/utils.py:429: FutureWarning: Importing read_umi_tools from `anndata` is deprecated. Import anndata.io.read_umi_tools instead.
warnings.warn(msg, FutureWarning)
/home/dengzhen/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/anndata/utils.py:429: FutureWarning: Importing read_csv from `anndata` is deprecated. Import anndata.io.read_csv instead.
warnings.warn(msg, FutureWarning)
/home/dengzhen/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/anndata/utils.py:429: FutureWarning: Importing read_loom from `anndata` is deprecated. Import anndata.io.read_loom instead.
warnings.warn(msg, FutureWarning)
/home/dengzhen/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/anndata/utils.py:429: FutureWarning: Importing read_text from `anndata` is deprecated. Import anndata.io.read_text instead.
warnings.warn(msg, FutureWarning)
/home/dengzhen/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/anndata/utils.py:429: FutureWarning: Importing CSCDataset from `anndata.experimental` is deprecated. Import anndata.abc.CSCDataset instead.
warnings.warn(msg, FutureWarning)
/home/dengzhen/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/anndata/utils.py:429: FutureWarning: Importing CSRDataset from `anndata.experimental` is deprecated. Import anndata.abc.CSRDataset instead.
warnings.warn(msg, FutureWarning)
/home/dengzhen/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/anndata/utils.py:429: FutureWarning: Importing read_elem from `anndata.experimental` is deprecated. Import anndata.io.read_elem instead.
warnings.warn(msg, FutureWarning)
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Cell In[1], line 7
4 import matplotlib as mpl
5 #import pandas as pd
6 #import anndata as ad
----> 7 import cell2location
9 from matplotlib import rcParams
10 rcParams['pdf.fonttype'] = 42 # enables correct plotting of text for PDFs
File [~/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/cell2location/__init__.py:9](http://192.168.2.10:8001/user/dengzhen/lab/tree/code_old/newcode/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/cell2location/__init__.py#line=8)
6 from rich.logging import RichHandler
7 from torch.distributions import biject_to, transform_to
----> 9 from . import models
10 from .cell_comm.around_target import compute_weighted_average_around_target
11 from .run_colocation import run_colocation
File [~/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/cell2location/models/__init__.py:1](http://192.168.2.10:8001/user/dengzhen/lab/tree/code_old/newcode/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/cell2location/models/__init__.py#line=0)
----> 1 from ._cell2location_model import Cell2location
2 from ._cell2location_module import (
3 LocationModelLinearDependentWMultiExperimentLocationBackgroundNormLevelGeneAlphaPyroModel,
4 )
5 from ._cell2location_WTA_model import Cell2location_WTA
File [~/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/cell2location/models/_cell2location_model.py:12](http://192.168.2.10:8001/user/dengzhen/lab/tree/code_old/newcode/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/cell2location/models/_cell2location_model.py#line=11)
10 from pyro.infer import Trace_ELBO, TraceEnum_ELBO
11 from pyro.nn import PyroModule
---> 12 from scvi import REGISTRY_KEYS
13 from scvi.data import AnnDataManager
14 from scvi.data.fields import (
15 CategoricalJointObsField,
16 CategoricalObsField,
(...)
19 NumericalObsField,
20 )
File [~/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/scvi/__init__.py:11](http://192.168.2.10:8001/user/dengzhen/lab/tree/code_old/newcode/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/scvi/__init__.py#line=10)
8 from ._settings import settings
10 # this import needs to come after prior imports to prevent circular import
---> 11 from . import data, model, external, utils
13 from importlib.metadata import version
15 package_name = "scvi-tools"
File [~/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/scvi/external/__init__.py:4](http://192.168.2.10:8001/user/dengzhen/lab/tree/code_old/newcode/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/scvi/external/__init__.py#line=3)
2 from .contrastivevi import ContrastiveVI
3 from .gimvi import GIMVI
----> 4 from .mrvi import MRVI
5 from .poissonvi import POISSONVI
6 from .scar import SCAR
File [~/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/scvi/external/mrvi/__init__.py:1](http://192.168.2.10:8001/user/dengzhen/lab/tree/code_old/newcode/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/scvi/external/mrvi/__init__.py#line=0)
----> 1 from ._model import MRVI
2 from ._module import MRVAE
4 __all__ = ["MRVI", "MRVAE"]
File [~/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/scvi/external/mrvi/_model.py:10](http://192.168.2.10:8001/user/dengzhen/lab/tree/code_old/newcode/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/scvi/external/mrvi/_model.py#line=9)
8 import jax.numpy as jnp
9 import numpy as np
---> 10 import xarray as xr
11 from tqdm import tqdm
13 from scvi import REGISTRY_KEYS
File [~/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/xarray/__init__.py:3](http://192.168.2.10:8001/user/dengzhen/lab/tree/code_old/newcode/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/xarray/__init__.py#line=2)
1 from importlib.metadata import version as _version
----> 3 from xarray import groupers, testing, tutorial
4 from xarray.backends.api import (
5 load_dataarray,
6 load_dataset,
(...)
12 save_mfdataset,
13 )
14 from xarray.backends.zarr import open_zarr
File [~/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/xarray/groupers.py:17](http://192.168.2.10:8001/user/dengzhen/lab/tree/code_old/newcode/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/xarray/groupers.py#line=16)
14 import numpy as np
15 import pandas as pd
---> 17 from xarray.coding.cftime_offsets import BaseCFTimeOffset, _new_to_legacy_freq
18 from xarray.core import duck_array_ops
19 from xarray.core.coordinates import Coordinates, _coordinates_from_variable
File [~/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/xarray/coding/cftime_offsets.py:56](http://192.168.2.10:8001/user/dengzhen/lab/tree/code_old/newcode/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/xarray/coding/cftime_offsets.py#line=55)
53 import pandas as pd
54 from packaging.version import Version
---> 56 from xarray.coding.cftimeindex import CFTimeIndex, _parse_iso8601_with_reso
57 from xarray.coding.times import (
58 _is_standard_calendar,
59 _should_cftime_be_used,
60 convert_time_or_go_back,
61 format_cftime_datetime,
62 )
63 from xarray.core.common import _contains_datetime_like_objects, is_np_datetime_like
File [~/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/xarray/coding/cftimeindex.py:54](http://192.168.2.10:8001/user/dengzhen/lab/tree/code_old/newcode/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/xarray/coding/cftimeindex.py#line=53)
51 import pandas as pd
52 from packaging.version import Version
---> 54 from xarray.coding.times import (
55 _STANDARD_CALENDARS,
56 cftime_to_nptime,
57 infer_calendar_name,
58 )
59 from xarray.core.common import _contains_cftime_datetimes
60 from xarray.core.options import OPTIONS
File [~/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/xarray/coding/times.py:14](http://192.168.2.10:8001/user/dengzhen/lab/tree/code_old/newcode/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/xarray/coding/times.py#line=13)
11 import pandas as pd
12 from pandas.errors import OutOfBoundsDatetime, OutOfBoundsTimedelta
---> 14 from xarray.coding.variables import (
15 SerializationWarning,
16 VariableCoder,
17 lazy_elemwise_func,
18 pop_to,
19 safe_setitem,
20 unpack_for_decoding,
21 unpack_for_encoding,
22 )
23 from xarray.core import indexing
24 from xarray.core.common import contains_cftime_datetimes, is_np_datetime_like
File [~/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/xarray/coding/variables.py:13](http://192.168.2.10:8001/user/dengzhen/lab/tree/code_old/newcode/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/xarray/coding/variables.py#line=12)
10 import numpy as np
11 import pandas as pd
---> 13 from xarray.core import dtypes, duck_array_ops, indexing
14 from xarray.core.variable import Variable
15 from xarray.namedarray.parallelcompat import get_chunked_array_type
File [~/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/xarray/core/duck_array_ops.py:37](http://192.168.2.10:8001/user/dengzhen/lab/tree/code_old/newcode/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/xarray/core/duck_array_ops.py#line=36)
34 from packaging.version import Version
35 from pandas.api.types import is_extension_array_dtype
---> 37 from xarray.core import dask_array_ops, dtypes, nputils
38 from xarray.core.options import OPTIONS
39 from xarray.core.utils import is_duck_array, is_duck_dask_array, module_available
File [~/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/xarray/core/dask_array_ops.py:3](http://192.168.2.10:8001/user/dengzhen/lab/tree/code_old/newcode/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/xarray/core/dask_array_ops.py#line=2)
1 from __future__ import annotations
----> 3 from xarray.core import dtypes, nputils
6 def dask_rolling_wrapper(moving_func, a, window, min_count=None, axis=-1):
7 """Wrapper to apply bottleneck moving window funcs on dask arrays"""
File [~/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/xarray/core/nputils.py:15](http://192.168.2.10:8001/user/dengzhen/lab/tree/code_old/newcode/miniconda3/envs/cell2loc_env/lib/python3.10/site-packages/xarray/core/nputils.py#line=14)
13 # remove once numpy 2.0 is the oldest supported version
14 if module_available("numpy", minversion="2.0.0.dev0"):
---> 15 from numpy.lib.array_utils import ( # type: ignore[import-not-found,unused-ignore]
16 normalize_axis_index,
17 )
18 else:
19 from numpy.core.multiarray import ( # type: ignore[attr-defined,no-redef,unused-ignore]
20 normalize_axis_index,
21 )
ModuleNotFoundError: No module named 'numpy.lib.array_utils'
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Minimal code sample (that we can run without your data, using public data)
I think this is the scvi issue. But I can't find the same issue in scvi github.
import numpy as np np.version '1.26.4'
Get the same error when import scvi