scverse / pertpy

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

import error pertpy 0.6.0 #631

Closed m21camby closed 3 months ago

m21camby commented 3 months ago

Report

Thank you for wonderful and really interesting tool. I'm trying to use v0.6.0 and having below error.

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Cell In[1], line 3
      1 import matplotlib.pyplot as plt
      2 import numpy as np
----> 3 import pertpy as pt
      4 import scanpy as sc
      5 from seaborn import clustermap

File /conda-stuff/miniconda3/envs/pertpy/lib/python3.9/site-packages/pertpy/__init__.py:19
     17 from . import plot as pl
     18 from . import preprocessing as pp
---> 19 from . import tools as tl

File /conda-stuff/miniconda3/envs/pertpy/lib/python3.9/site-packages/pertpy/tools/__init__.py:24
     22     print("[bold yellow]To use sccoda or tasccoda please install ete3 with [green]pip install ete3")
     23 else:
---> 24     raise e

File /conda-stuff/miniconda3/envs/pertpy/lib/python3.9/site-packages/pertpy/tools/__init__.py:18
     15 from pertpy.tools._scgen import SCGEN
     17 try:
---> 18     from pertpy.tools._coda._sccoda import Sccoda
     19     from pertpy.tools._coda._tasccoda import Tasccoda
     20 except ImportError as e:

File /conda-stuff/miniconda3/envs/pertpy/lib/python3.9/site-packages/pertpy/tools/_coda/_sccoda.py:5
      1 from __future__ import annotations
      3 from typing import TYPE_CHECKING, Literal
----> 5 import arviz as az
      6 import jax.numpy as jnp
      7 import numpy as np

File /conda-stuff/miniconda3/envs/pertpy/lib/python3.9/site-packages/arviz/__init__.py:34
     30 _log = Logger("arviz")
     33 from .data import *
---> 34 from .plots import *
     35 from .plots.backends import *
     36 from .stats import *

File /conda-stuff/miniconda3/envs/pertpy/lib/python3.9/site-packages/arviz/plots/__init__.py:2
      1 """Plotting functions."""
----> 2 from .autocorrplot import plot_autocorr
      3 from .bpvplot import plot_bpv
      4 from .bfplot import plot_bf

File /conda-stuff/miniconda3/envs/pertpy/lib/python3.9/site-packages/arviz/plots/autocorrplot.py:7
      5 from ..rcparams import rcParams
      6 from ..utils import _var_names
----> 7 from .plot_utils import default_grid, filter_plotters_list, get_plotting_function
     10 def plot_autocorr(
     11     data,
     12     var_names=None,
   (...)
     24     show=None,
     25 ):
     26     r"""Bar plot of the autocorrelation function (ACF) for a sequence of data.
     27 
     28     The ACF plots are helpful as a convergence diagnostic for posteriors from MCMC
   (...)
    117         >>> az.plot_autocorr(data, var_names=['mu', 'tau'], max_lag=200, combined=True)
    118     """

File /conda-stuff/miniconda3/envs/pertpy/lib/python3.9/site-packages/arviz/plots/plot_utils.py:15
     11 from scipy.interpolate import CubicSpline
     14 from ..rcparams import rcParams
---> 15 from ..stats.density_utils import kde
     16 from ..stats import hdi
     18 KwargSpec = Dict[str, Any]

File /conda-stuff/miniconda3/envs/pertpy/lib/python3.9/site-packages/arviz/stats/__init__.py:3
      1 # pylint: disable=wildcard-import
      2 """Statistical tests and diagnostics for ArviZ."""
----> 3 from .density_utils import *
      4 from .diagnostics import *
      5 from .stats import *

File /conda-stuff/miniconda3/envs/pertpy/lib/python3.9/site-packages/arviz/stats/density_utils.py:8
      6 from scipy.fftpack import fft
      7 from scipy.optimize import brentq
----> 8 from scipy.signal import convolve, convolve2d, gaussian  # pylint: disable=no-name-in-module
      9 from scipy.sparse import coo_matrix
     10 from scipy.special import ive  # pylint: disable=no-name-in-module

ImportError: cannot import name 'gaussian' from 'scipy.signal' (/conda-stuff/miniconda3/envs/pertpy/lib/python3.9/site-packages/scipy/signal/__init__.py)

Could you help me on this? Many thanks!!

Version information

pertpy 0.6.0

Zethson commented 3 months ago

Could you please post all of your versions? Your whole environment.

m21camby commented 3 months ago

Below is my conda env.

platform: linux-64
python-3.9.19

