martinjzhang / scDRS

Single-cell disease relevance score (scDRS)
https://martinjzhang.github.io/scDRS/
MIT License
109 stars 14 forks source link

error metaclass conflict #67

Closed jhong26 closed 1 year ago

jhong26 commented 1 year ago

Hello, I am trying to run scdrs but am getting the following error related to a metaclass conflict. Any input would be much appreciated. Thank you, Jason

import scdrs

TypeError Traceback (most recent call last) /var/folders/ld/1195vjjx1dz0tz1sdrgq6pshdm454q/T/ipykernel_70082/1366053663.py in ----> 1 import scdrs

/opt/miniconda3/lib/python3.9/site-packages/scdrs/init.py in ----> 1 from . import method, data_loader, util, pp 2 3 # expose functions so that scdrs.score_cell, scdrs.preprocess can be called 4 from .method import score_cell 5 from .pp import preprocess

/opt/miniconda3/lib/python3.9/site-packages/scdrs/method.py in ----> 1 import scanpy as sc 2 import numpy as np 3 import scipy as sp 4 import pandas as pd 5 from tqdm import tqdm

/opt/miniconda3/lib/python3.9/site-packages/scanpy/init.py in 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 18

/opt/miniconda3/lib/python3.9/site-packages/scanpy/plotting/init.py in ----> 1 from ._anndata import ( 2 scatter, 3 violin, 4 ranking, 5 clustermap,

/opt/miniconda3/lib/python3.9/site-packages/scanpy/plotting/_anndata.py in 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

/opt/miniconda3/lib/python3.9/site-packages/scanpy/plotting/_utils.py in 33 34 ---> 35 class _AxesSubplot(Axes, axes.SubplotBase, ABC): 36 """Intersection between Axes and SubplotBase: Has methods of both""" 37

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

martinjzhang commented 1 year ago

Hi Jason,

The problem seems to be that the same name has been used to refer to different modules.

For example, you imported pp from scdrs (line1) and imported another pp from scanpy (line 15). This may create certain conflicts.

Maybe just do import scdrs and call the pp module using scdrs.pp?