Unable to successfully install scikit-learn development version with MacBookPro with chip Apple M1 Pro

### Describe the bug

I installed the development version of scikit-learn on my computer (MacBookPro with chip Apple M1 Pro). When I ran pytest I got the following error: 
```
(sklearn-dev) ➜  scikit-learn git:(main) pytest
=========================================================================================== test session starts ============================================================================================
platform darwin -- Python 3.9.10, pytest-7.0.1, pluggy-1.0.0
rootdir: /Users/maren/Documents/scikit-learn, configfile: setup.cfg, testpaths: sklearn
plugins: xdist-2.5.0, forked-1.4.0, cov-3.0.0
collecting ... [1]    54294 killed     pytest
```

I investigated what's going on an this is the result: 
https://gist.github.com/marenwestermann/9ffddb7a2f0ef6798d350f3595997ed1

I'm using a conda environment. I used the Miniforge3-MacOSX-arm64 download from here: https://github.com/conda-forge/miniforge#miniforge

This is the content of my sklearn-dev conda environment: 
https://gist.github.com/marenwestermann/c01fc4d3044522e329ce83d16680e1a5

### Steps/Code to Reproduce

```
pytest
```

```
python -vvv -c "import sklearn"
```

### Expected Results

The expected result would be that when the command `pytest` is run all test are either skipped or are successful. 

### Actual Results

Pytest result:
```
(sklearn-dev) ➜  scikit-learn git:(main) pytest
=========================================================================================== test session starts ============================================================================================
platform darwin -- Python 3.9.10, pytest-7.0.1, pluggy-1.0.0
rootdir: /Users/maren/Documents/scikit-learn, configfile: setup.cfg, testpaths: sklearn
plugins: xdist-2.5.0, forked-1.4.0, cov-3.0.0
collecting ... [1]    54294 killed     pytest
```
Further investigation: 
https://gist.github.com/marenwestermann/9ffddb7a2f0ef6798d350f3595997ed1

### Versions

```shell
function>
```

COMMENT:
Thank you for your detailed response, @ogrisel! 

Regarding your questions: I got a new computer recently (the MacBookPro with chip Apple M1 Pro that I'm using now). I backed up the repos that I had on my old computer to an external hard drive and from there copied these over to the new computer. There, in case of scikit-learn, I made sure that origin and upstream are correct, did a `git pull upstream main` and then followed the instruction from point 2 here: https://scikit-learn.org/stable/developers/advanced_installation.html#building-from-source. When I reached point 4 I used the hyperlink for macOS ([this one](https://scikit-learn.org/stable/developers/advanced_installation.html#compiler-macos)) and followd the instructions. 

I ran `pip install -e . --no-build-isolation` again but it again resulted in the same pytest error, i.e. the process getting killed. I then created a new conda environment and followed the instructions described above again. These are the commands I ran: 
```
conda create -n sklearn-env -c conda-forge python=3.9 numpy scipy cython
conda activate sklearn-env
mamba install -c conda-forge joblib threadpoolctl pytest compilers llvm-openmp
make clean
pip install --verbose --no-build-isolation --editable .
```
The output of the last command is this: 
https://gist.github.com/marenwestermann/6860eff85fd264fa67f9b85f9c84a036

My new conda environment looks like this: 
https://gist.github.com/marenwestermann/109cb39b2763d3433c54b80b1efe5aa8

I haven't tried completely uninstalling scikit-learn and re-installing it. I could give that a try as a next step. (Maybe the copy-pasting of the repo has corrupted some files?)

Labels: Bug, Build / CI