'Cant import sklearn

skitlear is installed, however whe I run import sklearn i get an error: ModuleNotFoundError: No module named 'sklearn' please see bellow:

System:
    python: 3.8.8 (default, Apr 13 2021, 15:08:03) [MSC v.1916 64 bit (AMD64)]
executable: C:\Users\33826\Anaconda3\python.exe
   machine: Windows-10-10.0.19041-SP0

Python dependencies:
          pip: 21.2.2
   setuptools: 58.0.4
      sklearn: 1.0.2
        numpy: 1.21.5
        scipy: 1.4.1
       Cython: None
       pandas: 1.4.1
   matplotlib: 3.5.0
       joblib: 1.1.0
threadpoolctl: 2.2.0

Built with OpenMP: True
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_21264/3775665260.py in <module>
      1 get_ipython().system('python -c "import sklearn; sklearn.show_versions()')
----> 2 import sklearn

ModuleNotFoundError: No module named 'sklearn' 

EDITED as per Laci request

1.Output for jupyter kernelspec list:

Available kernels:
  python3    C:\Users\xxx\AppData\Roaming\jupyter\kernels\python3

2.Kernel.json content:

{
 "argv": [
  "C:\\Users\\33826\\Anaconda3\\envs\\tf_plates\\python.exe",
  "-m",
  "ipykernel_launcher",
  "-f",
  "{connection_file}"
 ],
 "display_name": "Python 3 (ipykernel)",
 "language": "python",
 "metadata": {
  "debugger": true
 }
}

3.Output of where python:

C:\Users\xxx\Anaconda3\python.exe
C:\Users\xxx\AppData\Local\Microsoft\WindowsApps\python.exe


Solution 1:[1]

Go to anaconda cmd or miniconda cmd and put this

conda install -c anaconda scikit-learn

after that restart spyder or pycharm

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 suhaib