Issue 1:
The following code fails with an error (numpy.linalg.LinAlgError: SVD did not converge). This occurs if:

there is this unused import (import scipy.linalg)

a modulo operation is performed (x1 % 2)

This is unexpcected to me, because the modulo operation shouldn't have any side effects, but even copying the vector won't help.

Another interesting observation is that only the first excecution of np.random.multivariate_normal fails. As a workaround I could just catch the first exception and run it again:

try:
sample = np.random.multivariate_normal(np.zeros(len(points)), cov)
except np.linalg.LinAlgError as e:
print("First try failed:", e)
sample = np.random.multivariate_normal(np.zeros(len(points)), cov)

I was able to reproduce this error another windows pc with anaconda python, but not on linux.

Reproducing code example:

import numpy as np
# this unused import is important to reproduce the weird side effect of modulo calculation
import scipy.linalg

def k(x1, x2):
base = np.pi * (x1[:, None, :] - x2[None, :, :])
exp_dist = np.exp(-0.5 * np.sum(np.square(np.sin(base)), axis=-1))

# the following statement shouldn't have any side effects
x1 % 2
#np.mod(x1, 2)
#np.mod(x1.copy(), 2)

return exp_dist

n = 10
points = np.atleast_2d(np.linspace(0, 360, 10)).T
cov = k(points, points)
np.random.multivariate_normal(np.zeros(len(points)), cov)

Error message:

Traceback (most recent call last):
File "C:\Users\user\PycharmProjects\fg-localization\other\weird_behavior.py", line 21, in <module>
np.random.multivariate_normal(np.zeros(len(points)), cov)
File "mtrand.pyx", line 4084, in numpy.random.mtrand.RandomState.multivariate_normal
File "C:\Users\user\Anaconda3\envs\fg-localization\lib\site-packages\scipy\linalg\decomp_svd.py", line 132, in svd
raise LinAlgError("SVD did not converge")
numpy.linalg.LinAlgError: SVD did not converge

Numpy/Python version information:

Fails on windows with:

1.19.1 3.7.6 (default, Jan 8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)]

Runs on linux with:

1.19.1 3.6.9 (default, Jul 17 2020, 12:50:27)
[GCC 8.4.0]

Issue 2:
Tests are failing:

FAILED ....\lib\tests\test_regression.py::TestRegression::test_polyfit_build - numpy.linalg.LinAlgError: SVD did not...

FAILED ....\linalg\tests\test_regression.py::TestRegression::test_eig_build - numpy.linalg.LinAlgError: Eigenvalues ...

FAILED ....\ma\tests\test_extras.py::TestPolynomial::test_polyfit - numpy.linalg.LinAlgError: SVD did not converge i...

with exceptions:

err = 'invalid value', flag = 8
def _raise_linalgerror_lstsq(err, flag):
> raise LinAlgError("SVD did not converge in Linear Least Squares")
E numpy.linalg.LinAlgError: SVD did not converge in Linear Least Squares
err = 'invalid value'
flag = 8

and

err = 'invalid value', flag = 8
def _raise_linalgerror_eigenvalues_nonconvergence(err, flag):
> raise LinAlgError("Eigenvalues did not converge")
E numpy.linalg.LinAlgError: Eigenvalues did not converge
err = 'invalid value'
flag = 8

Steps taken:

Create a VM

Install latest Windows 10 and update to the latest version 2004 (10.0.19041)

Install Python 3.8.3

pip install pytest

pip install numpy

pip install hypothesis

run tests in the package

Same happens issue happens when running on tests in the repository.

Version 1.19.0 of numpy

Am I missing any dependencies? Or is it just Windows going bonkers?