scipy: BUG: NumPy`DeprecationWarning`s triggered by SciPy without causing test failures

Describe your issue.

The attached code causes NumPy 1.25 to raise a DeprecationWarning.

Reproducing Code Example

Reproduce with PYTHONWARNINGS=all python script.py, or PYTHONWARNINGS=all python dev.py python /tmp/normaltest_warning.py.

import numpy as np
import scipy as sp
sp.stats.normaltest(np.linspace(0, 10, 10000))

Error message

/home/stefan/src/scipy/build-install/lib64/python3.11/site-packages/scipy/stats/_stats_py.py:1070: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

SciPy/NumPy/Python version and system information

Latest SciPy, NumPy 1.25

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 1
  • Comments: 28 (28 by maintainers)

Most upvoted comments

The stats portion of this issue is resolved, so I’ll change the title accordingly. What remains is the interpolate and optimize occurrences of this DeprecationWarning and to ensure that all DeprecationWarnings cause tests to fail. I think @tirthasheshpatel was interested.

#19054 fixes the cobyla aspects of the issue.