gensim icon indicating copy to clipboard operation
gensim copied to clipboard

Deprecation Warning for sparsetools namespace

Open mark-todd opened this issue 2 years ago • 2 comments
trafficstars

I'm receiving a deprecation warning when using gensim within pytest. It's related to this issue https://github.com/RaRe-Technologies/gensim/issues/3014, but now with hopefully a much simpler solution.

DeprecationWarning: Please use `csc_matvecs` from the `scipy.sparse` namespace, the `scipy.sparse.sparsetools` namespace is deprecated.

Referencing here: https://github.com/RaRe-Technologies/gensim/blob/develop/gensim/models/lsimodel.py#LL69C1-L69C37

The latest deprecation warning now says to just change the import location, so should be very easy to resolve by changing:

from scipy.sparse import sparsetools

to

from scipy.sparse import csc_matvecs

Then updating references to csc_matvecs

mark-todd avatar Jun 12 '23 15:06 mark-todd

Great! Can you test this out please & open a PR? Thanks.

piskvorky avatar Jun 12 '23 15:06 piskvorky

Just tested but sadly the csc_matvecs functions only exists in sparsetools - the deprecation message was autogenerated and incorrect. However, the message can be removed by importing from _sparsetools instead of sparsetools

mark-todd avatar Jun 12 '23 16:06 mark-todd