Python 3: No module named 'sklearn.model_selection'
28,430
Solution 1
I think you install wrong version of sklearn.
Please try this:
import sklearn
print (sklearn.__version__)
0.17.1
If your version is below 0.18, please update with pip install -U scikit-learn
or pip3 install -U scikit-learn
If you have import Error
, please install sklearn with pip install scikit-learn
or pip3 install scikit-learn
Solution 2
Try this for python3
pip3 install -U scikit-learn
Solution 3
This command works for me in ubuntu and Python 2:
sudo apt-get install python-sklearn
For Python 3 use this command:
sudo apt install python3-sklearn
Author by
PineNuts0
Updated on February 07, 2020Comments
-
PineNuts0 over 4 years
I am trying to learn Neural Networks via the Keras Deep Learning Library in Python. I am using Python 3 and referencing this link: Tutorial Link
I try to run the code below but get the following error:
ImportError: No module named 'sklearn.model_selection'
import numpy import pandas from keras.models import Sequential from keras.layers import Dense from keras.wrappers.scikit_learn import KerasRegressor from sklearn.model_selection import cross_val_score from sklearn.model_selection import KFold from sklearn.preprocessing import StandardScaler from sklearn.pipeline import Pipeline
Any help is greatly appreciated!