<h4 dir="auto">Reproducing code example:</h4>
<p dir="auto">scipy test fails</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; import scipy

&gt;&gt;&gt; scipy.test()"><pre class="notranslate"><code class="notranslate">&gt;&gt;&gt; import scipy

&gt;&gt;&gt; scipy.test()
</code></pre></div>
<h4 dir="auto">Error message:</h4>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="=================================== FAILURES ===================================
____________________________ test_tolerance_float32 ____________________________

    @pytest.mark.xfail(platform.machine() == 'ppc64le',
                       reason=&quot;fails on ppc64le&quot;)
    def test_tolerance_float32():
        &quot;&quot;&quot;Check lobpcg for attainable tolerance in float32.
        &quot;&quot;&quot;
        np.random.seed(1234)
        n = 50
        m = 3
        vals = -np.arange(1, n + 1)
        A = diags([vals], [0], (n, n))
        A = A.astype(np.float32)
        X = np.random.randn(n, m)
        X = X.astype(np.float32)
        eigvals, _ = lobpcg(A, X, tol=1e-9, maxiter=50, verbosityLevel=0)
&gt;       assert_allclose(eigvals, -np.arange(1, 1 + m), atol=1e-5)
E       AssertionError: 
E       Not equal to tolerance rtol=1e-07, atol=1e-05
E       
E       Mismatched elements: 1 / 3 (33.3%)
E       Max absolute difference: 0.01461172
E       Max relative difference: 0.00487057
E        x: array([-1.      , -1.999997, -3.014612], dtype=float32)
E        y: array([-1, -2, -3])

A          = &lt;50x50 sparse matrix of type '&lt;class 'numpy.float32'&gt;'
	with 50 stored elements (1 diagonals) in DIAgonal format&gt;
X          = array([[ 4.71435159e-01, -1.19097567e+00,  1.43270695e+00],
       [-3.12651902e-01, -7.20588744e-01,  8.87162924e-01]...241e+00, -5.24336100e-01,  7.00907707e-01],
       [ 9.84188080e-01, -1.21728405e-01,  2.36576867e+00]], dtype=float32)
_          = array([[-1.00000000e+00,  2.00615219e-12, -2.44451428e-08],
       [ 1.97884764e-12,  1.00000012e+00, -7.59038812e-07]...590e-08, -1.29014893e-07, -3.75821907e-03],
       [ 7.36326111e-09,  1.62651048e-08,  1.63773284e-03]], dtype=float32)
eigvals    = array([-1.       , -1.9999971, -3.0146117], dtype=float32)
m          = 3
n          = 50
vals       = array([ -1,  -2,  -3,  -4,  -5,  -6,  -7,  -8,  -9, -10, -11, -12, -13,
       -14, -15, -16, -17, -18, -19, -20, -21,..., -29, -30, -31, -32, -33, -34, -35, -36, -37, -38, -39,
       -40, -41, -42, -43, -44, -45, -46, -47, -48, -49, -50])

lib/python3.8/site-packages/scipy/sparse/linalg/eigen/lobpcg/tests/test_lobpcg.py:288: AssertionError
=========================== short test summary info ============================
FAILED lib/python3.8/site-packages/scipy/sparse/linalg/eigen/lobpcg/tests/test_lobpcg.py::test_tolerance_float32
= 1 failed, 19510 passed, 1332 skipped, 10954 deselected, 78 xfailed, 7 xpassed in 370.28s (0:06:10) =
False
"><pre class="notranslate"><code class="notranslate">=================================== FAILURES ===================================
____________________________ test_tolerance_float32 ____________________________

    @pytest.mark.xfail(platform.machine() == 'ppc64le',
                       reason="fails on ppc64le")
    def test_tolerance_float32():
        """Check lobpcg for attainable tolerance in float32.
        """
        np.random.seed(1234)
        n = 50
        m = 3
        vals = -np.arange(1, n + 1)
        A = diags([vals], [0], (n, n))
        A = A.astype(np.float32)
        X = np.random.randn(n, m)
        X = X.astype(np.float32)
        eigvals, _ = lobpcg(A, X, tol=1e-9, maxiter=50, verbosityLevel=0)
