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:
> Could you provide the `sklearn.show_versions()` output:

Here is the output for ```sklearn.show_versions()```:
```console
$ python                      
Python 3.8.13 (default, Mar 28 2022, 11:38:47) 
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sklearn
>>> sklearn.show_versions()

System:
    python: 3.8.13 (default, Mar 28 2022, 11:38:47)  [GCC 7.5.0]
executable: /home/linux/miniconda3/envs/python_ai/bin/python
   machine: Linux-5.15.60-1-MANJARO-x86_64-with-glibc2.17

Python dependencies:
      sklearn: 1.1.2
          pip: 22.1.2
   setuptools: 59.5.0
        numpy: 1.22.4
        scipy: 1.8.1
       Cython: 0.29.32
       pandas: 1.1.5
   matplotlib: 3.5.3
       joblib: 1.1.0
threadpoolctl: 3.1.0

Built with OpenMP: True

threadpoolctl info:
       user_api: openmp
   internal_api: openmp
         prefix: libgomp
       filepath: /home/linux/miniconda3/envs/python_ai/lib/python3.8/site-packages/scikit_learn.libs/libgomp-a34b3233.so.1.0.0
        version: None
    num_threads: 12

       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: /home/linux/miniconda3/envs/python_ai/lib/python3.8/site-packages/numpy.libs/libopenblas64_p-r0-2f7c42d4.3.18.so
        version: 0.3.18
threading_layer: pthreads
   architecture: Haswell
    num_threads: 12

       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: /home/linux/miniconda3/envs/python_ai/lib/python3.8/site-packages/scipy.libs/libopenblasp-r0-8b9e111f.3.17.so
        version: 0.3.17
threading_layer: pthreads
   architecture: Haswell
    num_threads: 12
>>> 

```

As you can see my sklearn version is 1.1.2, still I'm facing this issue.

Labels: Needs Triage