Scikit-optimize: Import failed "No module named 'sklearn.ensemble'"

Created on 1 Apr 2018  路  4Comments  路  Source: scikit-optimize/scikit-optimize

win10 x64
python 3.5.4
scikit-cuda 0.5.1
scikit-image 0.13.1
scikit-learn 0.19.1
scikit-optimize 0.5.2

>>> from skopt import gp_minimize
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Anaconda3\Lib\site-packages\skopt\__init__.py", line 52, in <module>
    from . import learning
  File "C:\Anaconda3\Lib\site-packages\skopt\learning\__init__.py", line 3, in <module>
    from .forest import RandomForestRegressor
  File "C:\Anaconda3\Lib\site-packages\skopt\learning\forest.py", line 2, in <module>
    from sklearn.ensemble import RandomForestRegressor as _sk_RandomForestRegressor
ImportError: No module named 'sklearn.ensemble'
>>>

Most helpful comment

install these ==>> pip install -U scikit-learn scipy matplotlib
if still getting the same error then ,
make sure that your imoprted statment should be correct. i made the mistike while writing ensemble so ,(check spelling)
its
should be from sklearn.ensemble import RandomForestClassifier

All 4 comments

fixed by reinstalling sklearn

Hi, I am using sklearn through Anaconda and tried to reinstall it. It still doesn't work.

install these ==>> pip install -U scikit-learn scipy matplotlib
if still getting the same error then ,
make sure that your imoprted statment should be correct. i made the mistike while writing ensemble so ,(check spelling)
its
should be from sklearn.ensemble import RandomForestClassifier

I solved this issue by updating my sklearn.
you can use this code ==>> pip install scikit-learn==0.22.2 --user

Was this page helpful?
0 / 5 - 0 ratings