&gt;       assert_allclose(eigvals, -np.arange(1, 1 + m), atol=1e-5)
E       AssertionError: 
E       Not equal to tolerance rtol=1e-07, atol=1e-05
E       
E       Mismatched elements: 1 / 3 (33.3%)
E       Max absolute difference: 0.01461172
E       Max relative difference: 0.00487057
E        x: array([-1.      , -1.999997, -3.014612], dtype=float32)
E        y: array([-1, -2, -3])

A          = &lt;50x50 sparse matrix of type '&lt;class 'numpy.float32'&gt;'
	with 50 stored elements (1 diagonals) in DIAgonal format&gt;
X          = array([[ 4.71435159e-01, -1.19097567e+00,  1.43270695e+00],
       [-3.12651902e-01, -7.20588744e-01,  8.87162924e-01]...241e+00, -5.24336100e-01,  7.00907707e-01],
       [ 9.84188080e-01, -1.21728405e-01,  2.36576867e+00]], dtype=float32)
_          = array([[-1.00000000e+00,  2.00615219e-12, -2.44451428e-08],
       [ 1.97884764e-12,  1.00000012e+00, -7.59038812e-07]...590e-08, -1.29014893e-07, -3.75821907e-03],
       [ 7.36326111e-09,  1.62651048e-08,  1.63773284e-03]], dtype=float32)
eigvals    = array([-1.       , -1.9999971, -3.0146117], dtype=float32)
m          = 3
n          = 50
vals       = array([ -1,  -2,  -3,  -4,  -5,  -6,  -7,  -8,  -9, -10, -11, -12, -13,
       -14, -15, -16, -17, -18, -19, -20, -21,..., -29, -30, -31, -32, -33, -34, -35, -36, -37, -38, -39,
       -40, -41, -42, -43, -44, -45, -46, -47, -48, -49, -50])

lib/python3.8/site-packages/scipy/sparse/linalg/eigen/lobpcg/tests/test_lobpcg.py:288: AssertionError
=========================== short test summary info ============================
FAILED lib/python3.8/site-packages/scipy/sparse/linalg/eigen/lobpcg/tests/test_lobpcg.py::test_tolerance_float32
= 1 failed, 19510 passed, 1332 skipped, 10954 deselected, 78 xfailed, 7 xpassed in 370.28s (0:06:10) =
False

</code></pre></div>
<p dir="auto">After running test, I exited python and got these</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; exit()

 Normal return from subroutine COBYLA

 NFVALS =   50   F = 2.485185E+01    MAXCV = 1.999965E-10
   X = 4.955358E+00   6.666553E-01

 NNLS quitting on iteration count."><pre class="notranslate"><code class="notranslate">&gt;&gt;&gt; exit()

 Normal return from subroutine COBYLA

 NFVALS =   50   F = 2.485185E+01    MAXCV = 1.999965E-10
   X = 4.955358E+00   6.666553E-01

 NNLS quitting on iteration count.
</code></pre></div>
<h4 dir="auto">Scipy/Numpy/Python version information:</h4>
<p dir="auto">scipy 1.4.1<br>
numpy 1.18.4<br>
python 3.8.2</p>
<p dir="auto">OS ubuntu 16.04, python installed from source.</p>
<p dir="auto"><em>Original ticket <a href="http://projects.scipy.org/scipy/ticket/1314" rel="nofollow">http://projects.scipy.org/scipy/ticket/1314</a> on 2010-10-18 by trac user markMiscavage, assigned to <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/wnbell/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/wnbell">@wnbell</a>.</em></p>
<p dir="auto">I have this bug in a larger program but I've narrowed it down to a script consisting of just :</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import sys
import scipy.sparse.sparsetools
sys.exit(&quot;EXIT&quot;)"><pre class="notranslate"><code class="notranslate">import sys
import scipy.sparse.sparsetools
sys.exit("EXIT")
</code></pre></div>
<p dir="auto">This will always exit with code 0. It seems it is the .pyd files in the sparsetools folder that are the source of this problem. I have the same problem in both 0.7.1 and 0.8.0 builds of scipy. I am using python 2.6 on a Windows 7 - 64 bit system.</p>