I am having issues addressing a error when trying to go through the Introduction to scvi-tools notebook on my personal computer.
An error surfaces when I try to run the following cell block:
# neighbors were already computed using scVI
sc.tl.leiden(adata, key_added="leiden_scVI", resolution=0.5)
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
File ~/anaconda3/lib/python3.10/site-packages/scanpy/tools/_leiden.py:108, in leiden(adata, resolution, restrict_to, random_state, key_added, adjacency, directed, use_weights, n_iterations, partition_type, neighbors_key, obsp, copy, **partition_kwargs)
107 try:
--> 108 import leidenalg
109 except ImportError:
File ~/anaconda3/lib/python3.10/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 ~/anaconda3/lib/python3.10/site-packages/leidenalg/functions.py:2
1 import sys
----> 2 import igraph as _ig
3 from . import _c_leiden
File ~/anaconda3/lib/python3.10/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_degree_sequence,
69 is_graphical,
70 is_graphical_degree_sequence,
71 set_progress_handler,
72 set_random_number_generator,
73 set_status_handler,
74 umap_compute_weights,
75 __igraph_version__,
76 )
77 from igraph.adjacency import (
78 _get_adjacency,
79 _get_adjacency_sparse,
(...)
82 _get_inclist,
83 )
ImportError: dlopen(/Users/bak/anaconda3/lib/python3.10/site-packages/igraph/_igraph.abi3.so, 0x000A): Library not loaded: @rpath/libblas.3.dylib
Referenced from: <96A36561-4C61-39A1-9787-F499FDD5FD0E> /Users/bak/anaconda3/lib/python3.10/site-packages/igraph/_igraph.abi3.so
Reason: tried: '/Users/bak/anaconda3/lib/python3.10/site-packages/igraph/../../../libblas.3.dylib' (no such file), '/Users/bak/anaconda3/lib/python3.10/site-packages/igraph/../../../libblas.3.dylib' (no such file), '/Users/bak/anaconda3/bin/../lib/libblas.3.dylib' (no such file), '/Users/bak/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[24], line 2
1 # neighbors were already computed using scVI
----> 2 sc.tl.leiden(adata, key_added="leiden_scVI", resolution=0.5)
File ~/anaconda3/lib/python3.10/site-packages/scanpy/tools/_leiden.py:110, in leiden(adata, resolution, restrict_to, random_state, key_added, adjacency, directed, use_weights, n_iterations, partition_type, neighbors_key, obsp, copy, **partition_kwargs)
108 import leidenalg
109 except ImportError:
--> 110 raise ImportError(
111 'Please install the leiden algorithm: `conda install -c conda-forge leidenalg` or `pip3 install leidenalg`.'
112 )
113 partition_kwargs = dict(partition_kwargs)
115 start = logg.info('running Leiden clustering')
ImportError: Please install the leiden algorithm: `conda install -c conda-forge leidenalg` or `pip3 install leidenalg`.
Besides a few NumbaDeprecationWarning and UserWarning outputs, all former cell blocks ran succesfully.
I have followed the instructions for installations and made sure everything was installed without error. I using a Apple M2 MAX. I made sure to run ‘brew install --cask mambaforge’ as mentioned in the instructions.
I have tried running conda install -c conda-forge leidenalg
and pip3 install leidenalg
via the terminal but the issue still surfaces when I re-run the cell block. I have also tried looking through past threads if this issue has surfaced before but could not find any former discussion regarding this issue.