Cython error while installing development version on MacOS M2 chip

### Describe the bug

Hello - While working on  #16236 , I am getting a Cython error  . 

 I pulled  the latest version of Scikit Learn from the main branch . I am following the instructions here  to install the development version of Scikit learn . 
https://scikit-learn.org/stable/developers/advanced_installation.html#macos

I am not able to get rid of this error : 

```Error compiling Cython file:

...
cimport numpy as cnp
from libc.math cimport sqrt, exp

from ..utils._typedefs cimport DTYPE_t, ITYPE_t, SPARSE_INDEX_TYPE_t
^
```


### Steps/Code to Reproduce

```
(sklearn-dev) gauravchawla@Gauravs-Air scikit-learn % conda activate sklearn-dev
make clean
pip install --editable . \
    --verbose --no-build-isolation \
    --config-settings editable-verbose=true

-----------------------------------------------------------------------------------------------
(sklearn-dev) gauravchawla@Gauravs-Air scikit-learn % conda info

     active environment : sklearn-dev
    active env location : /opt/anaconda3/envs/sklearn-dev
            shell level : 2
       user config file : /Users/gauravchawla/.condarc
 populated config files : /opt/anaconda3/.condarc
                          /Users/gauravchawla/.condarc
conda version : 24.9.2
conda-build version : 24.9.0
python version : 3.12.7.final.0
solver : libmamba (default)
 virtual packages : __archspec=1=m2
                          __conda=24.9.2=0
                          __osx=14.2.1=0
                          __unix=0=0
       base environment : /opt/anaconda3  (writable)
      conda av data dir : /opt/anaconda3/etc/conda
       conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/osx-arm64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.anaconda.com/pkgs/main/osx-arm64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/osx-arm64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /opt/anaconda3/pkgs
                          /Users/gauravchawla/.conda/pkgs
       envs directories : /opt/anaconda3/envs
                          /Users/gauravchawla/.conda/envs
               platform : osx-arm64
             user-agent : conda/24.9.2 requests/2.32.3 CPython/3.12.7 Darwin/23.2.0 OSX/14.2.1 solver/libmamba conda-libmamba-solver/24.9.0 libmambapy/1.5.8 aau/0.4.4 c/. s/. e/.
                UID:GID : 501:20
             netrc file : None
           offline mode : False
```

### Expected Results

No Error Thrown 

### Actual Results

**Full stacktrace :** 

