Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scipy sparse import error #252

Closed
xchoo opened this issue Oct 15, 2019 · 1 comment
Labels
bug

Comments

@xchoo
Copy link
Member

@xchoo xchoo commented Oct 15, 2019

I encountered this issue with the current master branch of nengo-loihi, nxsdk 0.8.5.1, and with the nengolib repo installed in a python environment. The error occurs trying to run ens_ens.py from the docs/examples folder.

Traceback (most recent call last):
  File "ens_ens.py", line 35, in <module>
    with nengo_loihi.Simulator(model) as sim:
  File "/home-mjc/pawel/nengo-loihi/nengo_loihi/simulator.py", line 146, in __init__
    self.model.build(network)
  File "/home-mjc/pawel/nengo-loihi/nengo_loihi/builder/builder.py", line 208, in build
    built = model.builder.build(model, obj, *args, **kwargs)
  File "/home/pawel/anaconda3/envs/loihi-mjc/lib/python3.5/site-packages/nengo/builder/builder.py", line 218, in build
    return cls.builders[obj_cls](model, obj, *args, **kwargs)
  File "/home/pawel/anaconda3/envs/loihi-mjc/lib/python3.5/site-packages/nengo/builder/network.py", line 113, in build_network
    model.build(conn)
  File "/home-mjc/pawel/nengo-loihi/nengo_loihi/builder/builder.py", line 208, in build
    built = model.builder.build(model, obj, *args, **kwargs)
  File "/home/pawel/anaconda3/envs/loihi-mjc/lib/python3.5/site-packages/nengo/builder/builder.py", line 218, in build
    return cls.builders[obj_cls](model, obj, *args, **kwargs)
  File "/home-mjc/pawel/nengo-loihi/nengo_loihi/builder/connection.py", line 60, in build_connection
    build_chip_connection(model, conn)
  File "/home-mjc/pawel/nengo-loihi/nengo_loihi/builder/connection.py", line 467, in build_chip_connection
    if isinstance(transform, scipy.sparse.spmatrix):
AttributeError: module 'scipy' has no attribute 'sparse'

I fixed it locally by doing import scipy.sparse in builder/connections.py, right after the import scipy line.

@xchoo xchoo added the bug label Oct 16, 2019
hunse added a commit that referenced this issue Oct 30, 2019
Fixes #252.
@hunse

This comment has been minimized.

Copy link
Collaborator

@hunse hunse commented Oct 30, 2019

I just ran into this when testing on a fresh install with Nengo 2.8.0. I've put a fix in #234.

hunse added a commit that referenced this issue Oct 30, 2019
Some import statements just imported `scipy` when we needed
`scipy.sparse`. Import order differences made this an occasional
bug. Fixes #252.
hunse added a commit that referenced this issue Oct 30, 2019
Some import statements just imported `scipy` when we needed
`scipy.sparse`. Import order differences made this an occasional
bug. Fixes #252.
hunse added a commit that referenced this issue Nov 13, 2019
Some import statements just imported `scipy` when we needed
`scipy.sparse`. Import order differences made this an occasional
bug. Fixes #252.
hunse added a commit that referenced this issue Nov 20, 2019
Some import statements just imported `scipy` when we needed
`scipy.sparse`. Import order differences made this an occasional
bug. Fixes #252.
@tbekolay tbekolay closed this in f5ae193 Nov 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
You can’t perform that action at this time.