OiO.lk Blog python How to properly install sklearn / scikit-learn for python on eclipse IDE for macOS?
python

How to properly install sklearn / scikit-learn for python on eclipse IDE for macOS?


Hey so I tried running these code:

from sklearn.datasets._twenty_newsgroups import fetch_20newsgroups

texts = fetch_20newsgroups()

exit()

but I received this error message:

ModuleNotFoundError: No module named 'sklearn'

I also tried running this command on terminal:

pip3 install -U scikit-learn script matplotlib

and tried rerunning the code:

from sklearn.datasets._twenty_newsgroups import fetch_20newsgroups

texts = fetch_20newsgroups()

exit()

then I received another error message saying:

It seems that scikit-learn has not been built correctly.

If you have installed scikit-learn from source, please do not forget
to build the package before using it: run `python setup.py install` or
`make` in the source directory.

If you have used an installer, please check that it is suited for your
Python version, your operating system and your platform.

I also tried to manually add the scikit-learn packages through the python interpreter preferences settings on eclipse IDE (with pip)

Again, I received this error message:

ImportError: Error importing numpy: you should not try to import numpy 
from its source directory; please exit the numpy source tree, 
and relaunch your python interpreter from there.

I also tried to run these to on the eclipse IDE to import the sklearn:

import sklearn

print(sklearn.__version__)

and again, I got this error message:

It seems that scikit-learn has not been built correctly.

If you have installed scikit-learn from source, please do not forget
to build the package before using it: run `python setup.py install` or
`make` in the source directory.

If you have used an installer, please check that it is suited for your
Python version, your operating system and your platform.

I have been scrolling through everywhere and can’t seem to fix this. I am new to python and have a very little knowledge of it. Any help would be appreciated.

I am using MacOS M1 chip and python 3.13 version and also installed the scikit-learn 1.5.2 version through terminal (pip command)



You need to sign in to view this answers

Exit mobile version