vinay
vinay

Reputation: 77

Running setup.py install for scikit-learn ... error

I am using MacOs Mojave and currently trying to run the project available on GitHub on this link. I have installed latest version of python(i.e. python 3.8) and currently facing issues while installing the requirements, mainly in scikit-learn. Either way I am getting the same error.

Kindly help me through out to run this project completely on my machine locally.

enter image description here

I've also raised an issue on the main GitHub page regarding this and still waiting for an adequate response.

When I tried to install cython according to the given instructions and available answer on stackoverflow I'm getting another big error page with python3.8 using command- pip3 install --upgrade cython as mentioned in an answer. I'm attaching that's error messages here. enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here This is the complete set of error that I'm getting after that. Thanks in advance if anyone can get me through this project with python3.8

Thanks VonC for resolving the installation of cython. Now another error that I'm getting while installing scikit-learn with python3.8 in my system is: scikit-learn installation error with python3.8 As answered by @VonC, I did tried to follow linkenter link description here and now while executing the command pip install --verbose --editable . I'm now getting another error here Please help me regarding this. I've installed LLVM OpenMP library using Homebrew

Upvotes: 4

Views: 11821

Answers (2)

VonC
VonC

Reputation: 1323293

"no module named Cython" was seen in other projects: CellProfiler/centrosome issue 78 with various workarounds:

python3 setup.py install
# and/or
python3.6 -m pip install --upgrade cython
sudo python3.6 -m pip install --upgrade cython
# and/or
pip install --upgrade cython

If you're using python 2.7 or above, type on terminal: pip install --upgrade cython
This should work.
The error is probably because the cython version installed from pip is incompatible to the python version on your system.

If that leads to:

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools)

Then check this question, and try and update XCode: xcode-select --install


Regarding the scikit-learn error, it is:

It seems that scikit-learn cannot be built with OpenMP support.

  • Make sure you have followed the installation instructions:

https://scikit-learn.org/dev/developers/advanced_installation.html

There is an issue about this error

Looks like it's the result of an error in sklearn/_build_utils/openmp_helpers.py
For me the test program ./test_openmp.c works as expected, but not in the building Scikit-learn process.

So, I just replace False to True in the line 111 in openmp_helpers.py (sed -i -e '111s/False/True/' e.g.).
As a result, I get normal building of Scikit-learn 0.21.3

But also, from instructions for Mac:

install libomp with Homebrew to extend the default Apple clang compiler.

I tried the second option to install libomp with Homebrew.
It worked like a charm.

If you see "File "setup.py" not found", that means the pip command was not executed in the correct folder.
If you are installing from sources, you should type the pip install --verbose --editable . (after a conda activate sklearn-dev) where you have cloned said sources (where you should see a setup.py)

Upvotes: 4

seralouk
seralouk

Reputation: 33127

You just need to first install scikit-learn. Use:

pip install -U scikit-learn

OR

pip3 install -U scikit-learn

Upvotes: 0

Related Questions