Module scikit_learn not found even after installation

Viewed 57

I have installed the scikit_learn module with pip install scikit_learn in Spyder and got the message:

Requirement already satisfied: scikit_learn in c:\users\ycr700\anaconda3\lib\site-packages (0.24.1)
Requirement already satisfied: numpy>=1.13.3 in c:\users\ycr700\anaconda3\lib\site-packages (from scikit_learn) (1.20.1)
Requirement already satisfied: threadpoolctl>=2.0.0 in c:\users\ycr700\anaconda3\lib\site-packages (from scikit_learn) (2.1.0)
Requirement already satisfied: joblib>=0.11 in c:\users\ycr700\anaconda3\lib\site-packages (from scikit_learn) (1.0.1)
Requirement already satisfied: scipy>=0.19.1 in c:\users\ycr700\anaconda3\lib\site-packages (from scikit_learn) (1.6.2)
Note: you may need to restart the kernel to use updated packages.

However, when I run import scikit_learn afterwards I get the ModuleNotFoundError. Weirdly enough I don't see a scikit_learn folder in the path c:\users\ycr700\anaconda3\lib\site-packages, which I do for other packages.

How to resolve this issue?

1 Answers

Some python modules have different names between pip install and import, this is one of them. Use import sklearn instead.

It's always worth checking out the getting started guides if the module has one to look for things like this.

Related