Unable to build scikit learn on Mac-M2, python3.11 and 3.9

### Describe the bug

Getting below error when trying to install snips-nlu
ried installing both venv and conda
Also tried to install with python3.9 but failed with the same 
`Cython.Compiler.Errors.CompileError: sklearn/svm/_liblinear.pyx`
      

### Steps/Code to Reproduce

`conda install -c conda-forge scikit-learn`
`pip3 install snips-nlu`



### Expected Results

No error is thrown

### Actual Results

Error compiling Cython file:
      ------------------------------------------------------------
      ...
      
              # Initial capacity
              cdef int init_capacity
      
              if tree.max_depth <= 10:
                  init_capacity = (2 ** (tree.max_depth + 1)) - 1
                                                              ^
      ------------------------------------------------------------
      
      sklearn/tree/_tree.pyx:162:56: Cannot assign type 'double' to 'int'
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              shape[1] = <np.npy_intp> self.n_outputs
              shape[2] = <np.npy_intp> self.max_n_classes
              cdef np.ndarray arr
              arr = np.PyArray_SimpleNewFromData(3, shape, np.NPY_DOUBLE, self.value)
              Py_INCREF(self)
              arr.base = <PyObject*> self
                 ^
      ------------------------------------------------------------
      
      sklearn/tree/_tree.pyx:1103:11: Assignment to a read-only property
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              arr = PyArray_NewFromDescr(<PyTypeObject *> np.ndarray,
                                         <np.dtype> NODE_DTYPE, 1, shape,
                                         strides, <void*> self.nodes,
                                         np.NPY_DEFAULT, None)
              Py_INCREF(self)
              arr.base = <PyObject*> self
                 ^
      ------------------------------------------------------------
      
      sklearn/tree/_tree.pyx:1124:11: Assignment to a read-only property
      Traceback (most recent call last):
        File "/Users/abhiver/miniconda3/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1325, in cythonize_one_helper
          return cythonize_one(*m)
                 ^^^^^^^^^^^^^^^^^
        File "/Users/abhiver/miniconda3/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1301, in cythonize_one
          raise CompileError(None, pyx_file)
      Cython.Compiler.Errors.CompileError: sklearn/utils/_fast_dict.pyx
      Traceback (most recent call last):
        File "/Users/abhiver/miniconda3/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1325, in cythonize_one_helper
          return cythonize_one(*m)
                 ^^^^^^^^^^^^^^^^^
        File "/Users/abhiver/miniconda3/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1301, in cythonize_one
          raise CompileError(None, pyx_file)
      Cython.Compiler.Errors.CompileError: sklearn/neighbors/_ball_tree.pyx
      Traceback (most recent call last):
        File "/Users/abhiver/miniconda3/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1325, in cythonize_one_helper
          return cythonize_one(*m)
                 ^^^^^^^^^^^^^^^^^
        File "/Users/abhiver/miniconda3/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1301, in cythonize_one
          raise CompileError(None, pyx_file)
      Cython.Compiler.Errors.CompileError: sklearn/tree/_splitter.pyx
      Traceback (most recent call last):
        File "/Users/abhiver/miniconda3/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1325, in cythonize_one_helper
          return cythonize_one(*m)
                 ^^^^^^^^^^^^^^^^^
        File "/Users/abhiver/miniconda3/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1301, in cythonize_one
          raise CompileError(None, pyx_file)
      Cython.Compiler.Errors.CompileError: sklearn/tree/_tree.pyx
      multiprocessing.pool.RemoteTraceback:
      """
      Traceback (most recent call last):
        File "/Users/abhiver/miniconda3/lib/python3.11/multiprocessing/pool.py", line 125, in worker
          result = (True, func(*args, **kwds))
                          ^^^^^^^^^^^^^^^^^^^
        File "/Users/abhiver/miniconda3/lib/python3.11/multiprocessing/pool.py", line 48, in mapstar
          return list(map(*args))
                 ^^^^^^^^^^^^^^^^
        File "/Users/abhiver/miniconda3/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1325, in cythonize_one_helper
          return cythonize_one(*m)
                 ^^^^^^^^^^^^^^^^^
        File "/Users/abhiver/miniconda3/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1301, in cythonize_one
          raise CompileError(None, pyx_file)
      Cython.Compiler.Errors.CompileError: sklearn/svm/_liblinear.pyx
      """
      
      The above exception was the direct cause of the following exception:
      
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/w1/10bd4dgn3031ktj_0l5_c1hw0000gn/T/pip-install-c1rih6yx/scikit-learn_89370ec45e394af58b356e7dd81b681a/setup.py", line 303, in <module>
      [ 5/50] Cythonizing sklearn/cluster/_k_means_elkan.pyx
      [22/50] Cythonizing sklearn/linear_model/_sgd_fast.pyx
      [39/50] Cythonizing sklearn/tree/_utils.pyx
      [12/50] Cythonizing sklearn/ensemble/_hist_gradient_boosting/_gradient_boosting.pyx
      [25/50] Cythonizing sklearn/metrics/_pairwise_fast.pyx
      [43/50] Cythonizing sklearn/utils/_openmp_helpers.pyx
      [44/50] Cythonizing sklearn/utils/_random.pyx
      [48/50] Cythonizing sklearn/utils/graph_shortest_path.pyx
      [11/50] Cythonizing sklearn/ensemble/_hist_gradient_boosting/_binning.pyx
      [20/50] Cythonizing sklearn/linear_model/_cd_fast.pyx
      [45/50] Cythonizing sklearn/utils/_seq_dataset.pyx
      [49/50] Cythonizing sklearn/utils/murmurhash.pyx
      [10/50] Cythonizing sklearn/ensemble/_gradient_boosting.pyx
      [21/50] Cythonizing sklearn/linear_model/_sag_fast.pyx
      [30/50] Cythonizing sklearn/neighbors/_quad_tree.pyx
      [42/50] Cythonizing sklearn/utils/_logistic_sigmoid.pyx
          setup_package()
        File "/private/var/folders/w1/10bd4dgn3031ktj_0l5_c1hw0000gn/T/pip-install-c1rih6yx/scikit-learn_89370ec45e394af58b356e7dd81b681a/setup.py", line 299, in setup_package
          setup(**metadata)
        File "/Users/abhiver/miniconda3/lib/python3.11/site-packages/numpy/distutils/core.py", line 135, in setup
      [ 6/50] Cythonizing sklearn/cluster/_k_means_fast.pyx
      [24/50] Cythonizing sklearn/manifold/_utils.pyx
      [28/50] Cythonizing sklearn/neighbors/_dist_metrics.pyx
      [41/50] Cythonizing sklearn/utils/_fast_dict.pyx
      [ 2/50] Cythonizing sklearn/_isotonic.pyx
      [27/50] Cythonizing sklearn/neighbors/_ball_tree.pyx
      [ 7/50] Cythonizing sklearn/datasets/_svmlight_format_fast.pyx
      [16/50] Cythonizing sklearn/ensemble/_hist_gradient_boosting/histogram.pyx
      [37/50] Cythonizing sklearn/tree/_splitter.pyx
      [ 1/50] Cythonizing sklearn/__check_build/_check_build.pyx
      [13/50] Cythonizing sklearn/ensemble/_hist_gradient_boosting/_loss.pyx
      [18/50] Cythonizing sklearn/ensemble/_hist_gradient_boosting/utils.pyx
      [33/50] Cythonizing sklearn/svm/_liblinear.pyx
      [35/50] Cythonizing sklearn/svm/_libsvm_sparse.pyx
      [40/50] Cythonizing sklearn/utils/_cython_blas.pyx
          config = configuration()
                   ^^^^^^^^^^^^^^^
        File "/private/var/folders/w1/10bd4dgn3031ktj_0l5_c1hw0000gn/T/pip-install-c1rih6yx/scikit-learn_89370ec45e394af58b356e7dd81b681a/setup.py", line 182, in configuration
          config.add_subpackage('sklearn')
        File "/Users/abhiver/miniconda3/lib/python3.11/site-packages/numpy/distutils/misc_util.py", line 1050, in add_subpackage
          config_list = self.get_subpackage(subpackage_name, subpackage_path,
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/abhiver/miniconda3/lib/python3.11/site-packages/numpy/distutils/misc_util.py", line 1016, in get_subpackage
          config = self._get_configuration_from_setup_py(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/abhiver/miniconda3/lib/python3.11/site-packages/numpy/distutils/misc_util.py", line 958, in _get_configuration_from_setup_py
          config = setup_module.configuration(*args)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/w1/10bd4dgn3031ktj_0l5_c1hw0000gn/T/pip-install-c1rih6yx/scikit-learn_89370ec45e394af58b356e7dd81b681a/sklearn/setup.py", line 86, in configuration
          cythonize_extensions(top_path, config)
        File "/private/var/folders/w1/10bd4dgn3031ktj_0l5_c1hw0000gn/T/pip-install-c1rih6yx/scikit-learn_89370ec45e394af58b356e7dd81b681a/sklearn/_build_utils/__init__.py", line 75, in cythonize_extensions
          config.ext_modules = cythonize(
                               ^^^^^^^^^^
        File "/Users/abhiver/miniconda3/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1125, in cythonize
          result.get(99999)  # seconds
          ^^^^^^^^^^^^^^^^^
        File "/Users/abhiver/miniconda3/lib/python3.11/multiprocessing/pool.py", line 774, in get
          raise self._value
      Cython.Compiler.Errors.CompileError: sklearn/svm/_liblinear.pyx
      [ 3/50] Cythonizing sklearn/cluster/_dbscan_inner.pyx
      [14/50] Cythonizing sklearn/ensemble/_hist_gradient_boosting/_predictor.pyx
      [26/50] Cythonizing sklearn/metrics/cluster/_expected_mutual_info_fast.pyx
      [29/50] Cythonizing sklearn/neighbors/_kd_tree.pyx
      [47/50] Cythonizing sklearn/utils/arrayfuncs.pyx
      [ 9/50] Cythonizing sklearn/decomposition/_online_lda_fast.pyx
      [15/50] Cythonizing sklearn/ensemble/_hist_gradient_boosting/common.pyx
      [17/50] Cythonizing sklearn/ensemble/_hist_gradient_boosting/splitting.pyx
      [31/50] Cythonizing sklearn/neighbors/_typedefs.pyx
      [34/50] Cythonizing sklearn/svm/_libsvm.pyx
      [38/50] Cythonizing sklearn/tree/_tree.pyx
      [ 4/50] Cythonizing sklearn/cluster/_hierarchical_fast.pyx
      [23/50] Cythonizing sklearn/manifold/_barnes_hut_tsne.pyx
      [36/50] Cythonizing sklearn/tree/_criterion.pyx
      [50/50] Cythonizing sklearn/utils/sparsefuncs_fast.pyx
      [ 8/50] Cythonizing sklearn/decomposition/_cdnmf_fast.pyx
      [19/50] Cythonizing sklearn/feature_extraction/_hashing_fast.pyx
      [32/50] Cythonizing sklearn/preprocessing/_csr_polynomial_expansion.pyx
      [46/50] Cythonizing sklearn/utils/_weight_vector.pyx
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for scikit-learn
  Running setup.py clean for scikit-learn
Failed to build scikit-learn
ERROR: Could not build wheels for scikit-learn, which is required to install pyproject.toml-based projects

### Versions

```shell
System:
    python: 3.11.4 | packaged by conda-forge | (main, Jun 10 2023, 18:08:41) [Clang 15.0.7 ]
executable: /Users/abhiver/miniconda3/bin/python3
   machine: macOS-13.3.1-arm64-arm-64bit

Python dependencies:
      sklearn: 1.3.0
          pip: 23.2.1
   setuptools: 68.0.0
        numpy: 1.25.2
        scipy: 1.11.1
       Cython: 3.0.0
       pandas: 2.0.3
   matplotlib: 3.7.2
       joblib: 1.3.2
threadpoolctl: 3.2.0

Built with OpenMP: True

threadpoolctl info:
       user_api: blas
   internal_api: openblas
    num_threads: 12
         prefix: libopenblas
       filepath: /Users/abhiver/miniconda3/lib/libopenblas.0.dylib
        version: 0.3.23
threading_layer: openmp
   architecture: VORTEX

       user_api: openmp
   internal_api: openmp
    num_threads: 12
         prefix: libomp
       filepath: /Users/abhiver/miniconda3/lib/libomp.dylib
        version: None
```

COMMENT:
Actually it is likely be a Cython 3 issue see work-around in https://github.com/scikit-learn/scikit-learn/issues/26858.

Labels: Bug, Needs Triage