lightning-viz / lightning-example-notebooks

Example Jupyter notebooks of lightning visualizations
http://mybinder.org/repo/lightning-viz/lightning-example-notebooks
MIT License
56 stars 27 forks source link

force-ipython notebook - AttributeError: 'matrix' object has no attribute 'todense' #1

Open micahstubbs opened 9 years ago

micahstubbs commented 9 years ago

screen shot 2015-02-06 at 16 12 53

micahstubbs commented 9 years ago

the docs for todense()

http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.sparse.coo_matrix.todense.html

screen shot 2015-02-06 at 16 19 19

freeman-lab commented 9 years ago

What version of networkx do you have? You can check by

import networkx as nx
nx.__version__

With v1.9.1, the example runs fine, and the output of nx.adjacency_matrix(G) appears to be a sparse matrix, whereas the error you see implies it is a normal numpy matrix. A tricky thing with notebooks is that you can't force required versions of libraries used, but we could specify a version requirement for this notebook for networkx if that's indeed the issue.

micahstubbs commented 9 years ago

'1.7'

micahstubbs commented 9 years ago

I ran

$ pip install networkx --upgrade

after that I show version

'1.9.1'

micahstubbs commented 9 years ago

after upgrading networkx from version '1.7' that came with my Anaconda distribution to '1.9.1' it works!

screen shot 2015-03-22 at 18 53 56

micahstubbs commented 9 years ago

// could specify a version requirement for this notebook for networkx

this looks like a good idea.