...
I'm trying to simply install cellrank into a conda environment and load it within a jupyter notebook. Seems like package version incompatibilities are present.
NOTE: had to downgrade scipy to 1.12.0 to prevent error about tril being missing from linalg.
import scanpy as sc
import os.path as op
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import sys
import os
import seaborn as sns
from pathlib import Path
All load fine
import cellrank
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[2], line 1
----> 1 import cellrank
File [~/mambaforge/envs/cellrank/lib/python3.11/site-packages/cellrank/__init__.py:3](http://localhost:8888/~/mambaforge/envs/cellrank/lib/python3.11/site-packages/cellrank/__init__.py#line=2)
1 from importlib import metadata
----> 3 from cellrank import datasets, estimators, kernels, logging, models, pl
4 from cellrank._utils._lineage import Lineage
5 from cellrank.settings import settings
File [~/mambaforge/envs/cellrank/lib/python3.11/site-packages/cellrank/estimators/__init__.py:1](http://localhost:8888/~/mambaforge/envs/cellrank/lib/python3.11/site-packages/cellrank/estimators/__init__.py#line=0)
----> 1 from cellrank.estimators import mixins
2 from cellrank.estimators._base_estimator import BaseEstimator
3 from cellrank.estimators.terminal_states import CFLARE, GPCCA, TermStatesEstimator
File [~/mambaforge/envs/cellrank/lib/python3.11/site-packages/cellrank/estimators/mixins/__init__.py:3](http://localhost:8888/~/mambaforge/envs/cellrank/lib/python3.11/site-packages/cellrank/estimators/mixins/__init__.py#line=2)
1 from cellrank.estimators.mixins._fate_probabilities import FateProbsMixin
2 from cellrank.estimators.mixins._kernel import KernelMixin
----> 3 from cellrank.estimators.mixins._lineage_drivers import LinDriversMixin
4 from cellrank.estimators.mixins.decomposition import EigenMixin, SchurMixin
6 __all__ = ["FateProbsMixin", "KernelMixin", "LinDriversMixin", "EigenMixin", "SchurMixin"]
File [~/mambaforge/envs/cellrank/lib/python3.11/site-packages/cellrank/estimators/mixins/_lineage_drivers.py:6](http://localhost:8888/~/mambaforge/envs/cellrank/lib/python3.11/site-packages/cellrank/estimators/mixins/_lineage_drivers.py#line=5)
3 import types
4 from typing import Any, Dict, Literal, Mapping, Optional, Sequence, Tuple, Union
----> 6 import scvelo as scv
8 import numpy as np
9 import pandas as pd
File [~/mambaforge/envs/cellrank/lib/python3.11/site-packages/scvelo/__init__.py:6](http://localhost:8888/~/mambaforge/envs/cellrank/lib/python3.11/site-packages/scvelo/__init__.py#line=5)
3 from scanpy import read, read_loom
5 from scvelo import datasets, logging
----> 6 from scvelo import plotting as pl
7 from scvelo import preprocessing as pp
8 from scvelo import settings
File [~/mambaforge/envs/cellrank/lib/python3.11/site-packages/scvelo/plotting/__init__.py:3](http://localhost:8888/~/mambaforge/envs/cellrank/lib/python3.11/site-packages/scvelo/plotting/__init__.py#line=2)
1 from scanpy.plotting import paga_compare, rank_genes_groups
----> 3 from .gridspec import gridspec
4 from .heatmap import heatmap
5 from .paga import paga
File [~/mambaforge/envs/cellrank/lib/python3.11/site-packages/scvelo/plotting/gridspec.py:6](http://localhost:8888/~/mambaforge/envs/cellrank/lib/python3.11/site-packages/scvelo/plotting/gridspec.py#line=5)
3 import matplotlib.pyplot as pl
5 # todo: auto-complete and docs wrapper
----> 6 from .scatter import scatter
7 from .utils import get_figure_params, hist
8 from .velocity_embedding import velocity_embedding
File [~/mambaforge/envs/cellrank/lib/python3.11/site-packages/scvelo/plotting/scatter.py:16](http://localhost:8888/~/mambaforge/envs/cellrank/lib/python3.11/site-packages/scvelo/plotting/scatter.py#line=15)
14 from scvelo.preprocessing.neighbors import get_connectivities
15 from .docs import doc_params, doc_scatter
---> 16 from .utils import (
17 default_basis,
18 default_color,
19 default_color_map,
20 default_legend_loc,
21 default_size,
22 default_xkey,
23 default_ykey,
24 get_ax,
25 get_components,
26 get_figure_params,
27 get_kwargs,
28 get_obs_vector,
29 get_value_counts,
30 gets_vals_from_color_gradients,
31 groups_to_bool,
32 interpret_colorkey,
33 is_categorical,
34 is_int,
35 is_list,
36 is_list_of_int,
37 is_list_of_list,
38 is_list_of_str,
39 make_dense,
40 plot_density,
41 plot_linfit,
42 plot_outline,
43 plot_polyfit,
44 plot_rug,
45 plot_velocity_fits,
46 rgb_custom_colormap,
47 savefig_or_show,
48 set_colorbar,
49 set_colors_for_categorical_obs,
50 set_label,
51 set_legend,
52 set_margin,
53 set_title,
54 to_list,
55 to_val,
56 to_valid_bases_list,
57 update_axes,
58 )
61 @doc_params(scatter=doc_scatter)
62 def scatter(
63 adata=None,
(...)
123 **kwargs,
124 ):
125 """Scatter plot along observations or variables axes.
126
127 Arguments:
(...)
139 If `show==False` a `matplotlib.Axis`
140 """
File [~/mambaforge/envs/cellrank/lib/python3.11/site-packages/scvelo/plotting/utils.py:24](http://localhost:8888/~/mambaforge/envs/cellrank/lib/python3.11/site-packages/scvelo/plotting/utils.py#line=23)
22 from scvelo import logging as logg
23 from scvelo import settings
---> 24 from scvelo.tools.utils import strings_to_categoricals
25 from . import palettes
27 """helper functions"""
File [~/mambaforge/envs/cellrank/lib/python3.11/site-packages/scvelo/tools/__init__.py:28](http://localhost:8888/~/mambaforge/envs/cellrank/lib/python3.11/site-packages/scvelo/tools/__init__.py#line=27)
25 from .velocity_pseudotime import velocity_map, velocity_pseudotime
27 with contextlib.suppress(ImportError):
---> 28 from ._vi_model import VELOVI
31 __all__ = [
32 "align_dynamics",
33 "differential_kinetic_test",
(...)
61 "ExpectationMaximizationModel",
62 ]
63 if "VELOVI" in locals():
File [~/mambaforge/envs/cellrank/lib/python3.11/site-packages/scvelo/tools/_vi_model.py:14](http://localhost:8888/~/mambaforge/envs/cellrank/lib/python3.11/site-packages/scvelo/tools/_vi_model.py#line=13)
11 from scipy.stats import ttest_ind
13 from anndata import AnnData
---> 14 from scvi.data import AnnDataManager
15 from scvi.data.fields import LayerField
16 from scvi.dataloaders import DataSplitter
File [~/mambaforge/envs/cellrank/lib/python3.11/site-packages/scvi/__init__.py:11](http://localhost:8888/~/mambaforge/envs/cellrank/lib/python3.11/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 [~/mambaforge/envs/cellrank/lib/python3.11/site-packages/scvi/data/__init__.py:25](http://localhost:8888/~/mambaforge/envs/cellrank/lib/python3.11/site-packages/scvi/data/__init__.py#line=24)
4 from ._datasets import (
5 annotation_simulation,
6 brainlarge_dataset,
(...)
22 synthetic_iid,
23 )
24 from ._manager import AnnDataManager, AnnDataManagerValidationCheck
---> 25 from ._preprocessing import (
26 add_dna_sequence,
27 organize_cite_seq_10x,
28 organize_multiome_anndatas,
29 poisson_gene_selection,
30 reads_to_fragments,
31 )
32 from ._read import read_10x_atac, read_10x_multiome
34 __all__ = [
35 "AnnTorchDataset",
36 "AnnDataManagerValidationCheck",
(...)
66 "cellxgene",
67 ]
File [~/mambaforge/envs/cellrank/lib/python3.11/site-packages/scvi/data/_preprocessing.py:12](http://localhost:8888/~/mambaforge/envs/cellrank/lib/python3.11/site-packages/scvi/data/_preprocessing.py#line=11)
9 import torch
10 from scipy.sparse import issparse
---> 12 from scvi.model._utils import parse_device_args
13 from scvi.utils import dependencies, track
14 from scvi.utils._docstrings import devices_dsp
File [~/mambaforge/envs/cellrank/lib/python3.11/site-packages/scvi/model/__init__.py:2](http://localhost:8888/~/mambaforge/envs/cellrank/lib/python3.11/site-packages/scvi/model/__init__.py#line=1)
1 from . import utils
----> 2 from ._amortizedlda import AmortizedLDA
3 from ._autozi import AUTOZI
4 from ._condscvi import CondSCVI
File [~/mambaforge/envs/cellrank/lib/python3.11/site-packages/scvi/model/_amortizedlda.py:15](http://localhost:8888/~/mambaforge/envs/cellrank/lib/python3.11/site-packages/scvi/model/_amortizedlda.py#line=14)
13 from scvi.data import AnnDataManager
14 from scvi.data.fields import LayerField
---> 15 from scvi.module import AmortizedLDAPyroModule
16 from scvi.utils import setup_anndata_dsp
18 from .base import BaseModelClass, PyroSviTrainMixin
File [~/mambaforge/envs/cellrank/lib/python3.11/site-packages/scvi/module/__init__.py:1](http://localhost:8888/~/mambaforge/envs/cellrank/lib/python3.11/site-packages/scvi/module/__init__.py#line=0)
----> 1 from ._amortizedlda import AmortizedLDAPyroModule
2 from ._autozivae import AutoZIVAE
3 from ._classifier import Classifier
File [~/mambaforge/envs/cellrank/lib/python3.11/site-packages/scvi/module/_amortizedlda.py:15](http://localhost:8888/~/mambaforge/envs/cellrank/lib/python3.11/site-packages/scvi/module/_amortizedlda.py#line=14)
13 from scvi._constants import REGISTRY_KEYS
14 from scvi._types import Tunable
---> 15 from scvi.module.base import PyroBaseModuleClass, auto_move_data
16 from scvi.nn import Encoder
18 _AMORTIZED_LDA_PYRO_MODULE_NAME = "amortized_lda"
File [~/mambaforge/envs/cellrank/lib/python3.11/site-packages/scvi/module/base/__init__.py:1](http://localhost:8888/~/mambaforge/envs/cellrank/lib/python3.11/site-packages/scvi/module/base/__init__.py#line=0)
----> 1 from ._base_module import (
2 BaseMinifiedModeModuleClass,
3 BaseModuleClass,
4 JaxBaseModuleClass,
5 LossOutput,
6 PyroBaseModuleClass,
7 TrainStateWithState,
8 )
9 from ._decorators import auto_move_data, flax_configure
11 __all__ = [
12 "BaseModuleClass",
13 "LossOutput",
(...)
19 "BaseMinifiedModeModuleClass",
20 ]
File [~/mambaforge/envs/cellrank/lib/python3.11/site-packages/scvi/module/base/_base_module.py:14](http://localhost:8888/~/mambaforge/envs/cellrank/lib/python3.11/site-packages/scvi/module/base/_base_module.py#line=13)
12 import pyro
13 import torch
---> 14 from flax.training import train_state
15 from jax import random
16 from jaxlib.xla_extension import Device
File [~/mambaforge/envs/cellrank/lib/python3.11/site-packages/flax/training/train_state.py:19](http://localhost:8888/~/mambaforge/envs/cellrank/lib/python3.11/site-packages/flax/training/train_state.py#line=18)
17 from flax import core
18 from flax import struct
---> 19 import optax
22 class TrainState(struct.PyTreeNode):
23 """Simple train state for the common case with a single Optax optimizer.
24
25 Synopsis::
(...)
50 opt_state: The state for `tx`.
51 """
File [~/mambaforge/envs/cellrank/lib/python3.11/site-packages/optax/__init__.py:18](http://localhost:8888/~/mambaforge/envs/cellrank/lib/python3.11/site-packages/optax/__init__.py#line=17)
15 """Optax: composable gradient processing and optimization, in JAX."""
17 from optax import contrib
---> 18 from optax import losses
19 from optax import monte_carlo
20 from optax import projections
File [~/mambaforge/envs/cellrank/lib/python3.11/site-packages/optax/losses/__init__.py:17](http://localhost:8888/~/mambaforge/envs/cellrank/lib/python3.11/site-packages/optax/losses/__init__.py#line=16)
1 # Copyright 2019 DeepMind Technologies Limited. All Rights Reserved.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
(...)
13 # limitations under the License.
14 # ==============================================================================
15 """The losses sub-package."""
---> 17 from optax.losses._classification import convex_kl_divergence
18 from optax.losses._classification import ctc_loss
19 from optax.losses._classification import ctc_loss_with_forward_probs
File [~/mambaforge/envs/cellrank/lib/python3.11/site-packages/optax/losses/_classification.py:64](http://localhost:8888/~/mambaforge/envs/cellrank/lib/python3.11/site-packages/optax/losses/_classification.py#line=63)
59 log_not_p = jax.nn.log_sigmoid(-logits)
60 return -labels * log_p - (1. - labels) * log_not_p
63 @functools.partial(
---> 64 chex.warn_deprecated_function,
65 replacement='sigmoid_binary_cross_entropy')
66 def binary_logistic_loss(logits, labels):
67 return sigmoid_binary_cross_entropy(logits, labels)
70 def hinge_loss(
71 predictor_outputs: chex.Array,
72 targets: chex.Array
73 ) -> chex.Array:
AttributeError: module 'chex' has no attribute 'warn_deprecated_function'
... I'm trying to simply install cellrank into a conda environment and load it within a jupyter notebook. Seems like package version incompatibilities are present.
NOTE: had to downgrade
scipy
to 1.12.0 to prevent error abouttril
being missing fromlinalg
.All load fine
Versions:
# can't run due to cellrank not loading