Cannot import 'DistanceMetric' from 'sklearn.metrics'

### Discussed in https://github.com/scikit-learn/scikit-learn/discussions/24302

<div type='discussions-op-text'>

<sup>Originally posted by **anubhavde** August 30, 2022</sup>
# **ImportError: cannot import name 'DistanceMetric' from 'sklearn.metrics' (/home/linux/miniconda3/envs/python_ai/lib/python3.8/site-packages/sklearn/metrics/__init__.py)**

I know **DistanceMetric** can be found in ```sklearn.neighbors``` and not ```sklearn.metrics``` but I still recieve an ImportError. How do I solve this issue?

### **How to reproduce the Error:**
I am trying to run the following code 
```python
import gc, itertools
import scipy as sp 
import numpy as np 
from tqdm.auto import tqdm

import warnings
warnings.filterwarnings("ignore")

import pandas as pd
pd.set_option('display.max_rows', 500)
pd.set_option('display.max_columns', 500)
pd.set_option('display.width', 1000)

from sklearn.preprocessing import StandardScaler, OrdinalEncoder, MinMaxScaler
from sklearn.metrics import roc_auc_score, roc_curve
from sklearn.neighbors import DistanceMetric as _DistanceMetric
from imblearn.over_sampling import SMOTE
```

### **Error Message:**
```
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
/home/linux/Workspace/tabular-playground-series-aug-2022/submission.ipynb Cell 3 in <cell line: 16>()
     [14](vscode-notebook-cell:/home/linux/Workspace/tabular-playground-series-aug-2022/submission.ipynb#W0sZmlsZQ%3D%3D?line=13) from sklearn.preprocessing import StandardScaler, OrdinalEncoder, MinMaxScaler
     [15](vscode-notebook-cell:/home/linux/Workspace/tabular-playground-series-aug-2022/submission.ipynb#W0sZmlsZQ%3D%3D?line=14) from sklearn.metrics import roc_auc_score, roc_curve
---> [16](vscode-notebook-cell:/home/linux/Workspace/tabular-playground-series-aug-2022/submission.ipynb#W0sZmlsZQ%3D%3D?line=15) from sklearn.neighbors import DistanceMetric as _DistanceMetric
     [17](vscode-notebook-cell:/home/linux/Workspace/tabular-playground-series-aug-2022/submission.ipynb#W0sZmlsZQ%3D%3D?line=16) from imblearn.over_sampling import SMOTE

File ~/miniconda3/envs/python_ai/lib/python3.8/site-packages/sklearn/neighbors/__init__.py:8, in <module>
      6 from ._ball_tree import BallTree
      7 from ._kd_tree import KDTree
----> 8 from ._distance_metric import DistanceMetric
      9 from ._graph import kneighbors_graph, radius_neighbors_graph
     10 from ._graph import KNeighborsTransformer, RadiusNeighborsTransformer

File ~/miniconda3/envs/python_ai/lib/python3.8/site-packages/sklearn/neighbors/_distance_metric.py:4, in <module>
      1 # TODO: Remove this file in 1.3
      2 import warnings
----> 4 from ..metrics import DistanceMetric as _DistanceMetric
      7 class DistanceMetric(_DistanceMetric):
      8     @classmethod
      9     def _warn(cls):

ImportError: cannot import name 'DistanceMetric' from 'sklearn.metrics' (/home/linux/miniconda3/envs/python_ai/lib/python3.8/site-packages/sklearn/metrics/__init__.py)
```

### **System/Environment Details**
OS: Manjaro Linux x86_64 
Kernel: 5.15.60-1-MANJARO 
Scikit-learn: 1.1.2
</div>

COMMENT:
I cannot reproduce:

```python
In [1]: import sklearn

In [2]: sklearn.__version__
Out[2]: '1.1.2'

In [3]: from sklearn.neighbors import DistanceMetric

In [4]: DistanceMetric
Out[4]: sklearn.neighbors._distance_metric.DistanceMetric
```

Could you provide the `sklearn.show_versions()` output:

```python
In [5]: sklearn.show_versions()

System:
    python: 3.10.5 | packaged by conda-forge | (main, Jun 14 2022, 07:05:37) [Clang 13.0.1 ]
executable: /Users/glemaitre/mambaforge/envs/europython/bin/python3.10
   machine: macOS-12.5.1-arm64-arm-64bit

Python dependencies:
      sklearn: 1.1.2
          pip: 22.1.2
   setuptools: 63.1.0
        numpy: 1.23.2
        scipy: 1.9.0
       Cython: None
       pandas: None
   matplotlib: None
       joblib: 1.1.0
threadpoolctl: 3.1.0

Built with OpenMP: True

threadpoolctl info:
       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: /Users/glemaitre/mambaforge/envs/europython/lib/libopenblas.0.dylib
        version: 0.3.21
threading_layer: openmp
   architecture: VORTEX
    num_threads: 8

       user_api: openmp
   internal_api: openmp
         prefix: libomp
       filepath: /Users/glemaitre/mambaforge/envs/europython/lib/libomp.dylib
        version: None
    num_threads: 8
```

The only thing that I can think of is that the version that make the import is no 1.1.2

Labels: Needs Triage