• Bug#1109955: scikit-learn: deprecated API fails with scipy 1.16

    From Drew Parsons@21:1/5 to All on Sun Jul 27 10:50:02 2025
    Source: scikit-learn
    Version: 1.4.2+dfsg-8
    Severity: normal
    Control: tags -1 fixed-upstream

    scikit-learn uses a deprecated scipy API which causes test_linalg_warning_with_newton_solver (test_glm) to fail with
    scipy 1.16 (from experimental)

    test_logistic_regression_path_convergence_fail also fails

    176s FAILED ../../../../usr/lib/python3/dist-packages/sklearn/linear_model/_glm/tests/test_glm.py::test_linalg_warning_with_newton_solver[42]
    176s FAILED ../../../../usr/lib/python3/dist-packages/sklearn/linear_model/tests/test_logistic.py::test_logistic_regression_path_convergence_fail
    176s = 2 failed, 29255 passed, 3388 skipped, 88 xfailed, 45 xpassed, 15607 warnings in 128.24s (0:02:08) =

    In the case of the test_glm failure the problem is

    176s E DeprecationWarning: scipy.optimize: The `disp` and `iprint` options of the L-BFGS-B solver are deprecated and will be removed in SciPy 1.18.0.
    176s
    176s /usr/lib/python3/dist-packages/scipy/optimize/_lbfgsb_py.py:387: DeprecationWarning

    The problem is fixed upstream https://github.com/scikit-learn/scikit-learn/pull/31642
    in upstream release 1.7.1.

    The second error is:
    176s ________________ test_logistic_regression_path_convergence_fail ________________
    176s [gw14] linux -- Python 3.13.5 /usr/bin/python3.13
    176s
    176s def test_logistic_regression_path_convergence_fail():
    176s rng = np.random.RandomState(0)
    176s X = np.concatenate((rng.randn(100, 2) + [1, 1], rng.randn(100, 2)))
    176s y = [1] * 100 + [-1] * 100
    176s Cs = [1e3]
    176s
    176s # Check that the convergence message points to both a model agnostic
    176s # advice (scaling the data) and to the logistic regression specific
    176s # documentation that includes hints on the solver configuration. 176s with pytest.warns(ConvergenceWarning) as record:
    176s _logistic_regression_path(
    176s X, y, Cs=Cs, tol=0.0, max_iter=1, random_state=0, verbose=0
    176s )
    176s
    176s > assert len(record) == 1
    176s E assert 2 == 1
    176s E + where 2 = len(WarningsChecker(record=True))
    176s
    176s /usr/lib/python3/dist-packages/sklearn/linear_model/tests/test_logistic.py:437: AssertionError

    I can't say if it's fixed in the later upstream release, but likely so
    since thay have been testing scipy 1.16.


    Best way to fix the bug is to upload the new upstream release.

    This bug will become RC serious later, once scipy 1.16 is uploaded to
    unstable.


    -- System Information:
    Debian Release: 13.0
    APT prefers unstable-debug
    APT policy: (500, 'unstable-debug'), (500, 'unstable'), (1, 'experimental') Architecture: amd64 (x86_64)
    Foreign Architectures: i386

    Kernel: Linux 6.12.38+deb13-amd64 (SMP w/8 CPU threads; PREEMPT)
    Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_WARN, TAINT_OOT_MODULE Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8), LANGUAGE=en_AU:en
    Shell: /bin/sh linked to /usr/bin/dash
    Init: systemd (via /run/systemd/system)
    LSM: AppArmor: enabled

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)