No module named 'sklearn' even though it is installed and seen in pip list

Viewed 29

I have installed python 3.10 and pip by itself (without conda or anything else) on Windows 11 64 bit.

I have a working Jupyter notebook setup, but can't get sklearn to work.

When I run the following command inside of the jupyter notebook I get:

! pip list

Package            Version
------------------ ---------
certifi            2022.6.15
charset-normalizer 2.1.1
distlib            0.3.6
filelock           3.8.0
idna               3.3
joblib             1.2.0
numpy              1.23.3
pip                22.2.2
platformdirs       2.5.2
requests           2.28.1
scikit-learn       1.0.2
scipy              1.9.1
setuptools         58.1.0
sklearn            0.0
threadpoolctl      3.1.0
urllib3            1.26.12
virtualenv         20.16.3

But in the next cell I run this code, and get the following error

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

from sklearn import tree
from sklearn.model_selection import train_test_split


ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-24-21e1a2676f4e> in <module>
      3 import matplotlib.pyplot as plt
      4 
----> 5 from sklearn import tree
      6 from sklearn.model_selection import train_test_split

ModuleNotFoundError: No module named 'sklearn'

I have tried uninstalling the module, reinstalling it. Restarting the computer, restarting the notebook, restarting the kernel. Tried installing it throguh commandline, PowerShell and through Jupyter notebook.

0 Answers
Related