CI Investigate timeout in no-OpenMP build with Meson 1.5

https://github.com/scikit-learn/scikit-learn/pull/29486#issuecomment-2242359516

> So the no-OpenMP build still times out ... from the [diff](https://github.com/scikit-learn/scikit-learn/pull/29486/files#diff-5dfc3d97f64b11902494f92b685545d78f4aa020b235c55db0d2d4a87bb976fe) Meson 1.5 could be the culprit maybe 🤔 ...
> 
> One thing that is weird is that OpenMP is now detected in the no-OpenMP build, so at the very least this build does not serve its purpose and needs to be adapted. Probably this as a side-effect of [mesonbuild/meson#13350](https://github.com/mesonbuild/meson/pull/13350), see see [build log](https://dev.azure.com/scikit-learn/scikit-learn/_build/results?buildId=68941&view=logs&j=e6d5b7c0-0dfd-5ddf-13d5-c71bebf56ce2&t=c500742d-7cbe-569e-8da5-94db9b4cd21e&l=43)
> 
> ```
> Built with OpenMP: True
> ```

Once this is fixed/worked-around, the temporary Meson<1.5 pin can be removed:
https://github.com/scikit-learn/scikit-learn/blob/8133ecaacca77f06a8c4c560f5dbbfd654f1990f/build_tools/update_environments_and_lock_files.py#L168-L170

COMMENT:
I am able to reproduce the error (I think), here is what I did: 

1. Check out this branch (#29486)
2. Create the `scikit-learn-doc` environment according to (https://scikit-learn.org/dev/developers/tips.html#using-a-lock-file-to-get-an-environment-close-to-the-ci)
3. Activate the environment
4. Upgrade meson to 1.5.1 using `pip install --upgrade meson`
5. Installed `libomp` using `brew install libomp`
6. `make clean` + `make dev`
7. At this point in the output of `sklearn.show_versions()` a similar error as [this](https://github.com/scikit-learn/scikit-learn/issues/29546#issuecomment-2245645209) can be seen. (it's about having 2 OpenMP packages)
8. Run this test `python -m pytest -v --showlocals --durations=20 --junitxml=test-data.xml --cov-config=.coveragerc --cov sklearn --cov-report= -n4 --pyargs sklearn`
9. Now the program hangs. The last test passed is `sklearn/tests/test_public_functions.py::test_function_param_validation[sklearn.datasets.make_swiss_roll] ` At the time I am writing this it's been hanging for 1.5 hours. 

Some side notes: 

- My machine: macOS Monterey (v12.1), Intel Core i5
- Meson 1.4.2 does not detect OpenMP
- Meson 1.5.1 does not detect OpenMP if `libomp` is not installed from `brew` 

A potential fix is to uninstall `libomp` using brew. I will be trying this on my local machine and edit this comment with the results. 

EDIT: all tests finished with the only failure being checking if OpenMP is enabled. This test can be skipped by setting the `SKLEARN_SKIP_OPENMP_TEST` environment variable to any value. 
```
_______________________________________________________________ test_openmp_parallelism_enabled ________________________________________________________________
[gw0] darwin -- Python 3.12.4 /Users/emilychen/miniforge3/envs/scikit-learn-doc/bin/python

    def test_openmp_parallelism_enabled():
        # Check that sklearn is built with OpenMP-based parallelism enabled.
        # This test can be skipped by setting the environment variable
        # ``SKLEARN_SKIP_OPENMP_TEST``.
        if os.getenv("SKLEARN_SKIP_OPENMP_TEST"):
            pytest.skip("test explicitly skipped (SKLEARN_SKIP_OPENMP_TEST)")
    
        base_url = "dev" if __version__.endswith(".dev0") else "stable"
        err_msg = textwrap.dedent(
            """
            This test fails because scikit-learn has been built without OpenMP.
            This is not recommended since some estimators will run in sequential
            mode instead of leveraging thread-based parallelism.
    
            You can find instructions to build scikit-learn with OpenMP at this
            address:
    
                https://scikit-learn.org/{}/developers/advanced_installation.html
    
            You can skip this test by setting the environment variable
            SKLEARN_SKIP_OPENMP_TEST to any value.
            """
        ).format(base_url)
    
>       assert _openmp_parallelism_enabled(), err_msg
E       AssertionError: 
E       This test fails because scikit-learn has been built without OpenMP.
E       This is not recommended since some estimators will run in sequential
E       mode instead of leveraging thread-based parallelism.
E       
E       You can find instructions to build scikit-learn with OpenMP at this
E       address:
E       
E           https://scikit-learn.org/dev/developers/advanced_installation.html
E       
E       You can skip this test by setting the environment variable
E       SKLEARN_SKIP_OPENMP_TEST to any value.

base_url   = 'dev'
err_msg    = '\nThis test fails because scikit-learn has been built without OpenMP.\nThis is not recommended since some estimators ...tallation.html\n\nYou can skip this test by setting the environment variable\nSKLEARN_SKIP_OPENMP_TEST to any value.\n'

sklearn/tests/test_build.py:34: AssertionError
```

Labels: Build / CI