question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AttributeError: module 'scipy.sparse' has no attribute 'csgraph'

See original GitHub issue

Hello,

Thank you for the great contribution.

I can’t seem to get it running. Any help is appreciated.

Here are my versions:

Requirement already satisfied: umap-learn in ./anaconda3/lib/python3.6/site-packages
Requirement already satisfied: numba>=0.34 in ./anaconda3/lib/python3.6/site-packages (from umap-learn)
Requirement already satisfied: scipy>=0.19 in ./anaconda3/lib/python3.6/site-packages (from umap-learn)
Requirement already satisfied: scikit-learn>=0.16 in ./anaconda3/lib/python3.6/site-packages (from umap-learn)
Requirement already satisfied: llvmlite in ./anaconda3/lib/python3.6/site-packages (from numba>=0.34->umap-learn)
Requirement already satisfied: numpy in ./anaconda3/lib/python3.6/site-packages (from numba>=0.34->umap-learn)

Running the example,

import umap
from sklearn.datasets import load_digits

digits = load_digits()

embedding = umap.UMAP().fit_transform(digits.data)

outputs:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-32-e5c7a5ee7150> in <module>()
      4 digits = load_digits()
      5 
----> 6 embedding = umap.UMAP().fit_transform(digits.data)

~/anaconda3/lib/python3.6/site-packages/umap/umap_.py in fit_transform(self, X, y)

~/anaconda3/lib/python3.6/site-packages/umap/umap_.py in fit(self, X, y)

~/anaconda3/lib/python3.6/site-packages/umap/umap_.py in simplicial_set_embedding(graph, n_components, initial_alpha, a, b, gamma, negative_sample_rate, n_epochs, init, random_state, verbose)

~/anaconda3/lib/python3.6/site-packages/umap/umap_.py in spectral_layout(graph, dim, random_state)

AttributeError: module 'scipy.sparse' has no attribute 'csgraph'

But I can import csgraph witout problems from scipy, from scipy.sparse import csgraph

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:3
  • Comments:26 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
wangchuan2008888commented, Jul 17, 2018

Scipy 1.1.0 has release, so in ubuntu python 3.6.4 just pip install -U scipy scipy 1.1.0 installed, problem sloved!

1reaction
gokceneraslancommented, Feb 21, 2018

You can maybe exclude scipy==1.0 in setup.py.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AttributeError: module 'scipy.sparse' has no attribute 'coo_array'
The scipy.sparse.*_array functions were introduced with v1.8. The networkx package started requiring scipy >=1.8 with v2.7.
Read more >
Scipy sparse setuptools issues - Python Forum
You have post to what code/library you use. sparsetools was removed ... AttributeError: module 'scipy.sparse' has no attribute 'sparsetools'.
Read more >
AttributeError:模块'scipy.sparse'没有属性'coo_array' (module ...
解决AttributeError: module 'scipy.sparse' has no attribute 'csgraph'问题添加语句即可: from scipy.sparse.csgraph import connected_components.
Read more >
scipy.sparse.csr_matrix — SciPy v1.9.3 Manual
If the shape parameter is not supplied, the matrix dimensions are inferred from the index arrays. Notes. Sparse matrices can be used in...
Read more >
module 'scipy.sparse' has no attribute 'coo_array'
Problem with draw_networkx: module 'scipy.sparse' has no attribute 'coo_array' ... AttributeError Traceback (most recent call last) Input In [31], ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found