Installation fails on MacOS 10.11 El Capitan with Python 3.10

### Describe the bug

There is a **scikit_learn-1.1.1-cp310-cp310-macosx_10_13_x86_64.whl** Wheel available on PyPi, but nothing compatible with earlier versions of MacOS running Python 3.10

As a result, pip attempts to compile from source. This fails as below.

Numpy and SciPy are already installed.

```
python3 -m pip show numpy
Name: numpy
Version: 1.21.3
Summary: NumPy is the fundamental package for array computing with Python.
Home-page: https://www.numpy.org
Author: Travis E. Oliphant et al.
Author-email: 
License: BSD
Location: /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages
Requires: 
Required-by: matplotlib, pandas, pytorch-lightning, scipy, tensorboard, torchmetrics, transformers
```


### Steps/Code to Reproduce

```
python3 -m pip install scikit-learn
```

### Expected Results

Something like

`Downloading scikit_learn-1.1.1-cp310-cp310-macosx_10_9_x86_64.whl`

### Actual Results

```
Collecting scikit-learn
  Downloading scikit-learn-1.1.1.tar.gz (6.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.8/6.8 MB 3.5 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [139 lines of output]
      Partial import of sklearn during the build process.
      C compiler: clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g
      
      compile options: '-c'
      clang: test_program.c
      In file included from test_program.c:1:
      In file included from /usr/include/stdio.h:64:
      /usr/include/sys/cdefs.h:707:2: error: Unsupported architecture
      #error Unsupported architecture
       ^
      In file included from test_program.c:1:
      In file included from /usr/include/stdio.h:67:
      In file included from /usr/include/_types.h:27:
      In file included from /usr/include/sys/_types.h:33:
      /usr/include/machine/_types.h:34:2: error: architecture not supported
      #error architecture not supported
       ^
      In file included from test_program.c:1:
      In file included from /usr/include/stdio.h:67:
      In file included from /usr/include/_types.h:27:
      /usr/include/sys/_types.h:55:9: error: unknown type name '__int64_t'; did you mean '__int128_t'?
      typedef __int64_t       __darwin_blkcnt_t;      /* total blocks */
              ^
      note: '__int128_t' declared here
      /usr/include/sys/_types.h:56:9: error: unknown type name '__int32_t'; did you mean '__int128_t'?
      typedef __int32_t       __darwin_blksize_t;     /* preferred block size */
              ^
      note: '__int128_t' declared here
      /usr/include/sys/_types.h:57:9: error: unknown type name '__int32_t'; did you mean '__int128_t'?
      typedef __int32_t       __darwin_dev_t;         /* dev_t */
              ^
      note: '__int128_t' declared here
      /usr/include/sys/_types.h:60:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
      typedef __uint32_t      __darwin_gid_t;         /* [???] process and group IDs */
              ^
      note: '__uint128_t' declared here
      /usr/include/sys/_types.h:61:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
      typedef __uint32_t      __darwin_id_t;          /* [XSI] pid_t, uid_t, or gid_t*/
              ^
      note: '__uint128_t' declared here
      /usr/include/sys/_types.h:62:9: error: unknown type name '__uint64_t'; did you mean '__uint128_t'?
      typedef __uint64_t      __darwin_ino64_t;       /* [???] Used for 64 bit inodes */
              ^
      note: '__uint128_t' declared here
      /usr/include/sys/_types.h:68:9: error: unknown type name '__darwin_natural_t'
      typedef __darwin_natural_t __darwin_mach_port_name_t; /* Used by mach */
              ^
      /usr/include/sys/_types.h:70:9: error: unknown type name '__uint16_t'; did you mean '__uint128_t'?
      typedef __uint16_t      __darwin_mode_t;        /* [???] Some file attributes */
              ^
      note: '__uint128_t' declared here
      /usr/include/sys/_types.h:71:9: error: unknown type name '__int64_t'; did you mean '__int128_t'?
      typedef __int64_t       __darwin_off_t;         /* [???] Used for file sizes */
              ^
      note: '__int128_t' declared here
      /usr/include/sys/_types.h:72:9: error: unknown type name '__int32_t'; did you mean '__int128_t'?
      typedef __int32_t       __darwin_pid_t;         /* [???] process and group IDs */
              ^
      note: '__int128_t' declared here
      /usr/include/sys/_types.h:73:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
      typedef __uint32_t      __darwin_sigset_t;      /* [???] signal set */
              ^
      note: '__uint128_t' declared here
      /usr/include/sys/_types.h:74:9: error: unknown type name '__int32_t'; did you mean '__int128_t'?
      typedef __int32_t       __darwin_suseconds_t;   /* [???] microseconds */
              ^
      note: '__int128_t' declared here
      /usr/include/sys/_types.h:75:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
      typedef __uint32_t      __darwin_uid_t;         /* [???] user IDs */
              ^
      note: '__uint128_t' declared here
      /usr/include/sys/_types.h:76:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
      typedef __uint32_t      __darwin_useconds_t;    /* [???] microseconds */
              ^
      note: '__uint128_t' declared here
      In file included from test_program.c:1:
      In file included from /usr/include/stdio.h:67:
      /usr/include/_types.h:42:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
      typedef __uint32_t      __darwin_wctype_t;
              ^
      note: '__uint128_t' declared here
      In file included from test_program.c:1:
      In file included from /usr/include/stdio.h:71:
      /usr/include/sys/_types/_va_list.h:31:9: error: unknown type name '__darwin_va_list'
      typedef __darwin_va_list va_list;
              ^
      In file included from test_program.c:1:
      In file included from /usr/include/stdio.h:72:
      /usr/include/sys/_types/_size_t.h:30:9: error: unknown type name '__darwin_size_t'
      typedef __darwin_size_t        size_t;
              ^
      fatal error: too many errors emitted, stopping now [-ferror-limit=]
      20 errors generated.
      Traceback (most recent call last):
        File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 164, in prepare_metadata_for_build_wheel
          return hook(metadata_directory, config_settings)
        File "/private/var/folders/9j/28vfzp751lbf5yhsr208gkp00000gn/T/pip-build-env-i5bosgpj/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 174, in prepare_metadata_for_build_wheel
          self.run_setup()
        File "/private/var/folders/9j/28vfzp751lbf5yhsr208gkp00000gn/T/pip-build-env-i5bosgpj/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 267, in run_setup
          super(_BuildMetaLegacyBackend,
        File "/private/var/folders/9j/28vfzp751lbf5yhsr208gkp00000gn/T/pip-build-env-i5bosgpj/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 158, in run_setup
          exec(compile(code, __file__, 'exec'), locals())
        File "setup.py", line 328, in <module>
          setup_package()
        File "setup.py", line 324, in setup_package
          setup(**metadata)
        File "/private/var/folders/9j/28vfzp751lbf5yhsr208gkp00000gn/T/pip-build-env-i5bosgpj/overlay/lib/python3.10/site-packages/numpy/distutils/core.py", line 135, in setup
          config = configuration()
        File "setup.py", line 187, in configuration
          config.add_subpackage("sklearn")
        File "/private/var/folders/9j/28vfzp751lbf5yhsr208gkp00000gn/T/pip-build-env-i5bosgpj/overlay/lib/python3.10/site-packages/numpy/distutils/misc_util.py", line 1014, in add_subpackage
          config_list = self.get_subpackage(subpackage_name, subpackage_path,
        File "/private/var/folders/9j/28vfzp751lbf5yhsr208gkp00000gn/T/pip-build-env-i5bosgpj/overlay/lib/python3.10/site-packages/numpy/distutils/misc_util.py", line 980, in get_subpackage
          config = self._get_configuration_from_setup_py(
        File "/private/var/folders/9j/28vfzp751lbf5yhsr208gkp00000gn/T/pip-build-env-i5bosgpj/overlay/lib/python3.10/site-packages/numpy/distutils/misc_util.py", line 922, in _get_configuration_from_setup_py
          config = setup_module.configuration(*args)
        File "/private/var/folders/9j/28vfzp751lbf5yhsr208gkp00000gn/T/pip-install-nsycs__4/scikit-learn_cf1850107767490faaca5f091aa388b9/sklearn/setup.py", line 85, in configuration
          cythonize_extensions(top_path, config)
        File "/private/var/folders/9j/28vfzp751lbf5yhsr208gkp00000gn/T/pip-install-nsycs__4/scikit-learn_cf1850107767490faaca5f091aa388b9/sklearn/_build_utils/__init__.py", line 47, in cythonize_extensions
          basic_check_build()
        File "/private/var/folders/9j/28vfzp751lbf5yhsr208gkp00000gn/T/pip-install-nsycs__4/scikit-learn_cf1850107767490faaca5f091aa388b9/sklearn/_build_utils/pre_build_helpers.py", line 119, in basic_check_build
          compile_test_program(code)
        File "/private/var/folders/9j/28vfzp751lbf5yhsr208gkp00000gn/T/pip-install-nsycs__4/scikit-learn_cf1850107767490faaca5f091aa388b9/sklearn/_build_utils/pre_build_helpers.py", line 75, in compile_test_program
          ccompiler.compile(
        File "/private/var/folders/9j/28vfzp751lbf5yhsr208gkp00000gn/T/pip-build-env-i5bosgpj/overlay/lib/python3.10/site-packages/numpy/distutils/ccompiler.py", line 89, in <lambda>
          m = lambda self, *args, **kw: func(self, *args, **kw)
        File "/private/var/folders/9j/28vfzp751lbf5yhsr208gkp00000gn/T/pip-build-env-i5bosgpj/overlay/lib/python3.10/site-packages/numpy/distutils/ccompiler.py", line 366, in CCompiler_compile
          single_compile(o)
        File "/private/var/folders/9j/28vfzp751lbf5yhsr208gkp00000gn/T/pip-build-env-i5bosgpj/overlay/lib/python3.10/site-packages/numpy/distutils/ccompiler.py", line 326, in single_compile
          self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
        File "/private/var/folders/9j/28vfzp751lbf5yhsr208gkp00000gn/T/pip-build-env-i5bosgpj/overlay/lib/python3.10/site-packages/numpy/distutils/ccompiler.py", line 89, in <lambda>
          m = lambda self, *args, **kw: func(self, *args, **kw)
        File "/private/var/folders/9j/28vfzp751lbf5yhsr208gkp00000gn/T/pip-build-env-i5bosgpj/overlay/lib/python3.10/site-packages/numpy/distutils/unixccompiler.py", line 57, in UnixCCompiler__compile
          raise CompileError(msg) from None
      distutils.errors.CompileError: Command "clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -c test_program.c -o objects/test_program.o" failed with exit status 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
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
Trying to install the latest version, but same seems to apply to earlier ones.

Release 0.24.0 in December 2020 appears to be the last one with a MacOS 10.9 build, but for Python 3.9

scikit_learn-0.24.0-cp39-cp39-macosx_10_9_x86_64.whl


(Incidentally, the same problem exists with scikit-image after release 0.18.3 in August 2021.)
```

COMMENT:
Thanks so much for doing this: very much appreciated.

Just to expand on why there may be reasonable demand for support of older versions of MacOS if there's no fundamental limitation: it's down to 32-bit support and APFS in a multitude of different scenarios.

Just as an example, it might make sense to upgrade a well-spec'd Late-2012 Mac Mini to 10.14 Mojave, as the last version to still support 32-bit applications.

Normally, why even hesitate?

But APFS doesn't support booting from an AppleRAID volume, so if your higher spec included RAID1 redundancy, you suddenly have a new obstacle. MacOS 10.13 High Sierra may or may not require APFS conversion, depending on whether you've previously upgraded to SSD; but 10.14 Mojave definitely will.

It still makes sense to upgrade, but not so much to 10.13; and it also makes sense to delay further whilst you solve data security (and/or other practical) issues.

Labels: Bug, Needs Triage