_libgcc_mutex=0.1=main
_openmp_mutex=5.1=1_gnu
absl-py=2.1.0=pypi_0
adjusttext=1.2.0=pypi_0
aiohttp=3.9.5=pypi_0
aiosignal=1.3.1=pypi_0
anndata=0.10.8=pypi_0
array-api-compat=1.7.1=pypi_0
arrow=1.3.0=pypi_0
arviz=0.17.1=pypi_0
asttokens=2.4.1=pypi_0
async-timeout=4.0.3=pypi_0
attrs=23.2.0=pypi_0
ca-certificates=2024.3.11=h06a4308_0
certifi=2024.6.2=pypi_0
chardet=5.2.0=pypi_0
charset-normalizer=3.3.2=pypi_0
chex=0.1.86=pypi_0
comm=0.2.2=pypi_0
contextlib2=21.6.0=pypi_0
contourpy=1.2.1=pypi_0
custom-inherit=2.4.1=pypi_0
cycler=0.12.1=pypi_0
debugpy=1.8.2=pypi_0
decorator=5.1.1=pypi_0
decoupler=1.7.0=pypi_0
docrep=0.3.2=pypi_0
equinox=0.11.4=pypi_0
et-xmlfile=1.1.0=pypi_0
etils=1.5.2=pypi_0
exceptiongroup=1.2.1=pypi_0
executing=2.0.1=pypi_0
filelock=3.15.4=pypi_0
flax=0.8.5=pypi_0
fonttools=4.53.0=pypi_0
frozenlist=1.4.1=pypi_0
fsspec=2024.6.1=pypi_0
future=1.0.0=pypi_0
get-annotations=0.1.2=pypi_0
h5netcdf=1.3.0=pypi_0
h5py=3.11.0=pypi_0
idna=3.7=pypi_0
igraph=0.11.5=pypi_0
importlib-metadata=8.0.0=pypi_0
importlib-resources=6.4.0=pypi_0
ipykernel=6.29.4=pypi_0
ipython=8.18.1=pypi_0
ipywidgets=8.1.3=pypi_0
jax=0.4.30=pypi_0
jaxlib=0.4.30=pypi_0
jaxopt=0.8.3=pypi_0
jaxtyping=0.2.31=pypi_0
jedi=0.19.1=pypi_0
jinja2=3.1.4=pypi_0
joblib=1.4.2=pypi_0
jupyter-client=8.6.2=pypi_0
jupyter-core=5.7.2=pypi_0
jupyterlab-widgets=3.0.11=pypi_0
kiwisolver=1.4.5=pypi_0
ld_impl_linux-64=2.38=h1181459_1
legacy-api-wrap=1.4=pypi_0
leidenalg=0.10.2=pypi_0
libffi=3.4.4=h6a678d5_1
libgcc-ng=11.2.0=h1234567_1
libgomp=11.2.0=h1234567_1
libstdcxx-ng=11.2.0=h1234567_1
lightning=2.1.4=pypi_0
lightning-utilities=0.11.3.post0=pypi_0
lineax=0.0.5=pypi_0
llvmlite=0.43.0=pypi_0
markdown-it-py=3.0.0=pypi_0
markupsafe=2.1.5=pypi_0
matplotlib=3.9.0=pypi_0
matplotlib-inline=0.1.7=pypi_0
mdurl=0.1.2=pypi_0
mizani=0.11.4=pypi_0
ml-collections=0.1.1=pypi_0
ml-dtypes=0.4.0=pypi_0
mpmath=1.3.0=pypi_0
msgpack=1.0.8=pypi_0
mudata=0.2.4=pypi_0
multidict=6.0.5=pypi_0
multipledispatch=1.0.0=pypi_0
muon=0.1.6=pypi_0
natsort=8.4.0=pypi_0
ncurses=6.4=h6a678d5_0
nest-asyncio=1.6.0=pypi_0
networkx=3.2.1=pypi_0
numba=0.60.0=pypi_0
numpy=1.26.4=pypi_0
numpyro=0.15.0=pypi_0
nvidia-cublas-cu12=12.1.3.1=pypi_0
nvidia-cuda-cupti-cu12=12.1.105=pypi_0
nvidia-cuda-nvrtc-cu12=12.1.105=pypi_0
nvidia-cuda-runtime-cu12=12.1.105=pypi_0
nvidia-cudnn-cu12=8.9.2.26=pypi_0
nvidia-cufft-cu12=11.0.2.54=pypi_0
nvidia-curand-cu12=10.3.2.106=pypi_0
nvidia-cusolver-cu12=11.4.5.107=pypi_0
nvidia-cusparse-cu12=12.1.0.106=pypi_0
nvidia-nccl-cu12=2.20.5=pypi_0
nvidia-nvjitlink-cu12=12.5.40=pypi_0
nvidia-nvtx-cu12=12.1.105=pypi_0
openpyxl=3.1.5=pypi_0
openssl=3.0.14=h5eee18b_0
opt-einsum=3.3.0=pypi_0
optax=0.2.2=pypi_0
orbax-checkpoint=0.5.20=pypi_0
ott-jax=0.4.6=pypi_0
packaging=24.1=pypi_0
pandas=2.2.2=pypi_0
parso=0.8.4=pypi_0
patsy=0.5.6=pypi_0
pertpy=0.6.0=pypi_0
pexpect=4.9.0=pypi_0
pillow=10.3.0=pypi_0
pip=24.0=py39h06a4308_0
platformdirs=4.2.2=pypi_0
plotnine=0.13.6=pypi_0
ply=3.11=pypi_0
prompt-toolkit=3.0.47=pypi_0
protobuf=5.27.2=pypi_0
psutil=6.0.0=pypi_0
ptyprocess=0.7.0=pypi_0
pure-eval=0.2.2=pypi_0
pygments=2.18.0=pypi_0
pynndescent=0.5.13=pypi_0
pyomo=6.7.3=pypi_0
pyparsing=3.1.2=pypi_0
pypng=0.20220715.0=pypi_0
pyro-api=0.1.2=pypi_0
pyro-ppl=1.9.1=pypi_0
python=3.9.19=h955ad1f_1
python-dateutil=2.9.0.post0=pypi_0
pytorch-lightning=2.3.1=pypi_0
pytz=2024.1=pypi_0
pyyaml=6.0.1=pypi_0
pyzmq=26.0.3=pypi_0
readline=8.2=h5eee18b_0
reportlab=4.2.2=pypi_0
requests=2.32.3=pypi_0
rich=13.7.1=pypi_0
scanpy=1.10.2=pypi_0
scikit-learn=1.5.0=pypi_0
scikit-misc=0.3.1=pypi_0
scipy=1.13.1=pypi_0
scvi-tools=1.1.3=pypi_0
seaborn=0.13.2=pypi_0
session-info=1.0.0=pypi_0
setuptools=69.5.1=py39h06a4308_0
six=1.16.0=pypi_0
sparsecca=0.3.1=pypi_0
sqlite=3.45.3=h5eee18b_0
stack-data=0.6.3=pypi_0
statsmodels=0.14.2=pypi_0
stdlib-list=0.10.0=pypi_0
sympy=1.12.1=pypi_0
tensorstore=0.1.63=pypi_0
texttable=1.7.0=pypi_0
threadpoolctl=3.5.0=pypi_0
tk=8.6.14=h39e8969_0
toolz=0.12.1=pypi_0
torch=2.3.1=pypi_0
torchmetrics=1.4.0.post0=pypi_0
tornado=6.4.1=pypi_0
toyplot=1.0.3=pypi_0
toytree=2.0.5=pypi_0
tqdm=4.66.4=pypi_0
traitlets=5.14.3=pypi_0
triton=2.3.1=pypi_0
typeguard=2.13.3=pypi_0
types-python-dateutil=2.9.0.20240316=pypi_0
typing-extensions=4.12.2=pypi_0
tzdata=2024.1=pypi_0
umap-learn=0.5.6=pypi_0
urllib3=2.2.2=pypi_0
wcwidth=0.2.13=pypi_0
wheel=0.43.0=py39h06a4308_0
widgetsnbextension=4.0.11=pypi_0
xarray=2024.6.0=pypi_0
xarray-einstats=0.7.0=pypi_0
xz=5.4.6=h5eee18b_1
yarl=1.9.4=pypi_0
zipp=3.19.2=pypi_0
zlib=1.2.13=h5eee18b_1
Zethson commented 3 months ago

Upgrading scipy might help.

Is there a reason why you're not using the latest version? 0.7.0? In general, I'd encourage you to create a new environment and then install pertpy again to work with the latest versions. Else, we will have to dig a loot to figure out which versions are out of sync.

m21camby commented 3 months ago

My current project work environment is python=3.8 and only pertpy=0.4.0 was allowed there. And there was error when I import pertpy. And then I created new env with python=3.9 as I want to close to my current work env and there only perpty=0.6.0 was allowed. I will try upgrad scipy and if the error occurs, then I will try v0.7.0 and let you know. Does v0.7.0 require which python version?

Zethson commented 3 months ago

Ohhh, I see the issue with the work environment. However, we cannot support old Python versions forever. 3.8 will stop getting security updates in a few months and according to https://scientific-python.org/specs/spec-0000/ the lowest support Python version is 3.10.

pertpy 0.7.0 requires Python 3.10.

m21camby commented 3 months ago

Solved in 0.7.0. Thank you!!