# Error occurs when input "sc.tl.leiden(adata)" after !pip install leidenalg and !pip install igraph both return "Requirement already satisfied""

**URL:** <https://igraph.discourse.group/t/error-occurs-when-input-sc-tl-leiden-adata-after-pip-install-leidenalg-and-pip-install-igraph-both-return-requirement-already-satisfied/1905>\
**Category:** Installation\
**Tags:** Python\
**Created:** [10 December 2024 08:00 UTC](https://igraph.discourse.group/t/error-occurs-when-input-sc-tl-leiden-adata-after-pip-install-leidenalg-and-pip-install-igraph-both-return-requirement-already-satisfied/1905 "2024-12-10T08:00:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lirneot\_Couritz](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/lirneot_couritz/32/1140_2.png) [@Lirneot\_Couritz](https://igraph.discourse.group/u/Lirneot_Couritz)\
**Post date:** [10 December 2024 08:00 UTC](https://igraph.discourse.group/t/error-occurs-when-input-sc-tl-leiden-adata-after-pip-install-leidenalg-and-pip-install-igraph-both-return-requirement-already-satisfied/1905/1 "2024-12-10T08:00:59Z")

</div>

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`.

---

<div class="post-metadata">

**Author:** ![iosonofabio](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/iosonofabio/32/16_2.png) [@iosonofabio](https://igraph.discourse.group/u/iosonofabio)\
**Post date:** [11 December 2024 19:17 UTC](https://igraph.discourse.group/t/error-occurs-when-input-sc-tl-leiden-adata-after-pip-install-leidenalg-and-pip-install-igraph-both-return-requirement-already-satisfied/1905/2 "2024-12-11T19:17:06Z")

</div>

Try restarting the notebook kernel and rerun it
