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 'coo_array'

See original GitHub issue

🐛 Describe the bug

code: from torch_geometric.datasets import KarateClub dataset = KarateClub()

bug: Traceback (most recent call last): File “F:\study\python\test\test4pyg.py”, line 2, in <module> dataset = KarateClub() File “F:\anaconda\envs\ai\lib\site-packages\torch_geometric\datasets\karate.py”, line 50, in init adj = nx.to_scipy_sparse_array(G).tocoo() File “F:\anaconda\envs\ai\lib\site-packages\networkx\convert_matrix.py”, line 921, in to_scipy_sparse_array A = sp.sparse.coo_array((d, (r, c)), shape=(nlen, nlen), dtype=dtype) AttributeError: module ‘scipy.sparse’ has no attribute ‘coo_array’

Environment

  • PyG version:2.0.4
  • PyTorch versn:1.10.1
  • OS:windows10
  • Python version:3.9.7
  • CUDA/cuDNN version:CU113
  • How you installed PyTorch and PyG (conda, pip, source):conda
  • Any other relevant information (e.g., version of torch-scatter):
  • pytorch-scatter:2.0.9
  • pytorch-sparse:0.6.13
  • pytorch-spline-conv:1.2.1
  • pytorch-cluster:1.6.0

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:4
  • Comments:16 (3 by maintainers)

github_iconTop GitHub Comments

24reactions
Godofnothingcommented, Mar 31, 2022

coo_array appears only in scipy version 1.8.0

15reactions
rusty1scommented, Mar 30, 2022

Looks like this is a version conflict between networkx and scipy. Can you upgrade both to see if this resolves your issues?

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 >
module 'scipy.sparse' has no attribute 'coo_array'
Hi,. sometimes when I use draw_networkx it returns the error in the object. For example in an ipynb I receive the following: nx.draw_networkx(...
Read more >
scipy.sparse.coo_array — SciPy v1.9.3 Manual
COO is a fast format for constructing sparse arrays · Once a array has been constructed, convert to CSR or CSC format for...
Read more >
Source code for sparse.coo - PyData/Sparse
It depends on NumPy and Scipy.sparse for computation, but supports arrays of ... the order of the dimensions of any :obj:`COO` array with...
Read more >
AttributeError:模块'scipy.sparse'没有属性'coo_array' (module ...
AttributeError :模块'scipy.sparse'没有属性'coo_array' (module 'scipy.sparse' has no attribute 'coo_array'). _Jesse_ 已于 2022-06-05 12:30:59 修改 6836 收藏 ...
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