scverse / pertpy

Perturbation Analysis in the scverse ecosystem.
https://pertpy.readthedocs.io/en/latest/
MIT License
140 stars 21 forks source link

pertpy v.0.5.0 not compatible with anndata v.0.10.0 #394

Closed lucas-diedrich closed 1 year ago

lucas-diedrich commented 1 year ago

Report

Thanks for creating this fantastic package.

I installed pertpy v.0.5.0 in a new conda environment (python v.3.10.13). Importing the package resulted in an ImportError.

Minimal example:

conda create -n pertpy python=3.10
conda activate pertpy 

# Install pertpy
pip install pertpy
import pertpy

I got the following import error:

/home/anonymoususer/anaconda3/envs/pertpy/lib/python3.10/site-packages/scvi/_settings.py:63: UserWarning: Since v1.0.0, scvi-tools no longer uses a random seed by default. Run `scvi.settings.seed = 0` to reproduce results from previous versions.
/home/anonymoususer/anaconda3/envs/pertpy/lib/python3.10/site-packages/scvi/_settings.py:70: UserWarning: Setting `dl_pin_memory_gpu_training` is deprecated in v1.0 and will be removed in v1.1. Please pass in `pin_memory` to the data loaders instead.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/anonymoususer/anaconda3/envs/pertpy/lib/python3.10/site-packages/pertpy/__init__.py", line 16, in <module>
    from . import plot as pl
  File "/home/anonymoususer/anaconda3/envs/pertpy/lib/python3.10/site-packages/pertpy/plot/__init__.py", line 11, in <module>
    from pertpy.plot._scgen import JaxscgenPlot as scg  # noqa: N813
  File "/home/anonymoususer/anaconda3/envs/pertpy/lib/python3.10/site-packages/pertpy/plot/_scgen.py", line 7, in <module>
    from scvi import REGISTRY_KEYS
  File "/home/anonymoususer/anaconda3/envs/pertpy/lib/python3.10/site-packages/scvi/__init__.py", line 11, in <module>
    from . import autotune, data, model, external, utils, criticism
  File "/home/anonymoususer/anaconda3/envs/pertpy/lib/python3.10/site-packages/scvi/autotune/__init__.py", line 1, in <module>
    from ._manager import TuneAnalysis, TunerManager
  File "/home/anonymoususer/anaconda3/envs/pertpy/lib/python3.10/site-packages/scvi/autotune/_manager.py", line 23, in <module>
    from scvi.data._constants import _SETUP_ARGS_KEY, _SETUP_METHOD_NAME
  File "/home/anonymoususer/anaconda3/envs/pertpy/lib/python3.10/site-packages/scvi/data/__init__.py", line 3, in <module>
    from ._anntorchdataset import AnnTorchDataset
  File "/home/anonymoususer/anaconda3/envs/pertpy/lib/python3.10/site-packages/scvi/data/_anntorchdataset.py", line 7, in <module>
    from anndata._core.sparse_dataset import SparseDataset
ImportError: cannot import name 'SparseDataset' from 'anndata._core.sparse_dataset' (/home/anonymoususer/anaconda3/envs/pertpy/lib/python3.10/site-packages/anndata/_core/sparse_dataset.py)

Uninstalling anndata v.0.10.0 and installing anndata v.0.9.2 resolved the issue.

Cheers

Version information


pertpy 0.5.0 session_info 1.0.0

IPython 8.16.1 PIL 10.0.1 absl NA adjustText 0.8 aiohttp 3.8.5 aiosignal 1.3.1 anndata 0.10.0 annotated_types 0.5.0 anyio NA arviz 0.16.1 asttokens NA async_timeout 4.0.3 attr 23.1.0 backcall 0.2.0 backoff 2.2.1 bs4 4.12.2 certifi 2023.07.22 charset_normalizer 3.3.0 chex 0.1.7 click 8.1.7 comm 0.1.4 contextlib2 NA croniter NA cycler 0.12.0 cython_runtime NA dateutil 2.8.2 decorator 5.1.1 decoupler 1.5.0 deepdiff 6.6.0 docrep 0.3.2 etils 1.5.0 exceptiongroup 1.1.3 executing 2.0.0 fastapi 0.103.2 flax 0.7.4 frozenlist 1.4.0 fsspec 2023.9.2 h5py 3.9.0 idna 3.4 igraph 0.10.8 importlib_resources NA ipywidgets 8.1.1 jax 0.4.17 jaxlib 0.4.17 jaxopt NA jedi 0.19.1 joblib 1.3.2 kiwisolver 1.4.5 leidenalg 0.10.1 lightning 2.0.9.post0 lightning_cloud NA lightning_fabric 2.0.9.post0 lightning_utilities 0.9.0 llvmlite 0.40.1 matplotlib 3.8.0 mizani 0.9.3 ml_collections NA ml_dtypes 0.3.1 mpl_toolkits NA mpmath 1.3.0 msgpack 1.0.7 mudata 0.2.3 multidict 6.0.4 multipart 0.0.6 multipledispatch 0.6.0 natsort 8.4.0 numba 0.57.1 numpy 1.24.4 numpyro 0.13.2 opt_einsum v3.3.0 optax 0.1.7 ordered_set 4.1.0 ott 0.4.4 packaging 23.2 pandas 2.1.1 parso 0.8.3 patsy 0.5.3 pexpect 4.8.0 pickleshare 0.7.5 pkg_resources NA plotnine 0.12.3 ply 3.11 prompt_toolkit 3.0.39 psutil 5.9.5 ptyprocess 0.7.0 pure_eval 0.2.2 pydantic 2.1.1 pydantic_core 2.4.0 pygments 2.16.1 pyomo 6.6.2 pyparsing 3.1.1 pyro 1.8.6 pytorch_lightning 2.0.9.post0 pytz 2023.3.post1 requests 2.31.0 rich NA scanpy 1.9.5 scipy 1.11.3 scvi 1.0.3 seaborn 0.11.2 setuptools 68.0.0 six 1.16.0 sklearn 1.3.1 skmisc 0.3.0 sniffio 1.3.0 soupsieve 2.5 sparse 0.14.0 sparsecca 0.3.0 stack_data 0.6.3 starlette 0.27.0 statsmodels 0.14.0 switchlang 0.1.0 sympy 1.12 texttable 1.7.0 threadpoolctl 3.2.0 toolz 0.12.0 torch 2.1.0+cu121 torchgen NA torchmetrics 1.2.0 tqdm 4.66.1 traitlets 5.11.2 tree 0.1.8 typing_extensions NA urllib3 2.0.6 uvicorn 0.23.2 wcwidth 0.2.8 websocket 1.6.3 websockets 11.0.3 xarray 2023.9.0 xarray_einstats 0.6.0 yaml 6.0.1 yarl 1.9.2 zoneinfo NA

Python 3.10.13 (main, Sep 11 2023, 13:44:35) [GCC 11.2.0] Linux-6.2.0-33-generic-x86_64-with-glibc2.35

Session information updated at 2023-10-06 15:04

Zethson commented 1 year ago

That's an issue of scvi-tools that should be fixed with one of their next releases.

Zethson commented 1 year ago

The latest Anndata release fixes this

lucas-diedrich commented 1 year ago

Thank you for your responsiveness and the fix!