Installing Python package sklearn fails

I’ve noticed that a module we have in SlicerHeart that uses sklearn always wants to install it. I tried to uninstall it and reinstall it, but import failed. Cleared the pip cache (PythonSlicer.exe -m pip cache remove *) but no improvement.

I tried it with the latest stable 5.2.1 and unfortunately it seems that after fresh-installing it and trying to import does not work:

>>> pip_install('sklearn')
[Python] Collecting sklearn
[Python] Using cached sklearn-0.0.post1.tar.gz (3.6 kB)
[Python] Preparing metadata ( started
[Python] Preparing metadata ( finished with status 'done'
[Python] Building wheels for collected packages: sklearn
[Python] Building wheel for sklearn ( started
[Python] Building wheel for sklearn ( finished with status 'done'
[Python] Created wheel for sklearn: filename=sklearn-0.0.post1-py3-none-any.whl size=2936 sha256=168c9171f79b986e006af58f4393c3dc817caf4e274bda64939d7f363f7135d4
[Python] Stored in directory: c:\users\pinte\appdata\local\pip\cache\wheels\03\8b\6f\9f13c705de81a6b351b718b3cf917e41ad7c0933c8630d4dd4
[Python] Successfully built sklearn
[Python] Installing collected packages: sklearn
[Python] Successfully installed sklearn-0.0.post1
[Python] [notice] A new release of pip available: 22.3 -> 23.0
[Python] [notice] To update, run: python-real.exe -m pip install --upgrade pip
>>> import sklearn
Traceback (most recent call last):
File "<console>", line 1, in <module>
ModuleNotFoundError: No module named 'sklearn'

It’s a bit suspicious that the version number is 0.0, but I’m not familiar with sklearn so not sure if this means nightly or what… Any ideas? Thank you!

You are confusing 2 packages. PyPI name sklearn (sklearn · PyPI) is not the same as PyPI name scikit-learn (scikit-learn · PyPI). Both use the same import sklearn type though when used.

pip_install('scikit-learn') is what you need.