The Python Oracle

ImportError: No module named sklearn (Python)

This video explains
ImportError: No module named sklearn (Python)

--

Become part of the top 3% of the developers by applying to Toptal
https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Meditation

--

Chapters
00:00 Question
01:04 Accepted answer (Score 17)
01:30 Answer 2 (Score 7)
01:52 Answer 3 (Score 3)
02:03 Answer 4 (Score 1)
02:22 Thank you

--

Full question
https://stackoverflow.com/questions/3640...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #macos #scikitlearn

#avk47



ACCEPTED ANSWER

Score 17


Make sure that pip and python are the same version. For example if you run pip for python 2.7, it will install the package only in 2.7, and if your python command point to for example python 3.3 interpreter, it will not have that package




ANSWER 2

Score 10


you dont have the package scikit-learn installed, try this if you are in a terminal linux :

sudo pip install scikit-learn

if you want to install the package within your code use

import os 
os.system('sudo pip install scikit-learn')



ANSWER 3

Score 1


Not only for this package but also for almost cases, please try using python3 -m pip install sklearn if pip install sklearn does not work.




ANSWER 4

Score 0


I think you havent install sklearn, try this on your python terminal:

pip install sklearn

and proceed with your code