module 'louvain._c_louvain' has no attribute '_set_rng_seed'
See original GitHub issuetrying to run louvain clustering but got the error:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-22-fe1390cdc24a> in <module>
----> 1 sc.tl.louvain(adata, resolution=1.0)
~/miniconda3/envs/scrna/lib/python3.7/site-packages/scanpy/tools/_louvain.py in louvain(adata, resolution, random_state, restrict_to, key_added, adjacency, flavor, directed, use_weights, partition_type, partition_kwargs, copy)
136 partition_kwargs["weights"] = weights
137 logg.info(' using the "louvain" package of Traag (2017)')
--> 138 louvain.set_rng_seed(random_state)
139 part = louvain.find_partition(
140 g, partition_type,
~/miniconda3/envs/scrna/lib/python3.7/site-packages/louvain/functions.py in set_rng_seed(seed)
23 def set_rng_seed(seed):
24 """ Set seed for internal random number generator. """
---> 25 _c_louvain._set_rng_seed(seed)
26
27 def find_partition(graph, partition_type, initial_membership=None, weights=None, **kwargs):
AttributeError: module 'louvain._c_louvain' has no attribute '_set_rng_seed'
sc.tl.louvain(adata, resolution=1.0)
Python 3.7
Versions:
scanpy==1.4.6 anndata==0.7.1 umap==0.4.2 numpy==1.18.3 scipy==1.4.1 pandas==1.0.3 scikit-learn==0.22.2.post1 statsmodels==0.11.1 python-igraph==0.8.2 louvain==0.6.2
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
module 'louvain._c_louvain' has no attribute '_set_rng_seed'
trying to run louvain clustering but got the error: ... module 'louvain._c_louvain' has no attribute '_set_rng_seed' #1191.
Read more >Python AttributeError: module has no attribute - Stack Overflow
AttributeError: module 'sample' has no attribute 'Sampler'. The formal parameter is named sample , yet you imported sample .
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

If anyone is stuck waiting for the new release, you can edit your
.../lib/python3.7/site-packages/scanpy/tools/_louvain.pywith these changes:Add:
partition_kwargs["seed"] = random_stateRemove:louvain.set_rng_seed(random_state)From: https://github.com/theislab/scanpy/pull/1197/commits/b54d67b9d6b41269c1612df0242210d1279ede85
Install old louvain package will solve the problem: pip install louvain==0.6.1