Import Error on importing sklearn in Python

Viewed 23837

I am new to python and installed it in windows OS and while following Google's machine learning tutorial on youtube, i encountered an error while importing the scikit package.

I installed the Anaconda package as shown in the tutorial but when importing sklearn i get an import error.

import sklearn

i also tried

from sklearn import tree

This is the error

Traceback (most recent call last):
  File "C:\Users\Raj Asha\Desktop\hello-world.py", line 2, in <module>
    from sklearn import tree
ModuleNotFoundError: No module named 'sklearn'

python version is 3.6.1

link to tutorial video https://www.youtube.com/watch?v=cKxRvEZd3Mw

3 Answers

I tried multiple solutions, but none of them worked. I installed the wheel files:

scipy-1.8.0-cp310-cp310-win_amd64.whl
numpy-1.22.3+mkl-cp310-cp310-win_amd64.whl
scikit_learn-1.0.2-cp310-cp310-win_amd64.whl

But I got error in: import sklearn

In my case, I was able to solve this by installing the whl file of the joblib (before, do: pip install wheel).

Download: https://github.com/wikimedia/research-ores-wheels/blob/master/joblib-0.14.1-py2.py3-none-any.whl

pip uninstall joblib
pip install .../joblib-0.14.1-py2.py3-none-any.whl

update your anaconda and python. I had the same problem. had to change my windows from 7 to 10 because python 3.9 doesn't support windows 7 or earlier anymore

Related