⚠️ CI failed on Linux_Nightly.pylatest_pip_scipy_dev (last failure: Jun 21, 2024) ⚠️

**CI failed on [Linux_Nightly.pylatest_pip_scipy_dev](https://dev.azure.com/scikit-learn/scikit-learn/_build/results?buildId=67841&view=logs&j=dfe99b15-50db-5d7b-b1e9-4105c42527cf)** (Jun 21, 2024)
- test_check_inplace_ensure_writeable[KernelPCA()]

COMMENT:
Ohoh looks like one for @jeremiedbb :wink:, a few other builds are broken with the same issue.

![image](https://github.com/scikit-learn/scikit-learn/assets/1680079/614a1950-12b1-4f82-a2e6-d0b8f13659cc)

Probably a combination of https://github.com/scikit-learn/scikit-learn/pull/29018 + https://github.com/scikit-learn/scikit-learn/pull/29100.

Using Github Merge queues would have avoided it I guess but this kind of edge case happens so rarely that I don't think we should bother ...

Here is what the error looks like:
```
================================== FAILURES ===================================
______________ test_check_inplace_ensure_writeable[KernelPCA()] _______________

estimator = KernelPCA(copy_X=False, kernel='precomputed')

    @pytest.mark.parametrize(
        "estimator", _tested_estimators(), ids=_get_check_estimator_ids
    )
    def test_check_inplace_ensure_writeable(estimator):
        name = estimator.__class__.__name__
    
        if hasattr(estimator, "copy"):
            estimator.set_params(copy=False)
        elif hasattr(estimator, "copy_X"):
            estimator.set_params(copy_X=False)
        else:
            raise SkipTest(f"{name} doesn't require writeable input.")
    
        _set_checking_parameters(estimator)
    
        # The following estimators can work inplace only with certain settings
        if name == "HDBSCAN":
            estimator.set_params(metric="precomputed", algorithm="brute")
    
        if name == "PCA":
            estimator.set_params(svd_solver="full")
    
        if name == "KernelPCA":
            estimator.set_params(kernel="precomputed")
    
>       check_inplace_ensure_writeable(name, estimator)

Python\Lib\site-packages\sklearn\tests\test_common.py:648: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Python\Lib\site-packages\sklearn\utils\_testing.py:151: in wrapper
    return fn(*args, **kwargs)
Python\Lib\site-packages\sklearn\utils\estimator_checks.py:4764: in check_inplace_ensure_writeable
    estimator.fit(X, y)
Python\Lib\site-packages\sklearn\base.py:1514: in wrapper
    return fit_method(estimator, *args, **kwargs)
Python\Lib\site-packages\sklearn\decomposition\_kernel_pca.py:443: in fit
    self._fit_transform_in_place(K)
Python\Lib\site-packages\sklearn\decomposition\_kernel_pca.py:330: in _fit_transform_in_place
    K = self._centerer.fit(K).transform(K, copy=False)
Python\Lib\site-packages\sklearn\utils\_set_output.py:313: in wrapped
    data_to_wrap = f(self, X, *args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = KernelCenterer()
K = array([[ 9.73855706e+00,  8.03906192e+00, -8.08995063e+00, ...,
        -8.23304619e+00, -9.40415982e+00,  1.15996793e...  [ 1.15996793e+01,  1.34901489e+01, -4.71531831e+00, ...,
         1.31699789e+01,  1.33525719e+01,  1.81886536e+01]])
copy = False

    def transform(self, K, copy=True):
        """Center kernel matrix.
    
        Parameters
        ----------
        K : ndarray of shape (n_samples1, n_samples2)
            Kernel matrix.
    
        copy : bool, default=True
            Set to False to perform inplace computation.
    
        Returns
        -------
        K_new : ndarray of shape (n_samples1, n_samples2)
            Returns the instance itself.
        """
        check_is_fitted(self)
    
        xp, _ = get_namespace(K)
    
        K = self._validate_data(
            K, copy=copy, dtype=_array_api.supported_float_dtypes(xp), reset=False
        )
    
        K_pred_cols = (xp.sum(K, axis=1) / self.K_fit_rows_.shape[0])[:, None]
    
>       K -= self.K_fit_rows_
E       ValueError: output array is read-only

Python\Lib\site-packages\sklearn\preprocessing\_data.py:2443: ValueError
```

Labels: Needs Triage