```
(sklearn-dev) gauravchawla@Gauravs-Air scikit-learn % conda activate sklearn-dev
make clean
pip install --editable . \
    --verbose --no-build-isolation \
    --config-settings editable-verbose=true
pip uninstall -y scikit-learn
WARNING: Skipping scikit-learn as it is not installed.
# It seems in some cases removing the folder avoids weird compilation
# errors (e.g. when switching from numpy>=2 to numpy<2). For some
# reason ninja clean -C build/cp313 is not
# enough.
rm -rf build/cp313
Using pip 24.3.1 from /opt/anaconda3/envs/sklearn-dev/lib/python3.13/site-packages/pip (python 3.13)
Obtaining file:///Users/gauravchawla/Documents/scikitlearn/scikit-learn
  Running command Checking if build backend supports build_editable
  Checking if build backend supports build_editable ... done
  Running command Preparing editable metadata (pyproject.toml)
  + meson setup /Users/gauravchawla/Documents/scikitlearn/scikit-learn /Users/gauravchawla/Documents/scikitlearn/scikit-learn/build/cp313 -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=/Users/gauravchawla/Documents/scikitlearn/scikit-learn/build/cp313/meson-python-native-file.ini
  The Meson build system
  Version: 1.6.0
  Source dir: /Users/gauravchawla/Documents/scikitlearn/scikit-learn
  Build dir: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/build/cp313
  Build type: native build
  Project name: scikit-learn
  Project version: 1.7.dev0
  C compiler for the host machine: arm64-apple-darwin20.0.0-clang (clang 17.0.6 "clang version 17.0.6")
  C linker for the host machine: arm64-apple-darwin20.0.0-clang ld64 951.9
  C++ compiler for the host machine: arm64-apple-darwin20.0.0-clang++ (clang 17.0.6 "clang version 17.0.6")
  C++ linker for the host machine: arm64-apple-darwin20.0.0-clang++ ld64 951.9
  Cython compiler for the host machine: cython (cython 3.0.11)
  Host machine cpu family: aarch64
  Host machine cpu: aarch64
  Compiler for C supports arguments -Wno-unused-but-set-variable: YES
  Compiler for C supports arguments -Wno-unused-function: YES
  Compiler for C supports arguments -Wno-conversion: YES
  Compiler for C supports arguments -Wno-misleading-indentation: YES
  Library m found: YES
  Program python found: YES (/opt/anaconda3/envs/sklearn-dev/bin/python3.13)
  Run-time dependency OpenMP for c found: YES 5.1
  Found pkg-config: YES (/opt/homebrew/bin/pkg-config) 2.3.0
  Run-time dependency python found: YES 3.13
  Build targets in project: 111

  scikit-learn 1.7.dev0

    User defined options
      Native files: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/build/cp313/meson-python-native-file.ini
      b_ndebug    : if-release
      b_vscrt     : md
      buildtype   : release

  Found ninja-1.12.1 at /opt/anaconda3/envs/sklearn-dev/bin/ninja

  Generating targets:   0%|          | 0/111 eta ?
  Generating targets:  17%|█▋        | 19/111 eta 00:00


  Writing build.ninja:   0%|          | 0/347 eta ?

  + /opt/anaconda3/envs/sklearn-dev/bin/ninja
  [1/251] Copying file sklearn/utils/_cython_blas.pxd
  [2/251] Copying file sklearn/utils/__init__.py
  [3/251] Copying file sklearn/utils/_sorting.pxd
  [4/251] Copying file sklearn/utils/_typedefs.pxd
  [5/251] Copying file sklearn/_loss/_loss.pxd
  [6/251] Generating sklearn/utils/_weight_vector_pxd with a custom command
  [7/251] Copying file sklearn/utils/_heap.pxd
  [8/251] Generating sklearn/utils/_seq_dataset_pxd with a custom command
  [9/251] Copying file sklearn/__init__.py
  [10/251] Copying file sklearn/utils/_vector_sentinel.pxd
  [11/251] Generating sklearn/metrics/_dist_metrics_pxd with a custom command
  [12/251] Generating sklearn/metrics/_pairwise_distances_reduction/_datasets_pair_pxd with a custom command
  [13/251] Copying file sklearn/utils/_openmp_helpers.pxd
  [14/251] Generating sklearn/metrics/_pairwise_distances_reduction/_base_pxd with a custom command
  [15/251] Generating sklearn/metrics/_pairwise_distances_reduction/_argkmin_pxd with a custom command
  [16/251] Generating sklearn/metrics/_pairwise_distances_reduction/_radius_neighbors_pxd with a custom command
  [17/251] Generating sklearn/neighbors/_binary_tree_pxi with a custom command
  [18/251] Copying file sklearn/utils/_random.pxd
  [19/251] Copying file sklearn/metrics/_pairwise_distances_reduction/_classmode.pxd
  [20/251] Copying file sklearn/metrics/_pairwise_distances_reduction/__init__.py
  [21/251] Copying file sklearn/metrics/__init__.py
  [22/251] Generating sklearn/metrics/_pairwise_distances_reduction/_middle_term_computer_pxd with a custom command
  [23/251] Generating sklearn/utils/_seq_dataset_pyx with a custom command
  [24/251] Generating sklearn/utils/_weight_vector_pyx with a custom command
  [25/251] Generating sklearn/_loss/_loss_pyx with a custom command
  [26/251] Copying file sklearn/neighbors/_partition_nodes.pxd
  [27/251] Generating sklearn/metrics/_pairwise_distances_reduction/_base_pyx with a custom command
  [28/251] Copying file sklearn/linear_model/__init__.py
  [29/251] Copying file sklearn/neighbors/__init__.py
  [30/251] Generating sklearn/metrics/_pairwise_distances_reduction/_middle_term_computer_pyx with a custom command
  [31/251] Generating sklearn/metrics/_pairwise_distances_reduction/_argkmin_classmode_pyx with a custom command
  [32/251] Generating sklearn/metrics/_dist_metrics_pyx with a custom command
  [33/251] Generating sklearn/metrics/_pairwise_distances_reduction/_datasets_pair_pyx with a custom command
  [34/251] Generating sklearn/metrics/_pairwise_distances_reduction/_radius_neighbors_classmode_pyx with a custom command
  [35/251] Generating sklearn/metrics/_pairwise_distances_reduction/_argkmin_pyx with a custom command
  [36/251] Generating sklearn/linear_model/_sag_fast_pyx with a custom command
  [37/251] Generating sklearn/metrics/_pairwise_distances_reduction/_radius_neighbors_pyx with a custom command
  [38/251] Generating sklearn/linear_model/_sgd_fast_pyx with a custom command
  [39/251] Generating sklearn/neighbors/_ball_tree_pyx with a custom command
  [40/251] Generating sklearn/neighbors/_kd_tree_pyx with a custom command
  [41/251] Compiling Cython source /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/__check_build/_check_build.pyx
  [42/251] Compiling Cython source /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/utils/_openmp_helpers.pyx
  [43/251] Compiling Cython source /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/utils/murmurhash.pyx
  [44/251] Compiling Cython source /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/utils/_heap.pyx
  [45/251] Compiling Cython source /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/utils/_fast_dict.pyx
  [46/251] Compiling Cython source /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/_isotonic.pyx
  [47/251] Compiling Cython source /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/utils/arrayfuncs.pyx
  [48/251] Compiling Cython source /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/utils/_random.pyx
  [49/251] Compiling Cython source /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/utils/_typedefs.pyx
  [50/251] Compiling Cython source /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/utils/_sorting.pyx
  [51/251] Compiling Cython source /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/utils/_cython_blas.pyx
  [52/251] Compiling Cython source /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/utils/_vector_sentinel.pyx
  [53/251] Compiling Cython source /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/utils/sparsefuncs_fast.pyx
  [54/251] Compiling Cython source /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/utils/_isfinite.pyx
  [55/251] Compiling Cython source sklearn/utils/_seq_dataset.pyx
  [56/251] Compiling Cython source sklearn/utils/_weight_vector.pyx
  [57/251] Compiling Cython source /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_pairwise_fast.pyx
  [58/251] Compiling Cython source sklearn/metrics/_pairwise_distances_reduction/_datasets_pair.pyx
  [59/251] Compiling Cython source sklearn/metrics/_pairwise_distances_reduction/_base.pyx
  [60/251] Compiling Cython source sklearn/metrics/_pairwise_distances_reduction/_middle_term_computer.pyx
  [61/251] Compiling Cython source sklearn/metrics/_pairwise_distances_reduction/_argkmin.pyx
  [62/251] Compiling Cython source sklearn/metrics/_pairwise_distances_reduction/_argkmin_classmode.pyx
  [63/251] Compiling Cython source sklearn/metrics/_dist_metrics.pyx
  warning: sklearn/metrics/_dist_metrics.pyx:855:44: Assigning to 'float64_t *' from 'const float64_t *' discards const qualifier
  warning: sklearn/metrics/_dist_metrics.pyx:918:40: Assigning to 'float64_t *' from 'const float64_t *' discards const qualifier
  warning: sklearn/metrics/_dist_metrics.pyx:3435:44: Assigning to 'float32_t *' from 'const float32_t *' discards const qualifier
  warning: sklearn/metrics/_dist_metrics.pyx:3498:40: Assigning to 'float32_t *' from 'const float32_t *' discards const qualifier
  [64/251] Compiling Cython source /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/cluster/_expected_mutual_info_fast.pyx
  [65/251] Compiling Cython source /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/cluster/_dbscan_inner.pyx
  [66/251] Compiling Cython source /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/cluster/_hierarchical_fast.pyx
  FAILED: sklearn/cluster/_hierarchical_fast.cpython-313-darwin.so.p/sklearn/cluster/_hierarchical_fast.pyx.cpp
  cython -M --fast-fail -3 --cplus '-X language_level=3' '-X boundscheck=False' '-X wraparound=False' '-X initializedcheck=False' '-X nonecheck=False' '-X cdivision=True' '-X profile=False' --include-dir /Users/gauravchawla/Documents/scikitlearn/scikit-learn/build/cp313 /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/cluster/_hierarchical_fast.pyx -o sklearn/cluster/_hierarchical_fast.cpython-313-darwin.so.p/sklearn/cluster/_hierarchical_fast.pyx.cpp
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:15:17: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:28:17: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:37:79: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:41:79: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:64:21: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:71:21: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:84:21: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:97:21: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:119:21: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:131:21: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:133:68: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:135:67: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:146:17: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:159:17: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:168:87: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:172:87: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:195:21: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:202:21: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:215:21: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:228:21: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:250:21: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:262:21: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:264:74: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:266:73: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cimport numpy as cnp
  from libc.math cimport sqrt, exp

  from ..utils._typedefs cimport DTYPE_t, ITYPE_t, SPARSE_INDEX_TYPE_t
  ^
  ------------------------------------------------------------

  /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:4:0: 'sklearn/utils/_typedefs/DTYPE_t.pxd' not found
  [67/251] Compiling Cython source sklearn/metrics/_pairwise_distances_reduction/_radius_neighbors_classmode.pyx
  [68/251] Compiling Cython source sklearn/metrics/_pairwise_distances_reduction/_radius_neighbors.pyx
  [69/251] Compiling Cython source /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/cluster/_hdbscan/_linkage.pyx
  FAILED: sklearn/cluster/_hdbscan/_linkage.cpython-313-darwin.so.p/sklearn/cluster/_hdbscan/_linkage.pyx.c
  cython -M --fast-fail -3 '-X language_level=3' '-X boundscheck=False' '-X wraparound=False' '-X initializedcheck=False' '-X nonecheck=False' '-X cdivision=True' '-X profile=False' --include-dir /Users/gauravchawla/Documents/scikitlearn/scikit-learn/build/cp313 /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/cluster/_hdbscan/_linkage.pyx -o sklearn/cluster/_hdbscan/_linkage.cpython-313-darwin.so.p/sklearn/cluster/_hdbscan/_linkage.pyx.c
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:15:17: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:28:17: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:37:79: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:41:79: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:64:21: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:71:21: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:84:21: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:97:21: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:119:21: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:131:21: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:133:68: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:135:67: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:146:17: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:159:17: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:168:87: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:172:87: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:195:21: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:202:21: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:215:21: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:228:21: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:250:21: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:262:21: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:264:74: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
  warning: /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:266:73: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cimport numpy as cnp
  from libc.math cimport sqrt, exp

  from ..utils._typedefs cimport DTYPE_t, ITYPE_t, SPARSE_INDEX_TYPE_t
  ^
  ------------------------------------------------------------

  /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/metrics/_dist_metrics.pxd:4:0: 'sklearn/utils/_typedefs/DTYPE_t.pxd' not found
  [70/251] Compiling Cython source /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/cluster/_k_means_minibatch.pyx
  [71/251] Compiling Cython source /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/cluster/_k_means_lloyd.pyx
  [72/251] Compiling Cython source /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/cluster/_k_means_common.pyx
  [73/251] Compiling Cython source /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/cluster/_k_means_elkan.pyx
  [74/251] Compiling Cython source /Users/gauravchawla/Documents/scikitlearn/scikit-learn/sklearn/cluster/_hdbscan/_reachability.pyx
  [75/251] Compiling Cython source sklearn/_loss/_loss.pyx
  ninja: build stopped: subcommand failed.
  error: subprocess-exited-with-error
  
  × Preparing editable metadata (pyproject.toml) 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: /opt/anaconda3/envs/sklearn-dev/bin/python3.13 /opt/anaconda3/envs/sklearn-dev/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py prepare_metadata_for_build_editable /var/folders/1d/r1qjn54145l1_rdt2l3bjhnh0000gn/T/tmpjrscyyb4
  cwd: /Users/gauravchawla/Documents/scikitlearn/scikit-learn
  Preparing editable metadata (pyproject.toml) ... 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
NA
```
'

COMMENT:
> Can you provide the versions of NumPy, SciPy and Cython?

Thank you for your response.
cython                    3.0.11 
numpy                     2.1.3
scipy                     1.14.1

Labels: Bug, Needs Triage