sklearn import error - ImportError: cannot import name 'comb'

Viewed 25516

I am trying to do this:

from sklearn.model_selection import train_test_split

and getting an error:

In [31]: from sklearn.model_selection import train_test_split
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-31-73edc048c06b> in <module>()
----> 1 from sklearn.model_selection import train_test_split

/usr/local/lib/python3.6/site-packages/sklearn/model_selection/__init__.py in <module>()
----> 1 from ._split import BaseCrossValidator
      2 from ._split import KFold
      3 from ._split import GroupKFold
      4 from ._split import StratifiedKFold
      5 from ._split import TimeSeriesSplit

/usr/local/lib/python3.6/site-packages/sklearn/model_selection/_split.py in <module>()
     29 from ..externals.six import with_metaclass
     30 from ..externals.six.moves import zip
---> 31 from ..utils.fixes import signature, comb
     32 from ..base import _pprint
     33 

ImportError: cannot import name 'comb'

any help would be much apreciated.

2 Answers

I had the same error. conda remove --name your environment --all. Next, re-install the environment. It worked for me.

Related