3

I have already installed sklearn, but when I ran a python file that import sklearn, I get this:

Traceback (most recent call last): File "first.py", line 3, in <module> from sklearn import datasets ModuleNotFoundError: No module named 'sklearn' 

This is the result when I installed sklearn:

Requirement already satisfied: scikit-learn in c:\users\user\appdata\local\programs\python\python38\lib\site-packages (0.24.0) Requirement already satisfied: numpy>=1.13.3 in c:\users\user\appdata\local\programs\python\python38\lib\site-packages (from scikit-learn) (1.19.4) Requirement already satisfied: scipy>=0.19.1 in c:\users\user\appdata\local\programs\python\python38\lib\site-packages (from scikit-learn) (1.5.4) Requirement already satisfied: threadpoolctl>=2.0.0 in c:\users\user\appdata\local\programs\python\python38\lib\site-packages (from scikit-learn) (2.1.0) Requirement already satisfied: joblib>=0.11 in c:\users\user\appdata\local\programs\python\python38\lib\site-packages (from scikit-learn) (1.0.0) 

3 Answers 3

5

"sklearn" have changed to "scikit-learn" and "sklearn" is no longer works.

So in terminal:

pip install -U scikit-learn 

more info in their site:

https://scikit-learn.org

https://scikit-learn.org/stable/install.html

Sign up to request clarification or add additional context in comments.

Comments

3

If you use anaconda you can still use pip to install packages:

pip install -U scikit-learn scipy matplotlib 

For Python 3.x use:

pip3 install -U scikit-learn scipy matplotlib 

Comments

1

Firstly, make sure you update pip to latest version:

python -m pip install --upgrade pip 

Then try:

pip install -U scikit-learn" on widnows terminal (cmd) 

or try it with conda(if you have it on your pc)

conda install scikit-learn 

also make sure you have installed numpy and scipy

pip install numpy pip install scipy 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.