⚠️ CI failed on macOS.pylatest_conda_forge_mkl_no_openmp (last failure: Sep 18, 2025) ⚠️

**CI failed on [macOS.pylatest_conda_forge_mkl_no_openmp](https://dev.azure.com/scikit-learn/scikit-learn/_build/results?buildId=80124&view=logs&j=8b4d29c4-7356-5617-94d6-7bef17a56394)** (Sep 18, 2025)
- test_fit_transform[76]

COMMENT:
I can reproduce the error locally. The test also fails for the random seed 98. Additionally, the test `test_fit_transform_tall` fails for seed 78:

<details>

```
(sklearn-dev) ➜  scikit-learn git:(main) SKLEARN_TESTS_GLOBAL_RANDOM_SEED="all" pytest sklearn/decomposition/tests/test_sparse_pca.py -k test_fit_transform
=============================================================================================== test session starts ================================================================================================
platform darwin -- Python 3.13.3, pytest-8.3.5, pluggy-1.5.0
rootdir: /Users/maren/open-source/scikit-learn
configfile: pyproject.toml
plugins: cov-6.1.1
collected 1624 items / 1324 deselected / 300 selected

sklearn/decomposition/tests/test_sparse_pca.py ............................................................................F.....................F.sssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 52%]
sssssssssssssssssssssssssssssssssssssssssss..............................................................................F.....................                                                              [100%]

===================================================================================================== FAILURES =====================================================================================================
______________________________________________________________________________________________ test_fit_transform[76] ______________________________________________________________________________________________

global_random_seed = 76

    def test_fit_transform(global_random_seed):
        alpha = 1
        rng = np.random.RandomState(global_random_seed)
        Y, _, _ = generate_toy_data(3, 10, (8, 8), random_state=rng)  # wide array
        spca_lars = SparsePCA(
            n_components=3, method="lars", alpha=alpha, random_state=global_random_seed
        )
        spca_lars.fit(Y)

        # Test that CD gives similar results
        spca_lasso = SparsePCA(
            n_components=3, method="cd", random_state=global_random_seed, alpha=alpha
        )
        spca_lasso.fit(Y)
>       assert_allclose(spca_lasso.components_, spca_lars.components_, rtol=5e-4)

sklearn/decomposition/tests/test_sparse_pca.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

actual = array([[-0.        , -0.        , -0.        , -0.        , -0.        ,
         0.        ,  0.        , -0.        ...3782, -0.        , -0.        , -0.        , -0.        ,
         0.        ,  0.        ,  0.        ,  0.05074426]])
desired = array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ...2606, -0.        , -0.        , -0.        , -0.        ,
        -0.        , -0.        , -0.        ,  0.05074219]])
rtol = 0.0005, atol = 0.0, equal_nan = True, err_msg = '', verbose = True

    def assert_allclose(
        actual, desired, rtol=None, atol=0.0, equal_nan=True, err_msg="", verbose=True
    ):
        """dtype-aware variant of numpy.testing.assert_allclose

        This variant introspects the least precise floating point dtype
        in the input argument and automatically sets the relative tolerance
        parameter to 1e-4 float32 and use 1e-7 otherwise (typically float64
        in scikit-learn).

        `atol` is always left to 0. by default. It should be adjusted manually
        to an assertion-specific value in case there are null values expected
        in `desired`.

        The aggregate tolerance is `atol + rtol * abs(desired)`.

        Parameters
        ----------
        actual : array_like
            Array obtained.
        desired : array_like
            Array desired.
        rtol : float, optional, default=None
            Relative tolerance.
            If None, it is set based on the provided arrays' dtypes.
        atol : float, optional, default=0.
            Absolute tolerance.
        equal_nan : bool, optional, default=True
            If True, NaNs will compare equal.
        err_msg : str, optional, default=''
            The error message to be printed in case of failure.
        verbose : bool, optional, default=True
            If True, the conflicting values are appended to the error message.

        Raises
        ------
        AssertionError
            If actual and desired are not equal up to specified precision.

        See Also
        --------
        numpy.testing.assert_allclose

        Examples
        --------
        >>> import numpy as np
        >>> from sklearn.utils._testing import assert_allclose
        >>> x = [1e-5, 1e-3, 1e-1]
        >>> y = np.arccos(np.cos(x))
        >>> assert_allclose(x, y, rtol=1e-5, atol=0)
        >>> a = np.full(shape=10, fill_value=1e-5, dtype=np.float32)
        >>> assert_allclose(a, 1e-5)
        """
        dtypes = []

        actual, desired = np.asanyarray(actual), np.asanyarray(desired)
        dtypes = [actual.dtype, desired.dtype]

        if rtol is None:
            rtols = [1e-4 if dtype == np.float32 else 1e-7 for dtype in dtypes]
            rtol = max(rtols)

>       np_assert_allclose(
            actual,
            desired,
            rtol=rtol,
            atol=atol,
            equal_nan=equal_nan,
            err_msg=err_msg,
            verbose=verbose,
        )
E       AssertionError:
E       Not equal to tolerance rtol=0.0005, atol=0
E
E       Mismatched elements: 1 / 192 (0.521%)
E       Max absolute difference among violations: 0.00025609
E       Max relative difference among violations: 0.00164288
E        ACTUAL: array([[-0.      , -0.      , -0.      , -0.      , -0.      ,  0.      ,
E                0.      , -0.      ,  0.      , -0.      , -0.      , -0.      ,
E                0.      , -0.      ,  0.      ,  0.      ,  0.      ,  0.      ,...
E        DESIRED: array([[ 0.      ,  0.      ,  0.      ,  0.      ,  0.      ,  0.      ,
E                0.      ,  0.      ,  0.      ,  0.      ,  0.      ,  0.      ,
E                0.      ,  0.      ,  0.      ,  0.      ,  0.      ,  0.      ,...

sklearn/utils/_testing.py:233: AssertionError
______________________________________________________________________________________________ test_fit_transform[98] ______________________________________________________________________________________________

global_random_seed = 98

    def test_fit_transform(global_random_seed):
        alpha = 1
        rng = np.random.RandomState(global_random_seed)
        Y, _, _ = generate_toy_data(3, 10, (8, 8), random_state=rng)  # wide array
        spca_lars = SparsePCA(
            n_components=3, method="lars", alpha=alpha, random_state=global_random_seed
        )
        spca_lars.fit(Y)

        # Test that CD gives similar results
        spca_lasso = SparsePCA(
            n_components=3, method="cd", random_state=global_random_seed, alpha=alpha
        )
        spca_lasso.fit(Y)
>       assert_allclose(spca_lasso.components_, spca_lars.components_, rtol=5e-4)

sklearn/decomposition/tests/test_sparse_pca.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

actual = array([[ 0.        ,  0.        ,  0.        , -0.        ,  0.        ,
        -0.        , -0.        , -0.        ...    ,  0.        ,  1.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ]])
desired = array([[0.        , 0.        , 0.        , 0.        , 0.        ,
        0.        , 0.        , 0.        , 0.    ...  0.        , 0.        , 1.        , 0.        , 0.        ,
        0.        , 0.        , 0.        , 0.        ]])
rtol = 0.0005, atol = 0.0, equal_nan = True, err_msg = '', verbose = True

    def assert_allclose(
        actual, desired, rtol=None, atol=0.0, equal_nan=True, err_msg="", verbose=True
    ):
        """dtype-aware variant of numpy.testing.assert_allclose

        This variant introspects the least precise floating point dtype
        in the input argument and automatically sets the relative tolerance
        parameter to 1e-4 float32 and use 1e-7 otherwise (typically float64
        in scikit-learn).

        `atol` is always left to 0. by default. It should be adjusted manually
        to an assertion-specific value in case there are null values expected
        in `desired`.

        The aggregate tolerance is `atol + rtol * abs(desired)`.

        Parameters
        ----------
        actual : array_like
            Array obtained.
        desired : array_like
            Array desired.
        rtol : float, optional, default=None
            Relative tolerance.
            If None, it is set based on the provided arrays' dtypes.
        atol : float, optional, default=0.
            Absolute tolerance.
        equal_nan : bool, optional, default=True
            If True, NaNs will compare equal.
        err_msg : str, optional, default=''
            The error message to be printed in case of failure.
        verbose : bool, optional, default=True
            If True, the conflicting values are appended to the error message.

        Raises
        ------
        AssertionError
            If actual and desired are not equal up to specified precision.

        See Also
        --------
        numpy.testing.assert_allclose

        Examples
        --------
        >>> import numpy as np
        >>> from sklearn.utils._testing import assert_allclose
        >>> x = [1e-5, 1e-3, 1e-1]
        >>> y = np.arccos(np.cos(x))
        >>> assert_allclose(x, y, rtol=1e-5, atol=0)
        >>> a = np.full(shape=10, fill_value=1e-5, dtype=np.float32)
        >>> assert_allclose(a, 1e-5)
        """
        dtypes = []

        actual, desired = np.asanyarray(actual), np.asanyarray(desired)
        dtypes = [actual.dtype, desired.dtype]

        if rtol is None:
            rtols = [1e-4 if dtype == np.float32 else 1e-7 for dtype in dtypes]
            rtol = max(rtols)

>       np_assert_allclose(
            actual,
            desired,
            rtol=rtol,
            atol=atol,
            equal_nan=equal_nan,
            err_msg=err_msg,
            verbose=verbose,
        )
E       AssertionError:
E       Not equal to tolerance rtol=0.0005, atol=0
E
E       Mismatched elements: 1 / 192 (0.521%)
E       Max absolute difference among violations: 1.01564945e-05
E       Max relative difference among violations: 0.00104507
E        ACTUAL: array([[ 0.      ,  0.      ,  0.      , -0.      ,  0.      , -0.      ,
E               -0.      , -0.      , -0.      , -0.      ,  0.      ,  0.      ,
E                0.      ,  0.      , -0.      ,  0.      ,  0.      , -0.      ,...
E        DESIRED: array([[0.      , 0.      , 0.      , 0.      , 0.      , 0.      ,
E               0.      , 0.      , 0.      , 0.      , 0.      , 0.      ,
E               0.      , 0.      , 0.      , 0.      , 0.      , 0.      ,...

sklearn/utils/_testing.py:233: AssertionError
___________________________________________________________________________________________ test_fit_transform_tall[78] ____________________________________________________________________________________________

global_random_seed = 78

    def test_fit_transform_tall(global_random_seed):
        rng = np.random.RandomState(global_random_seed)
        Y, _, _ = generate_toy_data(3, 65, (8, 8), random_state=rng)  # tall array
        spca_lars = SparsePCA(n_components=3, method="lars", random_state=rng)
        U1 = spca_lars.fit_transform(Y)
        spca_lasso = SparsePCA(n_components=3, method="cd", random_state=rng)
        U2 = spca_lasso.fit(Y).transform(Y)
>       assert_allclose(U1, U2, rtol=1e-4, atol=1e-5)

sklearn/decomposition/tests/test_sparse_pca.py:120:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

actual = array([[-1.00659743e+00, -3.72456979e-02,  8.09993242e-01],
       [-2.65574513e-01,  7.79073540e-01,  4.35888566e-01]...      [-9.27080554e-01, -1.95164622e+00,  6.39392023e-02],
       [ 6.42920959e+00,  7.72462613e-02, -1.54712525e+00]])
desired = array([[-1.00659668e+00, -3.72422736e-02,  8.09993221e-01],
       [-2.65574694e-01,  7.79060069e-01,  4.35888622e-01]...      [-9.27079907e-01, -1.95165263e+00,  6.39392335e-02],
       [ 6.42920963e+00,  7.72471202e-02, -1.54712525e+00]])
rtol = 0.0001, atol = 1e-05, equal_nan = True, err_msg = '', verbose = True

    def assert_allclose(
        actual, desired, rtol=None, atol=0.0, equal_nan=True, err_msg="", verbose=True
    ):
        """dtype-aware variant of numpy.testing.assert_allclose

        This variant introspects the least precise floating point dtype
        in the input argument and automatically sets the relative tolerance
        parameter to 1e-4 float32 and use 1e-7 otherwise (typically float64
        in scikit-learn).

        `atol` is always left to 0. by default. It should be adjusted manually
        to an assertion-specific value in case there are null values expected
        in `desired`.

        The aggregate tolerance is `atol + rtol * abs(desired)`.

        Parameters
        ----------
        actual : array_like
            Array obtained.
        desired : array_like
            Array desired.
        rtol : float, optional, default=None
            Relative tolerance.
            If None, it is set based on the provided arrays' dtypes.
        atol : float, optional, default=0.
            Absolute tolerance.
        equal_nan : bool, optional, default=True
            If True, NaNs will compare equal.
        err_msg : str, optional, default=''
            The error message to be printed in case of failure.
        verbose : bool, optional, default=True
            If True, the conflicting values are appended to the error message.

        Raises
        ------
        AssertionError
            If actual and desired are not equal up to specified precision.

        See Also
        --------
        numpy.testing.assert_allclose

        Examples
        --------
        >>> import numpy as np
        >>> from sklearn.utils._testing import assert_allclose
        >>> x = [1e-5, 1e-3, 1e-1]
        >>> y = np.arccos(np.cos(x))
        >>> assert_allclose(x, y, rtol=1e-5, atol=0)
        >>> a = np.full(shape=10, fill_value=1e-5, dtype=np.float32)
        >>> assert_allclose(a, 1e-5)
        """
        dtypes = []

        actual, desired = np.asanyarray(actual), np.asanyarray(desired)
        dtypes = [actual.dtype, desired.dtype]

        if rtol is None:
            rtols = [1e-4 if dtype == np.float32 else 1e-7 for dtype in dtypes]
            rtol = max(rtols)

>       np_assert_allclose(
            actual,
            desired,
            rtol=rtol,
            atol=atol,
            equal_nan=equal_nan,
            err_msg=err_msg,
            verbose=verbose,
        )
E       AssertionError:
E       Not equal to tolerance rtol=0.0001, atol=1e-05
E
E       Mismatched elements: 1 / 195 (0.513%)
E       Max absolute difference among violations: 1.36065129e-05
E       Max relative difference among violations: 0.00622299
E        ACTUAL: array([[-1.006597e+00, -3.724570e-02,  8.099932e-01],
E              [-2.655745e-01,  7.790735e-01,  4.358886e-01],
E              [ 2.285982e+00, -1.184348e+00, -1.225655e-01],...
E        DESIRED: array([[-1.006597e+00, -3.724227e-02,  8.099932e-01],
E              [-2.655747e-01,  7.790601e-01,  4.358886e-01],
E              [ 2.285982e+00, -1.184351e+00, -1.225654e-01],...

sklearn/utils/_testing.py:233: AssertionError
============================================================================================= short test summary info ==============================================================================================
FAILED sklearn/decomposition/tests/test_sparse_pca.py::test_fit_transform[76] - AssertionError:
FAILED sklearn/decomposition/tests/test_sparse_pca.py::test_fit_transform[98] - AssertionError:
FAILED sklearn/decomposition/tests/test_sparse_pca.py::test_fit_transform_tall[78] - AssertionError:
===================================================================== 3 failed, 197 passed, 100 skipped, 1324 deselected, 2 warnings in 5.98s ======================================================================
```

</details>

Labels: Bug, module:test-suite