AttributeError: module 'scipy.sparse' has no attribute 'csgraph'
- Dominant language
- Python
- Stars
- 8.3k
- Forks
- 871
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 5
Description
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)
in ()
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
`
Contributor guide
Research direction
Reproduce the digits example with umap.UMAP().fit_transform(digits.data) and inspect the traceback through umap/umap_.py, especially spectral_layout. Compare the failing scipy.sparse.csgraph access with the separately working `from scipy.sparse import csgraph` import. Done means the example runs without the AttributeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100