7

I'm trying to use the SMOTE package in the imblearn library using:

from imblearn.over_sampling import SMOTE

getting the following error message:

ImportError: cannot import name 'pairwise_distances_chunked'.

Here is a screenshot of my import screenshot of download confirmation

Really stumped on this, any guidance would be greatly appreciated.

sophros
  • 14,672
  • 11
  • 46
  • 75
Billy Hansen
  • 83
  • 1
  • 1
  • 6

4 Answers4

15

I have encountered a similar problem. I could solve by opening a new IPython console.

00__00__00
  • 4,834
  • 9
  • 41
  • 89
  • 2
    It finally worked for me too once I closed and re-opened Jupyter notebook. A bit of an odd dynamic but I guess that's the fix. – Billy Hansen Dec 04 '18 at 15:00
2

I know it's a bit late, but for anyone using Jupyter notebook, I could solve my problem by just restarting the kernel.

Link:

ImportError: cannot import name check_array from sklearn.utils.validation

0

Re-installing the package solved the issue.

conda install -c conda-forge imbalanced-learn
sammy ongaya
  • 1,313
  • 1
  • 15
  • 14
-1

I opened a new console after re-install Scikit-learn (python3 -m pip install -U scikit-learn; in Jupyter notebook), then it works.

horro
  • 1,262
  • 3
  • 20
  • 37