BiomedicalMachineLearning / stLearn

A novel machine learning pipeline to analyse spatial transcriptomics data
Other
190 stars 25 forks source link

TypeError: metaclass conflict #223

Closed tyaoi closed 1 year ago

tyaoi commented 1 year ago

Hi!,

After making the conda env and installing stLearn on Ubuntu 20.04LTS, I failed to import stLearn as follows. How do I resolve this problem ?

>>> import stlearn as st Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/user1/anaconda3/envs/stlearn_230220/lib/python3.10/site-packages/stlearn/__init__.py", line 11, in <module> from . import tl File "/home/user1/anaconda3/envs/stlearn_230220/lib/python3.10/site-packages/stlearn/tl.py", line 1, in <module> from .tools import clustering File "/home/user1/anaconda3/envs/stlearn_230220/lib/python3.10/site-packages/stlearn/tools/clustering/__init__.py", line 3, in <module> from .annotate import annotate_interactive File "/home/user1/anaconda3/envs/stlearn_230220/lib/python3.10/site-packages/stlearn/tools/clustering/annotate.py", line 2, in <module> from stlearn.plotting.classes_bokeh import Annotate File "/home/user1/anaconda3/envs/stlearn_230220/lib/python3.10/site-packages/stlearn/plotting/classes_bokeh.py", line 50, in <module> from stlearn.classes import Spatial File "/home/user1/anaconda3/envs/stlearn_230220/lib/python3.10/site-packages/stlearn/classes.py", line 14, in <module> from .utils import ( File "/home/user1/anaconda3/envs/stlearn_230220/lib/python3.10/site-packages/stlearn/utils.py", line 29, in <module> class _AxesSubplot(Axes, axes.SubplotBase, ABC): TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

tyaoi

duypham2108 commented 1 year ago

Can you install stlearn with python3.8? we haven't tested it with python 3.10 yet

tyaoi commented 1 year ago

Hi, duypham2108 !

Yes! I installed stlearn following the documentation. I did it both ways (conda install / pip install) and I get the same error message.

tyaoi

duypham2108 commented 1 year ago

It seems a new version of matplotlib made this bug. Can you try to downgrade matplotlib to < 3.7. For example:

pip install matplotlib==3.6.3
tyaoi commented 1 year ago

Thanks, duypham2108 !

After pip installing stLearn and downgrading matplotlib, I can run stLearn successfully!

tyaoi