Issue 1:
When using scipy.signal.savgol_filter, the filter will randomly throw an error. It usually happens after 6 calls to savgol_filter. I was not able to get a reproducing code unfortunately :( (I mean I have my huge code that replicates the issue, but I can't reduce this to a snipnet.)

The error comes after a fixed number of calls to savgol_filter but calling them in a snipnet doesn't work. (It has to be in my code somehow)

Using a debugger, I can call lapack_func(a1, b1, lwork, iwork, cond, False, False) after the error occurs. It will fail the first time but subsequent calls with the same parameter will suceed.

I can fix the issue by adding in scipy\linalg\basic.py a second call to lapack_func:

x, s, rank, info = lapack_func(a1, b1, lwork,
iwork, cond, False, False)
if info != 0:
x, s, rank, info = lapack_func(a1, b1, lwork,
iwork, cond, False, False)

What could I possibly do that would make lapack_func return different results for the same parameters? (the parameters are):

IPdb [3]: a1, b1, lwork, iwork, cond
(array([[ 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1.],
[ 25., 24., 23., 22., 21., 20., 19., 18., 17., 16., 15.,
14., 13., 12., 11., 10., 9., 8., 7., 6., 5., 4.,
3., 2., 1., 0., -1., -2., -3., -4., -5., -6., -7.,
-8., -9., -10., -11., -12., -13., -14., -15., -16., -17., -18.,
-19., -20., -21., -22., -23., -24., -25.]]), array([1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]), 808, 22, 2.220446049250313e-16)

What happens is:

I run the code. After 6 calls to savgol_filter, I get:

File "C:\Users\Quentin.Peter\AppData\Local\Continuum\anaconda3\lib\site-packages\scipy\signal\_savitzky_golay.py", line 335, in savgol_filter
coeffs = savgol_coeffs(window_length, polyorder, deriv=deriv, delta=delta)

File "C:\Users\Quentin.Peter\AppData\Local\Continuum\anaconda3\lib\site-packages\scipy\signal\_savitzky_golay.py", line 137, in savgol_coeffs
coeffs, _, _, _ = lstsq(A, y)

File "C:\Users\Quentin.Peter\AppData\Local\Continuum\anaconda3\lib\site-packages\scipy\linalg\basic.py", line 1228, in lstsq
% (-info, lapack_driver))

ValueError: illegal value in 4-th argument of internal None

Trying to use lstsq after that leads to:

Traceback (most recent call last):

File "C:\Users\Quentin.Peter\OneDrive - Fluidic Analytics\Desktop\untitled4.py", line 59, in <module>
lstsq(A, y)

File "C:\Users\Quentin.Peter\AppData\Local\Continuum\anaconda3\lib\site-packages\scipy\linalg\basic.py", line 1224, in lstsq
raise LinAlgError("SVD did not converge in Linear Least Squares")

LinAlgError: SVD did not converge in Linear Least Squares

Any repeat after that will work.

Scipy/Numpy/Python version information:

1.5.3 1.19.1 sys.version_info(major=3, minor=7, micro=6, releaselevel='final', serial=0)

PS: The calls to lstsq are as follow but this doesn't trigger the bug:

import numpy as np
from scipy.linalg import lstsq

A = np.asarray([
np.fromstring("""1.000e+00 1.000e+00 1.000e+00 1.000e+00 1.000e+00 1.000e+00
1.000e+00 1.000e+00 1.000e+00 1.000e+00 1.000e+00 1.000e+00
1.000e+00 1.000e+00 1.000e+00 1.000e+00 1.000e+00 1.000e+00
1.000e+00 1.000e+00 1.000e+00 1.000e+00 1.000e+00 1.000e+00
1.000e+00 1.000e+00 1.000e+00 1.000e+00 1.000e+00 1.000e+00
1.000e+00 1.000e+00 1.000e+00 1.000e+00 1.000e+00 1.000e+00
1.000e+00 1.000e+00 1.000e+00 1.000e+00 1.000e+00 1.000e+00
1.000e+00 1.000e+00 1.000e+00 1.000e+00 1.000e+00 1.000e+00
1.000e+00 1.000e+00 1.000e+00 1.000e+00 1.000e+00 1.000e+00
1.000e+00 1.000e+00 1.000e+00 1.000e+00 1.000e+00 1.000e+00
1.000e+00 1.000e+00 1.000e+00 1.000e+00 1.000e+00 1.000e+00
1.000e+00 1.000e+00 1.000e+00 1.000e+00 1.000e+00 1.000e+00
1.000e+00 1.000e+00 1.000e+00 1.000e+00 1.000e+00 1.000e+00
1.000e+00 1.000e+00 1.000e+00 1.000e+00 1.000e+00 1.000e+00
1.000e+00 1.000e+00 1.000e+00 1.000e+00 1.000e+00 1.000e+00
1.000e+00 1.000e+00 1.000e+00 1.000e+00 1.000e+00 1.000e+00
1.000e+00""", sep=' '),
np.fromstring("""4.800e+01 4.700e+01 4.600e+01 4.500e+01 4.400e+01 4.300e+01
4.200e+01 4.100e+01 4.000e+01 3.900e+01 3.800e+01 3.700e+01
3.600e+01 3.500e+01 3.400e+01 3.300e+01 3.200e+01 3.100e+01
3.000e+01 2.900e+01 2.800e+01 2.700e+01 2.600e+01 2.500e+01
2.400e+01 2.300e+01 2.200e+01 2.100e+01 2.000e+01 1.900e+01
1.800e+01 1.700e+01 1.600e+01 1.500e+01 1.400e+01 1.300e+01
1.200e+01 1.100e+01 1.000e+01 9.000e+00 8.000e+00 7.000e+00
6.000e+00 5.000e+00 4.000e+00 3.000e+00 2.000e+00 1.000e+00
0.000e+00 -1.000e+00 -2.000e+00 -3.000e+00 -4.000e+00 -5.000e+00
-6.000e+00 -7.000e+00 -8.000e+00 -9.000e+00 -1.000e+01 -1.100e+01
-1.200e+01 -1.300e+01 -1.400e+01 -1.500e+01 -1.600e+01 -1.700e+01
-1.800e+01 -1.900e+01 -2.000e+01 -2.100e+01 -2.200e+01 -2.300e+01
-2.400e+01 -2.500e+01 -2.600e+01 -2.700e+01 -2.800e+01 -2.900e+01
-3.000e+01 -3.100e+01 -3.200e+01 -3.300e+01 -3.400e+01 -3.500e+01
-3.600e+01 -3.700e+01 -3.800e+01 -3.900e+01 -4.000e+01 -4.100e+01
-4.200e+01 -4.300e+01 -4.400e+01 -4.500e+01 -4.600e+01 -4.700e+01
-4.800e+01""", sep=' '),
np.fromstring("""2.304e+03 2.209e+03 2.116e+03 2.025e+03 1.936e+03 1.849e+03
1.764e+03 1.681e+03 1.600e+03 1.521e+03 1.444e+03 1.369e+03
1.296e+03 1.225e+03 1.156e+03 1.089e+03 1.024e+03 9.610e+02
9.000e+02 8.410e+02 7.840e+02 7.290e+02 6.760e+02 6.250e+02
5.760e+02 5.290e+02 4.840e+02 4.410e+02 4.000e+02 3.610e+02
3.240e+02 2.890e+02 2.560e+02 2.250e+02 1.960e+02 1.690e+02
1.440e+02 1.210e+02 1.000e+02 8.100e+01 6.400e+01 4.900e+01
3.600e+01 2.500e+01 1.600e+01 9.000e+00 4.000e+00 1.000e+00
0.000e+00 1.000e+00 4.000e+00 9.000e+00 1.600e+01 2.500e+01
3.600e+01 4.900e+01 6.400e+01 8.100e+01 1.000e+02 1.210e+02
1.440e+02 1.690e+02 1.960e+02 2.250e+02 2.560e+02 2.890e+02
3.240e+02 3.610e+02 4.000e+02 4.410e+02 4.840e+02 5.290e+02
5.760e+02 6.250e+02 6.760e+02 7.290e+02 7.840e+02 8.410e+02
9.000e+02 9.610e+02 1.024e+03 1.089e+03 1.156e+03 1.225e+03
1.296e+03 1.369e+03 1.444e+03 1.521e+03 1.600e+03 1.681e+03
1.764e+03 1.849e+03 1.936e+03 2.025e+03 2.116e+03 2.209e+03
2.304e+03""", sep=' ')
])

y = np.asarray([1., 0., 0.])
lstsq(A, y)

A = np.asarray([
np.fromstring(""" 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.
1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.
1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.
1. 1. 1. 1. 1. 1. 1. 1. 1.""", sep=' '),
np.fromstring("""25. 24. 23. 22. 21. 20. 19. 18. 17. 16. 15. 14. 13. 12.
11. 10. 9. 8. 7. 6. 5. 4. 3. 2. 1. 0. -1. -2.
-3. -4. -5. -6. -7. -8. -9. -10. -11. -12. -13. -14. -15. -16.
-17. -18. -19. -20. -21. -22. -23. -24. -25.""", sep=' ')
])

y = np.asarray([1., 0.])
lstsq(A, y)

A = np.asarray([
np.fromstring(""" 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.
1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.
1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.
1. 1. 1. 1. 1. 1. 1. 1. 1.""", sep=' '),
np.fromstring(""" 25. 24. 23. 22. 21. 20. 19. 18. 17. 16. 15. 14. 13. 12.
11. 10. 9. 8. 7. 6. 5. 4. 3. 2. 1. 0. -1. -2.
-3. -4. -5. -6. -7. -8. -9. -10. -11. -12. -13. -14. -15. -16.
-17. -18. -19. -20. -21. -22. -23. -24. -25.""", sep=' ')
])

y = np.asarray([1., 0.])
lstsq(A, y)

A = np.asarray([
np.fromstring(""" 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.
1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.
1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.
1. 1. 1. 1. 1. 1. 1. 1. 1.""", sep=' '),
np.fromstring("""25. 24. 23. 22. 21. 20. 19. 18. 17. 16. 15. 14. 13. 12.
11. 10. 9. 8. 7. 6. 5. 4. 3. 2. 1. 0. -1. -2.
-3. -4. -5. -6. -7. -8. -9. -10. -11. -12. -13. -14. -15. -16.
-17. -18. -19. -20. -21. -22. -23. -24. -25.""", sep=' ')
])

y = np.asarray([1., 0.])
lstsq(A, y)

A = np.asarray([
np.fromstring(""" 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.
1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.
1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.
1. 1. 1. 1. 1. 1. 1. 1. 1.""", sep=' '),
np.fromstring("""25. 24. 23. 22. 21. 20. 19. 18. 17. 16. 15. 14. 13. 12.
11. 10. 9. 8. 7. 6. 5. 4. 3. 2. 1. 0. -1. -2.
-3. -4. -5. -6. -7. -8. -9. -10. -11. -12. -13. -14. -15. -16.
-17. -18. -19. -20. -21. -22. -23. -24. -25.""", sep=' ')
])
y = np.asarray([1., 0.])
lstsq(A, y)

A = np.asarray([
np.fromstring(""" 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.
1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.
1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.
1. 1. 1. 1. 1. 1. 1. 1. 1.""", sep=' '),
np.fromstring("""25. 24. 23. 22. 21. 20. 19. 18. 17. 16. 15. 14. 13. 12.
11. 10. 9. 8. 7. 6. 5. 4. 3. 2. 1. 0. -1. -2.
-3. -4. -5. -6. -7. -8. -9. -10. -11. -12. -13. -14. -15. -16.
-17. -18. -19. -20. -21. -22. -23. -24. -25.""", sep=' ')
])
y = np.asarray([1., 0.])
lstsq(A, y)

Issue 2:
From @opoplawski: With Fedora Rawhide (but not Fedora 19) I'm seeing:

ERROR: test_fitpack.TestSplder.test_kink
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File
"/builddir/build/BUILDROOT/scipy-0.13.0-0.1.b1.fc21.x86_64/usr/lib64/python2.7/site-packages/scipy/interpolate/tests/test_fitpack.py",
line 326, in test_kink
splder(spl2, 2) # Should work
File
"/builddir/build/BUILDROOT/scipy-0.13.0-0.1.b1.fc21.x86_64/usr/lib64/python2.7/site-packages/scipy/interpolate/fitpack.py",
line 1186, in splder
"and is not differentiable %d times") % n)
ValueError: The spline has internal repeated knots and is not differentiable 2
times

and the same with python3.