BiomedicalMachineLearning / stLearn

A novel machine learning pipeline to analyse spatial transcriptomics data
Other
176 stars 23 forks source link

Issue loading stlearn #277

Closed KarlKaise closed 3 months ago

KarlKaise commented 5 months ago

Hello, while trying to run the jupyternotebook for slideseq (https://stlearn.readthedocs.io/en/latest/tutorials/Read_slideseq.html) I encountered following error message (See below), while executing the first step of the notebook: import stlearn as st import warnings warnings.filterwarnings('ignore')

Would be grateful for any advice :)

Thanks a lot


TypeError Traceback (most recent call last) Cell In[1], line 1 ----> 1 import stlearn as st 2 import warnings 3 warnings.filterwarnings('ignore')

File ~/anaconda3_1/envs/stlearn/lib/python3.8/site-packages/stlearn/init.py:9 5 version = "0.4.12" 8 from . import add ----> 9 from . import pp 10 from . import em 11 from . import tl

File ~/anaconda3_1/envs/stlearn/lib/python3.8/site-packages/stlearn/pp.py:1 ----> 1 from .preprocessing.filter_genes import filter_genes 2 from .preprocessing.normalize import normalize_total 3 from .preprocessing.log_scale import log1p

File ~/anaconda3_1/envs/stlearn/lib/python3.8/site-packages/stlearn/preprocessing/filter_genes.py:5 3 import numpy as np 4 from scipy.sparse import issparse, isspmatrix_csr, csr_matrix, spmatrix ----> 5 import scanpy 8 def filter_genes( 9 adata: AnnData, 10 min_counts: Optional[int] = None, (...) 14 inplace: bool = True, 15 ) -> Union[AnnData, None, Tuple[np.ndarray, np.ndarray]]: 16 """\ 17 Wrap function scanpy.pp.filter_genes 18 (...) 49 n_counts or n_cells per gene. 50 """

File ~/anaconda3_1/envs/stlearn/lib/python3.8/site-packages/scanpy/init.py:16 14 from . import tools as tl 15 from . import preprocessing as pp ---> 16 from . import plotting as pl 17 from . import datasets, logging, queries, external, get, metrics 19 from anndata import AnnData, concat

File ~/anaconda3_1/envs/stlearn/lib/python3.8/site-packages/scanpy/plotting/init.py:1 ----> 1 from ._anndata import ( 2 scatter, 3 violin, 4 ranking, 5 clustermap, 6 tracksplot, 7 dendrogram, 8 correlation_matrix, 9 heatmap, 10 ) 11 from ._dotplot import DotPlot, dotplot 12 from ._matrixplot import MatrixPlot, matrixplot

File ~/anaconda3_1/envs/stlearn/lib/python3.8/site-packages/scanpy/plotting/_anndata.py:28 26 from .._utils import sanitize_anndata, _doc_params, _check_use_raw 27 from .._compat import Literal ---> 28 from . import _utils 29 from ._utils import scatter_base, scatter_group, setup_axes, check_colornorm 30 from ._utils import ColorLike, _FontWeight, _FontSize

File ~/anaconda3_1/envs/stlearn/lib/python3.8/site-packages/scanpy/plotting/_utils.py:35 29 _FontSize = Literal[ 30 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large' 31 ] 32 VBound = Union[str, float, Callable[[Sequence[float]], float]] ---> 35 class _AxesSubplot(Axes, axes.SubplotBase, ABC): 36 """Intersection between Axes and SubplotBase: Has methods of both""" 39 # ------------------------------------------------------------------------------- 40 # Simple plotting functions 41 # -------------------------------------------------------------------------------

TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

duypham2108 commented 5 months ago

Can you check the version of scanpy? I think the first solution is to upgrade the version of scanpy:

pip install -U scanpy