Hi, I’m new to the single cell sequencing analysis using python via igraph. After I followed some tutorial online I encountered error after my input of “sc.tl.leiden(adata)” that presents as a really long text (I put it in the end of this topic). I have checked on my installation of igraph and leidenalg it repeated the error. And I have tried to search my issue on google but could not find a way to solve it. I’m using Jupyter notebook on macos. I’d be grateful for any suggestions you guys might provide.
ImportError Traceback (most recent call last)
File /opt/anaconda3/lib/python3.11/site-packages/scanpy/tools/_leiden.py:136, in leiden(adata, resolution, restrict_to, random_state, key_added, adjacency, directed, use_weights, n_iterations, partition_type, neighbors_key, obsp, copy, flavor, **clustering_args)
135 try:
→ 136 import leidenalg
138 msg = ‘In the future, the default backend for leiden will be igraph instead of leidenalg.\n\n To achieve the future defaults please pass: flavor=“igraph” and n_iterations=2. directed must also be False to work with igraph's implementation.’
File /opt/anaconda3/lib/python3.11/site-packages/leidenalg/init.py:35
2 r"“” This package implements the Leiden algorithm in C++
and exposes it to
3 python. It relies on (python-)igraph
for it to function. Besides the
4 relative flexibility of the implementation, it also scales well, and can be run
(…)
33 not immediately available in :func:leidenalg.find_partition
.
34 “”"
—> 35 from .functions import ALL_COMMS
36 from .functions import ALL_NEIGH_COMMS
File /opt/anaconda3/lib/python3.11/site-packages/leidenalg/functions.py:2
1 import sys
----> 2 import igraph as _ig
3 from . import _c_leiden
File /opt/anaconda3/lib/python3.11/site-packages/igraph/init.py:25
6 license = “”"
7 Copyright (C) 2006- The igraph development team
8
(…)
22 02110-1301 USA
23 “”"
—> 25 from igraph._igraph import (
26 ADJ_DIRECTED,
27 ADJ_LOWER,
28 ADJ_MAX,
29 ADJ_MIN,
30 ADJ_PLUS,
31 ADJ_UNDIRECTED,
32 ADJ_UPPER,
33 ALL,
34 ARPACKOptions,
35 BFSIter,
36 BLISS_F,
37 BLISS_FL,
38 BLISS_FLM,
39 BLISS_FM,
40 BLISS_FS,
41 BLISS_FSM,
42 DFSIter,
43 Edge,
44 GET_ADJACENCY_BOTH,
45 GET_ADJACENCY_LOWER,
46 GET_ADJACENCY_UPPER,
47 GraphBase,
48 IN,
49 InternalError,
50 OUT,
51 REWIRING_SIMPLE,
52 REWIRING_SIMPLE_LOOPS,
53 STAR_IN,
54 STAR_MUTUAL,
55 STAR_OUT,
56 STAR_UNDIRECTED,
57 STRONG,
58 TRANSITIVITY_NAN,
59 TRANSITIVITY_ZERO,
60 TREE_IN,
61 TREE_OUT,
62 TREE_UNDIRECTED,
63 Vertex,
64 WEAK,
65 arpack_options as default_arpack_options,
66 community_to_membership,
67 convex_hull,
68 is_bigraphical,
69 is_degree_sequence,
70 is_graphical,
71 is_graphical_degree_sequence,
72 set_progress_handler,
73 set_random_number_generator,
74 set_status_handler,
75 umap_compute_weights,
76 igraph_version,
77 )
78 from igraph.adjacency import (
79 _get_adjacency,
80 _get_adjacency_sparse,
(…)
83 _get_inclist,
84 )
ImportError: dlopen(/opt/anaconda3/lib/python3.11/site-packages/igraph/_igraph.abi3.so, 0x0002): Library not loaded: @rpath/libblas.3.dylib
Referenced from: <02509E24-7ACD-33C4-AD2D-6FF0D9929080> /opt/anaconda3/lib/python3.11/site-packages/igraph/_igraph.abi3.so
Reason: tried: ‘/opt/anaconda3/lib/python3.11/site-packages/igraph/…/…/…/libblas.3.dylib’ (no such file), ‘/opt/anaconda3/lib/python3.11/site-packages/igraph/…/…/…/libblas.3.dylib’ (no such file), ‘/opt/anaconda3/bin/…/lib/libblas.3.dylib’ (no such file), ‘/opt/anaconda3/bin/…/lib/libblas.3.dylib’ (no such file), ‘/usr/local/lib/libblas.3.dylib’ (no such file), ‘/usr/lib/libblas.3.dylib’ (no such file, not in dyld cache)
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
Cell In[34], line 1
----> 1 sc.tl.leiden(adata)
File /opt/anaconda3/lib/python3.11/site-packages/scanpy/tools/_leiden.py:141, in leiden(adata, resolution, restrict_to, random_state, key_added, adjacency, directed, use_weights, n_iterations, partition_type, neighbors_key, obsp, copy, flavor, **clustering_args)
139 _utils.warn_once(msg, FutureWarning, stacklevel=3)
140 except ImportError:
→ 141 raise ImportError(
142 “Please install the leiden algorithm: conda install -c conda-forge leidenalg
or pip3 install leidenalg
.”
143 )
144 clustering_args = dict(clustering_args)
146 start = logg.info(“running Leiden clustering”)
ImportError: Please install the leiden algorithm: conda install -c conda-forge leidenalg
or pip3 install leidenalg
.