Repository navigation
Description
Nixpkgs version
- Stable (26.05)
Steps to reproduce
Building python313Packages.scipy will fail on testing TestSTFT::test_roundtrip_scaling, TestDerivative::test_initial_step[numpy], TestLinprogIPDense::test_bug_6139 and TestLinprogIPSparsePresolve::test_bug_6139 when nixpkgs.hostPlatform.gcc.{arch,tune} is znver5.
Can Hydra reproduce this build failure?
Hydra doesn’t try to build the package.
Link to Hydra build job
No response
Relevant log output
=================================== FAILURES ===================================
_______________________ TestSTFT.test_roundtrip_scaling ________________________
[gw6] linux -- Python 3.13.13 /nix/store/f0vg9zspc33r171yzqln6lyxbb14mb17-python3-3.13.13/bin/python3.13
self = <scipy.signal.tests.test_spectral.TestSTFT object at 0x7fffb5359ff0>
def test_roundtrip_scaling(self):
"""Verify behavior of scaling parameter. """
# Create 1024 sample cosine signal with amplitude 2:
X = np.zeros(513, dtype=complex)
X[256] = 1024
x = np.fft.irfft(X)
power_x = sum(x**2) / len(x) # power of signal x is 2
# Calculate magnitude-scaled STFT:
Zs = stft(x, boundary='even', scaling='spectrum')[2]
# Test round trip:
x1 = istft(Zs, boundary=True, scaling='spectrum')[1]
> assert_allclose(x1, x)
E AssertionError:
E Not equal to tolerance rtol=1e-07, atol=0
E
E Mismatched elements: 64 / 1024 (6.25%)
E First 5 mismatches are at indices:
E [897]: -4.963199601507357e-22 (ACTUAL), 0.0 (DESIRED)
E [899]: -1.03154061130407e-20 (ACTUAL), 0.0 (DESIRED)
E [901]: -2.930344625821113e-20 (ACTUAL), 0.0 (DESIRED)
E [903]: -4.868299587202298e-20 (ACTUAL), 0.0 (DESIRED)
E [905]: -9.098104213233174e-20 (ACTUAL), 0.0 (DESIRED)
E Max absolute difference among violations: 4.00410733e-17
E Max relative difference among violations: inf
E ACTUAL: array([ 2.000000e+00, 0.000000e+00, -2.000000e+00, ..., -1.224710e-18,
E -2.000000e+00, 5.439144e-19], shape=(1024,))
E DESIRED: array([ 2., 0., -2., ..., 0., -2., 0.], shape=(1024,))
lib/python3.13/site-packages/scipy/signal/tests/test_spectral.py:2047: AssertionError
___________________ TestDerivative.test_initial_step[numpy] ____________________
[gw0] linux -- Python 3.13.13 /nix/store/f0vg9zspc33r171yzqln6lyxbb14mb17-python3-3.13.13/bin/python3.13
self = <scipy.differentiate.tests.test_differentiate.TestDerivative object at 0x7fffbea55400>
xp = <module 'scipy._lib.array_api_compat.numpy' from '/nix/store/q75x6v2zj8kfkbmbm0ld5vxqcq3kdh3s-python3.13-scipy-1.17.1/lib/python3.13/site-packages/scipy/_lib/array_api_compat/numpy/__init__.py'>
def test_initial_step(self, xp):
# Test that `initial_step` works as expected and is vectorized
def f(x):
return xp.exp(x)
x = xp.asarray(0., dtype=xp.float64)
step_direction = xp.asarray([-1, 0, 1])
h0 = xp.reshape(xp.logspace(-3, 0, 10), (-1, 1))
res = derivative(f, x, initial_step=h0, order=2, maxiter=1,
step_direction=step_direction)
err = xp.abs(res.df - f(x))
# error should be smaller for smaller step sizes
assert xp.all(err[:-1, ...] < err[1:, ...])
# results of vectorized call should match results with
# initial_step taken one at a time
for i in range(h0.shape[0]):
ref = derivative(f, x, initial_step=h0[i, 0], order=2, maxiter=1,
step_direction=step_direction)
> xp_assert_close(res.df[i, :], ref.df, rtol=1e-14)
E AssertionError:
E Not equal to tolerance rtol=1e-14, atol=0
E
E Mismatched elements: 1 / 3 (33.3%)
E Mismatch at index:
E [2]: 0.9999994524803824 (ACTUAL), 0.99999945247997 (DESIRED)
E Max absolute difference among violations: 4.12336831e-13
E Max relative difference among violations: 4.12337057e-13
E ACTUAL: array([0.999999, 1.000001, 0.999999])
E DESIRED: array([0.999999, 1.000001, 0.999999])
lib/python3.13/site-packages/scipy/differentiate/tests/test_differentiate.py:258: AssertionError
______________________ TestLinprogIPSparse.test_bug_6139 _______________________
[gw1] linux -- Python 3.13.13 /nix/store/f0vg9zspc33r171yzqln6lyxbb14mb17-python3-3.13.13/bin/python3.13
self = <scipy.optimize.tests.test_linprog.TestLinprogIPSparse object at 0x7fffb8dd8cd0>
@pytest.mark.skipif(
sys.platform == 'darwin',
reason="Fails on macOS x86 Accelerate builds (gh-20510)"
)
@pytest.mark.xfail_on_32bit("This test is sensitive to machine epsilon level "
"perturbations in linear system solution in "
"_linprog_ip._sym_solve.")
def test_bug_6139(self):
> super().test_bug_6139()
lib/python3.13/site-packages/scipy/optimize/tests/test_linprog.py:2091:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
lib/python3.13/site-packages/scipy/optimize/tests/test_linprog.py:1371: in test_bug_6139
_assert_success(res, desired_fun=14.95,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
res = message: The solution does not satisfy the constraints within the required tolerance of 3.16E-04, yet no errors were ...port.
success: False
status: 4
fun: 14.949999999740342
x: [ 5.000e+00 4.950e+00 5.000e+00]
nit: 5
desired_fun = 14.95, desired_x = array([5. , 4.95, 5. ]), rtol = 1e-08
atol = 1e-08
def _assert_success(res, desired_fun=None, desired_x=None,
rtol=1e-8, atol=1e-8):
# res: linprog result object
# desired_fun: desired objective function value or None
# desired_x: desired solution or None
if not res.success:
msg = f"linprog status {res.status}, message: {res.message}"
> raise AssertionError(msg)
E AssertionError: linprog status 4, message: The solution does not satisfy the constraints within the required tolerance of 3.16E-04, yet no errors were raised and there is no certificate of infeasibility or unboundedness. Check whether the slack and constraint residuals are acceptable; if not, consider enabling presolve, adjusting the tolerance option(s), and/or using a different method. Please consider submitting a bug report.
lib/python3.13/site-packages/scipy/optimize/tests/test_linprog.py:69: AssertionError
__________________ TestLinprogIPSparsePresolve.test_bug_6139 ___________________
[gw1] linux -- Python 3.13.13 /nix/store/f0vg9zspc33r171yzqln6lyxbb14mb17-python3-3.13.13/bin/python3.13
self = <scipy.optimize.tests.test_linprog.TestLinprogIPSparsePresolve object at 0x7fffb8dd8f50>
@pytest.mark.skipif(
sys.platform == 'darwin',
reason="Fails on macOS x86 Accelerate builds (gh-20510)"
)
@pytest.mark.xfail_on_32bit("This test is sensitive to machine epsilon level "
"perturbations in linear system solution in "
"_linprog_ip._sym_solve.")
def test_bug_6139(self):
> super().test_bug_6139()
lib/python3.13/site-packages/scipy/optimize/tests/test_linprog.py:2151:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
lib/python3.13/site-packages/scipy/optimize/tests/test_linprog.py:1371: in test_bug_6139
_assert_success(res, desired_fun=14.95,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
res = message: The solution does not satisfy the constraints within the required tolerance of 3.16E-04, yet no errors were ...port.
success: False
status: 4
fun: 14.949999999740342
x: [ 5.000e+00 4.950e+00 5.000e+00]
nit: 5
desired_fun = 14.95, desired_x = array([5. , 4.95, 5. ]), rtol = 1e-08
atol = 1e-08
def _assert_success(res, desired_fun=None, desired_x=None,
rtol=1e-8, atol=1e-8):
# res: linprog result object
# desired_fun: desired objective function value or None
# desired_x: desired solution or None
if not res.success:
msg = f"linprog status {res.status}, message: {res.message}"
> raise AssertionError(msg)
E AssertionError: linprog status 4, message: The solution does not satisfy the constraints within the required tolerance of 3.16E-04, yet no errors were raised and there is no certificate of infeasibility or unboundedness. Check whether the slack and constraint residuals are acceptable; if not, consider enabling presolve, adjusting the tolerance option(s), and/or using a different method. Please consider submitting a bug report.
lib/python3.13/site-packages/scipy/optimize/tests/test_linprog.py:69: AssertionError
=============================== warnings summary ===============================
lib/python3.13/site-packages/scipy/conftest.py:175
lib/python3.13/site-packages/scipy/conftest.py:175
lib/python3.13/site-packages/scipy/conftest.py:175
lib/python3.13/site-packages/scipy/conftest.py:175
lib/python3.13/site-packages/scipy/conftest.py:175
lib/python3.13/site-packages/scipy/conftest.py:175
lib/python3.13/site-packages/scipy/conftest.py:175
lib/python3.13/site-packages/scipy/conftest.py:175
/nix/store/q75x6v2zj8kfkbmbm0ld5vxqcq3kdh3s-python3.13-scipy-1.17.1/lib/python3.13/site-packages/scipy/conftest.py:175: PytestUnknownMarkWarning: Unknown pytest.mark.array_api_backends - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
pytest.param(np, id='numpy', marks=pytest.mark.array_api_backends)
../f0vg9zspc33r171yzqln6lyxbb14mb17-python3-3.13.13/lib/python3.13/importlib/__init__.py:88
../f0vg9zspc33r171yzqln6lyxbb14mb17-python3-3.13.13/lib/python3.13/importlib/__init__.py:88
../f0vg9zspc33r171yzqln6lyxbb14mb17-python3-3.13.13/lib/python3.13/importlib/__init__.py:88
../f0vg9zspc33r171yzqln6lyxbb14mb17-python3-3.13.13/lib/python3.13/importlib/__init__.py:88
../f0vg9zspc33r171yzqln6lyxbb14mb17-python3-3.13.13/lib/python3.13/importlib/__init__.py:88
../f0vg9zspc33r171yzqln6lyxbb14mb17-python3-3.13.13/lib/python3.13/importlib/__init__.py:88
../f0vg9zspc33r171yzqln6lyxbb14mb17-python3-3.13.13/lib/python3.13/importlib/__init__.py:88
../f0vg9zspc33r171yzqln6lyxbb14mb17-python3-3.13.13/lib/python3.13/importlib/__init__.py:88
/nix/store/f0vg9zspc33r171yzqln6lyxbb14mb17-python3-3.13.13/lib/python3.13/importlib/__init__.py:88: DeprecationWarning: `scipy.odr` is deprecated as of version 1.17.0 and will be removed in SciPy 1.19.0. Please use `https://pypi.org/project/odrpack/` instead.
return _bootstrap._gcd_import(name[level:], package, level)
lib/python3.13/site-packages/scipy/signal/tests/test_bsplines.py:340
lib/python3.13/site-packages/scipy/signal/tests/test_bsplines.py:340
lib/python3.13/site-packages/scipy/signal/tests/test_bsplines.py:340
lib/python3.13/site-packages/scipy/signal/tests/test_bsplines.py:340
lib/python3.13/site-packages/scipy/signal/tests/test_bsplines.py:340
lib/python3.13/site-packages/scipy/signal/tests/test_bsplines.py:340
lib/python3.13/site-packages/scipy/signal/tests/test_bsplines.py:340
lib/python3.13/site-packages/scipy/signal/tests/test_bsplines.py:340
/nix/store/q75x6v2zj8kfkbmbm0ld5vxqcq3kdh3s-python3.13-scipy-1.17.1/lib/python3.13/site-packages/scipy/signal/tests/test_bsplines.py:340: PytestUnknownMarkWarning: Unknown pytest.mark.fail_asan - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
@pytest.mark.fail_asan
lib/python3.13/site-packages/scipy/stats/tests/test_axis_nan_policy.py: 102 warnings
/nix/store/dm9g04cgfmx8rrp6x9bhqmdrigshaclj-python3.13-numpy-2.4.4/lib/python3.13/site-packages/numpy/_core/fromnumeric.py:3824: RuntimeWarning: Mean of empty slice
return _methods._mean(a, axis=axis, dtype=dtype,
lib/python3.13/site-packages/scipy/stats/tests/test_axis_nan_policy.py: 79 warnings
/nix/store/q75x6v2zj8kfkbmbm0ld5vxqcq3kdh3s-python3.13-scipy-1.17.1/lib/python3.13/site-packages/scipy/stats/_stats_py.py:10654: SmallSampleWarning: One or more sample arguments is too small; all returned values will be NaN. See documentation for sample size requirements.
return gmean(x, weights=weights, axis=axis, keepdims=keepdims)
lib/python3.13/site-packages/scipy/stats/tests/test_axis_nan_policy.py::test_axis_nan_policy_fast[mixed-1-omit-boxcox_llf-args83-kwds83-1-1-False-<lambda>]
lib/python3.13/site-packages/scipy/stats/tests/test_axis_nan_policy.py::test_axis_nan_policy_fast[mixed-1-omit-boxcox_llf-args83-kwds83-1-1-False-<lambda>]
lib/python3.13/site-packages/scipy/stats/tests/test_axis_nan_policy.py::test_axis_nan_policy_fast[mixed-1-omit-boxcox_llf-args83-kwds83-1-1-False-<lambda>]
/nix/store/q75x6v2zj8kfkbmbm0ld5vxqcq3kdh3s-python3.13-scipy-1.17.1/lib/python3.13/site-packages/scipy/stats/tests/test_axis_nan_policy.py:77: SmallSampleWarning: One or more sample arguments is too small; all returned values will be NaN. See documentation for sample size requirements.
return stats._morestats._boxcox_llf(data, lmb=lmb, axis=axis)
lib/python3.13/site-packages/scipy/stats/tests/test_axis_nan_policy.py::test_axis_nan_policy_fast[mixed-1-omit-yeojohnson_llf-args84-kwds84-1-1-False-<lambda>]
lib/python3.13/site-packages/scipy/stats/tests/test_axis_nan_policy.py::test_axis_nan_policy_fast[mixed-1-omit-yeojohnson_llf-args84-kwds84-1-1-False-<lambda>]
lib/python3.13/site-packages/scipy/stats/tests/test_axis_nan_policy.py::test_axis_nan_policy_fast[mixed-1-omit-yeojohnson_llf-args84-kwds84-1-1-False-<lambda>]
/nix/store/q75x6v2zj8kfkbmbm0ld5vxqcq3kdh3s-python3.13-scipy-1.17.1/lib/python3.13/site-packages/scipy/stats/tests/test_axis_nan_policy.py:83: SmallSampleWarning: One or more sample arguments is too small; all returned values will be NaN. See documentation for sample size requirements.
return stats._morestats._yeojohnson_llf(data, lmb=lmb, axis=axis)
lib/python3.13/site-packages/scipy/stats/tests/test_qmc.py::TestUtils::test_geometric_discrepancy_mst_with_zero_distances
/nix/store/q75x6v2zj8kfkbmbm0ld5vxqcq3kdh3s-python3.13-scipy-1.17.1/lib/python3.13/site-packages/scipy/stats/tests/test_qmc.py:234: UserWarning: Sample contains duplicate points.
assert_allclose(qmc.geometric_discrepancy(sample, method='mst'), 0.5)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED lib/python3.13/site-packages/scipy/signal/tests/test_spectral.py::TestSTFT::test_roundtrip_scaling - AssertionError:
Not equal to tolerance rtol=1e-07, atol=0
Mismatched elements: 64 / 1024 (6.25%)
First 5 mismatches are at indices:
[897]: -4.963199601507357e-22 (ACTUAL), 0.0 (DESIRED)
[899]: -1.03154061130407e-20 (ACTUAL), 0.0 (DESIRED)
[901]: -2.930344625821113e-20 (ACTUAL), 0.0 (DESIRED)
[903]: -4.868299587202298e-20 (ACTUAL), 0.0 (DESIRED)
[905]: -9.098104213233174e-20 (ACTUAL), 0.0 (DESIRED)
Max absolute difference among violations: 4.00410733e-17
Max relative difference among violations: inf
ACTUAL: array([ 2.000000e+00, 0.000000e+00, -2.000000e+00, ..., -1.224710e-18,
-2.000000e+00, 5.439144e-19], shape=(1024,))
DESIRED: array([ 2., 0., -2., ..., 0., -2., 0.], shape=(1024,))
FAILED lib/python3.13/site-packages/scipy/differentiate/tests/test_differentiate.py::TestDerivative::test_initial_step[numpy] - AssertionError:
Not equal to tolerance rtol=1e-14, atol=0
Mismatched elements: 1 / 3 (33.3%)
Mismatch at index:
[2]: 0.9999994524803824 (ACTUAL), 0.99999945247997 (DESIRED)
Max absolute difference among violations: 4.12336831e-13
Max relative difference among violations: 4.12337057e-13
ACTUAL: array([0.999999, 1.000001, 0.999999])
DESIRED: array([0.999999, 1.000001, 0.999999])
FAILED lib/python3.13/site-packages/scipy/optimize/tests/test_linprog.py::TestLinprogIPSparse::test_bug_6139 - AssertionError: linprog status 4, message: The solution does not satisfy the constraints within the required tolerance of 3.16E-04, yet no errors were raised and there is no certificate of infeasibility or unboundedness. Check whether the slack and constraint residuals are acceptable; if not, consider enabling presolve, adjusting the tolerance option(s), and/or using a different method. Please consider submitting a bug report.
FAILED lib/python3.13/site-packages/scipy/optimize/tests/test_linprog.py::TestLinprogIPSparsePresolve::test_bug_6139 - AssertionError: linprog status 4, message: The solution does not satisfy the constraints within the required tolerance of 3.16E-04, yet no errors were raised and there is no certificate of infeasibility or unboundedness. Check whether the slack and constraint residuals are acceptable; if not, consider enabling presolve, adjusting the tolerance option(s), and/or using a different method. Please consider submitting a bug report.
= 4 failed, 81210 passed, 7688 skipped, 300 xfailed, 23 xpassed, 212 warnings in 230.09s (0:03:50) =
Additional context
- On SciPy, a precision difference has been observed for
optimize/tests/test_linprog.py::TestLinprogIPSparse::test_bug_6139. When using our wheel, this test is expected to fail.- On Scipy,
TestLinprogIPSparsePresolve::test_bug_6139. When using our wheel, this test is expected to fail due to accuracy differences.- On SciPy 1.15.1,
differentiate/tests/test_differentiate.py::TestDerivative::test_initial_step[numpy]. When using our wheel, this test is expected to fail due to accuracy differences.
There have other failing reports on these tests across github:
TestDerivative::test_initial_step[numpy]: easybuilders/easybuild-easyconfigs#24464
TestLinprogIPDense::test_bug_6139: scipy/scipy#20216 scipy/scipy#16376 (comment)
TestLinprogIPSparsePresolve::test_bug_6139: scipy/scipy#13409 (comment) scipy/scipy#13364 (comment) sagemath/sage#34658 (comment) EESSI/software-layer#318 (comment) EESSI/software-layer#1187 (comment) easybuilders/easybuild-easyconfigs#23023 (comment)
System metadata
- system:
"x86_64-linux" - host os:
Linux 6.18.35-cachyos-lto, NixOS, 26.05 (Yarara), 26.05.20260611.a037402 - multi-user?:
yes - sandbox:
yes - version:
nix-env (Determinate Nix 3.21.1) 2.34.7 - nixpkgs:
/nix/store/9figz32vbiblaw5x3li1hc8q9qwlwf27-source
Notify maintainers
Note for maintainers: Please tag this issue in your pull request description. (i.e. Resolves #ISSUE.)
I assert that this issue is relevant for Nixpkgs
- I assert that this is a bug and not a support request.
- I assert that this is not a duplicate of an existing issue.
- I assert that I have read the NixOS Code of Conduct and agree to abide by it.
- I assert that I have read the automation/AI policy and that this issue report complies with it.
Is this issue important to you?
Add a 👍 reaction to issues you find important.
Activity
doronbehar commentedon Jun 21, 2026
Hey thanks for the report. Scipy in Nixpkgs goes through an update in #533691 , so maybe you'd like to check it when that PR reaches branch
master. Independently of that, you should be able to open a PR against branchmaster(that will have 0 rebuilds) that will add these tests to thedisabledTestslist, with proper links to upstream and AMD websites.n0099 commentedon Jun 23, 2026
I'm building on commit edf9568 of #533691 with
Also when building this PR with
skylake, 3 testsTestMinimumPhase::test_nyquist[numpy-float32-963],TestSTFT::test_roundtrip_float32andTestSTFT::test_roundtrip_scalingwill fail:doronbehar commentedon Jun 24, 2026
What is skylake?
I am pretty sure scipy would love to hear about these failures in their issue tracker. As I said, feel free to add a
lib.optionalsaddition to ourdisabledTestsordisabledTestPathsdepending on thesestdenv.hostPlatformdetails. Please also link to an upstream issue when you do that.n0099 commentedon Jun 24, 2026
gcc.m{arch,tune} = "skylake";https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html#index-march-13
n0099 commentedon Jun 24, 2026
with
m{arch,tune}=znver5, testTestLinprogIPSparse::test_bug_6139,TestLinprogIPSparsePresolve::test_bug_6139,TestMinimumPhase::test_nyquist[numpy-float32-963],TestSTFT::test_roundtrip_float32andTestSTFT::test_roundtrip_scalingwill fail:TestDerivative::test_initial_step[numpy]no longer fails, butTestMinimumPhase::test_nyquist[numpy-float32-963]now will fail.