BUG: Issue building from source on MacOS Python 3.11

### Describe the bug

I have followed the steps mentioned at https://scikit-learn.org/stable/developers/advanced_installation.html#editable-mode. but it did not work and giving me the following error.

I want to contribute to the community but I am not able to get my development environment ready. Any help/pointer is highly appreciated.

### Steps/Code to Reproduce

`pip install -v --no-use-pep517 --no-build-isolation -e .`


### Expected Results

pip install should succeed without error

### Actual Results
```
Using pip 24.0 from /Users/tuhinsharma/.virtualenvs/scikit-learn/lib/python3.11/site-packages/pip (python 3.11)
Obtaining file:///Users/tuhinsharma/Documents/Git/scikit-learn
  Running command python setup.py egg_info
  /Users/tuhinsharma/Documents/Git/scikit-learn/setup.py:12: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
    from pkg_resources import parse_version
  Partial import of sklearn during the build process.
  error: Multiple top-level packages discovered in a flat-layout: ['sklearn', 'build_tools'].

  To avoid accidental inclusion of unwanted files or directories,
  setuptools will not proceed with this build.

  If you are trying to create a single distribution with multiple packages
  on purpose, you should not rely on automatic discovery.
  Instead, consider the following options:

  1. set up custom discovery (`find` directive with `include` or `exclude`)
  2. use a `src-layout`
  3. explicitly set `py_modules` or `packages` with a list of names

  To find more information, look for "package discovery" on setuptools docs.
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: /Users/tuhinsharma/.virtualenvs/scikit-learn/bin/python -c '
  exec(compile('"'"''"'"''"'"'
  # This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py
  #
  # - It imports setuptools before invoking setup.py, to enable projects that directly
  #   import from `distutils.core` to work with newer packaging standards.
  # - It provides a clear error message when setuptools is not installed.
  # - It sets `sys.argv[0]` to the underlying `setup.py`, when invoking `setup.py` so
  #   setuptools doesn'"'"'t think the script is `-c`. This avoids the following warning:
  #     manifest_maker: standard file '"'"'-c'"'"' not found".
  # - It generates a shim setup.py, for handling setup.cfg-only projects.
  import os, sys, tokenize
  
  try:
      import setuptools
  except ImportError as error:
      print(
          "ERROR: Can not execute `setup.py` since setuptools is not available in "
          "the build environment.",
          file=sys.stderr,
      )
      sys.exit(1)
  
  __file__ = %r
  sys.argv[0] = __file__
  
  if os.path.exists(__file__):
      filename = __file__
      with tokenize.open(__file__) as f:
          setup_py_code = f.read()
  else:
      filename = "<auto-generated setuptools caller>"
      setup_py_code = "from setuptools import setup; setup()"
  
  exec(compile(setup_py_code, filename, "exec"))
  '"'"''"'"''"'"' % ('"'"'/Users/tuhinsharma/Documents/Git/scikit-learn/setup.py'"'"',), "<pip-setuptools-caller>", "exec"))' egg_info --egg-base /private/var/folders/24/q83vy1q54_181scf16svmls40000gn/T/pip-pip-egg-info-a3645qry
  cwd: /Users/tuhinsharma/Documents/Git/scikit-learn/
  Preparing metadata (setup.py) ... error
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
```

### Versions

```shell
scikit - main branch (c1eee276fa501965e7b4e23e6349031092e33131)
Python - 3.11.8
MacOS Intel Sonoma 14.4.1 x86_64
```

COMMENT:
@betatim used conda. followed the instructions "to the letter". It worked like a charm. Thank you so much. I was trying installing using native python 3.11 which did not work. So the key is to stick to conda. I think the C-compiler gets confused in mac. But anyways it works perfectly now. I am closing the issue.

Labels: Bug