Scanpy: Install Issue: AttributeError: module 'igraph' has no attribute 'VertexClustering'

Created on 26 Dec 2019  路  2Comments  路  Source: theislab/scanpy

Hello,

Importing scanpy unsuccessful. Please see below for details. This is after the Igraph package is successfully imported.

`---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-13-a0665160cba0> in <module>
      1 import anndata
----> 2 import scanpy as sc
      3 import igraph
      4 
      5 C6665_new = anndata.AnnData(C6665_encoded)

~\anaconda3\envs\ms-sy-code\lib\site-packages\scanpy\__init__.py in <module>
     30 # the actual API
     31 from ._settings import settings, Verbosity  # start with settings as several tools are using it
---> 32 from . import tools as tl
     33 from . import preprocessing as pp
     34 from . import plotting as pl

~\anaconda3\envs\ms-sy-code\lib\site-packages\scanpy\tools\__init__.py in <module>
      8 from ._rank_genes_groups import rank_genes_groups, filter_rank_genes_groups
      9 from ._dpt import dpt
---> 10 from ._leiden import leiden
     11 from ._louvain import louvain
     12 from ._sim import sim

~\anaconda3\envs\ms-sy-code\lib\site-packages\scanpy\tools\_leiden.py in <module>
     13 
     14 try:
---> 15     from leidenalg.VertexPartition import MutableVertexPartition
     16 except ImportError:
     17     class MutableVertexPartition: pass

~\anaconda3\envs\ms-sy-code\lib\site-packages\leidenalg\__init__.py in <module>
     33 not immediately available in :func:`leidenalg.find_partition`.
     34 """
---> 35 from .functions import ALL_COMMS
     36 from .functions import ALL_NEIGH_COMMS
     37 from .functions import RAND_COMM

~\anaconda3\envs\ms-sy-code\lib\site-packages\leidenalg\functions.py in <module>
     21     return graph.__graph_as_cobject()
     22 
---> 23 from .VertexPartition import *
     24 from .Optimiser import *
     25 

~\anaconda3\envs\ms-sy-code\lib\site-packages\leidenalg\VertexPartition.py in <module>
      6 PY3 = (sys.version > '3')
      7 
----> 8 class MutableVertexPartition(_ig.VertexClustering):
      9   """ Contains a partition of graph, derives from :class:`ig.VertexClustering`.
     10 

AttributeError: module 'igraph' has no attribute 'VertexClustering'`

I might be wrong, but looks like Scanpy is directly calling igraph.vertexclustering, while vertex clustering is a module under clustering. Shouldn't it be referred as ig.clustering.vertexclustering?

bug upstream

Most helpful comment

I meet this problem last days, I uninstall the python-igraph package and reinstall it. then the error disappear.

All 2 comments

I meet this problem last days, I uninstall the python-igraph package and reinstall it. then the error disappear.

@SiyuSiyuYang, does @yuxiaokang-source's solution solve your issue?

Was this page helpful?
0 / 5 - 0 ratings