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.

lil_matrix construction raises FutureWarning (numpy #12609)

See original GitHub issue

Description

Constructing a scipy.sparse.lil_matrix in sparsify_rows raises a Lil Warnin’*

/Users/vl238/miniconda3/envs/gl/lib/python3.7/site-packages/scipy/sparse/lil.py:504: FutureWarning: future versions will not create a writeable array from broadcast_array. Set the writable flag explicitly to avoid this warning.
  if not i.flags.writeable or i.dtype not in (np.int32, np.int64):

Dependency chain:

NB: there is another use case of lil_matrix in librosa.segment.recurrence_to_lag. Not sure if it is affected.

Steps/Code to Reproduce

Found during CR of #934.

Versions

Darwin-18.6.0-x86_64-i386-64bit
Python 3.7.3 (default, Mar 27 2019, 16:54:48) 
[Clang 4.0.1 (tags/RELEASE_401/final)]
NumPy 1.17.0
SciPy 1.3.0
librosa 0.7.0

*pun intended: https://www.youtube.com/watch?v=5_Mtgo9WOL0

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
bmcfeecommented, Aug 9, 2019

It looks like scipy 1.3.1 has fixed this one for us: https://github.com/scipy/scipy/pull/10379

1reaction
lostanlencommented, Aug 7, 2019

I tried to create a separate conda environment with latest master branches of numpy, scipy, and librosa, in order to see if the warning would disappear. I would guess that it would, in the wake of scipy/scipy#10379. But i did not succeed in installing scipy from source.

 scipy/fft/_pocketfft/pypocketfft.cxx:15:10: fatal error: 'pybind11/pybind11.h' file not found

I don’t know why this happens.

Read more comments on GitHub >

github_iconTop Results From Across the Web

scipy.sparse.lil_matrix — SciPy v1.9.3 Manual
This is a structure for constructing sparse matrices incrementally. Note that inserting a single item can take linear time in the worst case;...
Read more >
creating a scipy.lil_matrix using a python generator efficiently
To recap, my question is: What is the most efficient way to create a scipy.sparse matrix from a python generator or numpy single...
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