Skip to content

Conversation

covertg
Copy link
Contributor

@covertg covertg commented Feb 7, 2023

Motivation for these changes

Scipy versions after 1.8 deprecated a bunch of namespaces in order to clarify the intended public namespaces: https://docs.scipy.org/doc/scipy/release.1.8.0.html

Turns out that the annotation on sparse.basic.as_symbolic_sparse accesses a "private" scipy namespace, so importing pytensor when a newer scipy is installed will yield the following warning.

>>> import scipy, warnings
>>> scipy.__version__
'1.10.0'
>>> warnings.resetwarnings()
>>> import pytensor
/home/cove/pytensor/pytensor/sparse/basic.py:132: DeprecationWarning: Please use `spmatrix` from the `scipy.sparse` namespace, the `scipy.sparse.base` namespace is deprecated.
  @_as_symbolic.register(scipy.sparse.base.spmatrix)

Not a big deal (and numba-scipy currently requires scipy<=1.7.3), but newer scipy happened to be installed on my system and this had been bugging me. :D

Checklist

(Not much more to note, pretty simple!)

@codecov-commenter
Copy link

Codecov Report

Merging #214 (3c8cde2) into main (aa7ce08) will not change coverage.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #214   +/-   ##
=======================================
  Coverage   80.08%   80.08%           
=======================================
  Files         170      170           
  Lines       45260    45260           
  Branches     9631     9631           
=======================================
  Hits        36245    36245           
  Misses       6797     6797           
  Partials     2218     2218           
Impacted Files Coverage Δ
pytensor/sparse/basic.py 82.54% <100.00%> (ø)

Copy link
Member

@ricardoV94 ricardoV94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I was also bugged by it

@ricardoV94 ricardoV94 merged commit d7ffee8 into pymc-devs:main Feb 8, 2023
@ricardoV94 ricardoV94 changed the title Fix DeprecationWarning from scipy.sparse.base Fix DeprecationWarning from scipy.sparse.base Feb 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants