Python Forum

Full Version: SCIKIT learn failure in mac
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello

While installing SCIKIT-LEARN on MAC it failed

Could someone please help on what i need to be looking.

Jags-MacBook-Air:~ jag$ pip3 install scikit-learn

Collecting scikit-learn

Downloading https://files.pythonhosted.org/packages/...1.3.tar.gz (12.2MB)

|████████████████████████████████| 12.2MB 1.4MB/s

Requirement already satisfied: numpy>=1.11.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from scikit-learn) (1.17.4)

Requirement already satisfied: scipy>=0.17.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from scikit-learn) (1.3.3)

Collecting joblib>=0.11 (from scikit-learn)

Downloading https://files.pythonhosted.org/packages/...ne-any.whl (294kB)

|████████████████████████████████| 296kB 979kB/s

Installing collected packages: joblib, scikit-learn

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

ERROR: Command errored out with exit status 1:

command: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/_4/hxl9577j27z87t2b7b516jv40000gn/T/pip-install-1bwoznca/scikit-learn/setup.py'"'"'; __file__='"'"'/private/var/folders/_4/hxl9577j27z87t2b7b516jv40000gn/T/pip-install-1bwoznca/scikit-learn/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/_4/hxl9577j27z87t2b7b516jv40000gn/T/pip-record-fcqytin5/install-record.txt --single-version-externally-managed --compile

cwd: /private/var/folders/_4/hxl9577j27z87t2b7b516jv40000gn/T/pip-install-1bwoznca/scikit-learn/

Complete output (28 lines):

Partial import of sklearn during the build process.

Traceback (most recent call last):

File "<string>", line 1, in <module>

File "/private/var/folders/_4/hxl9577j27z87t2b7b516jv40000gn/T/pip-install-1bwoznca/scikit-learn/setup.py", line 290, in <module>

setup_package()

File "/private/var/folders/_4/hxl9577j27z87t2b7b516jv40000gn/T/pip-install-1bwoznca/scikit-learn/setup.py", line 286, in setup_package

setup(**metadata)

File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/numpy/distutils/core.py", line 137, in setup

config = configuration()

File "/private/var/folders/_4/hxl9577j27z87t2b7b516jv40000gn/T/pip-install-1bwoznca/scikit-learn/setup.py", line 174, in configuration

config.add_subpackage('sklearn')

File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/numpy/distutils/misc_util.py", line 1033, in add_subpackage

config_list = self.get_subpackage(subpackage_name, subpackage_path,

File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/numpy/distutils/misc_util.py", line 999, in get_subpackage

config = self._get_configuration_from_setup_py(

File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/numpy/distutils/misc_util.py", line 941, in _get_configuration_from_setup_py

config = setup_module.configuration(*args)

File "sklearn/setup.py", line 62, in configuration

config.add_subpackage('utils')

File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/numpy/distutils/misc_util.py", line 1033, in add_subpackage

config_list = self.get_subpackage(subpackage_name, subpackage_path,

File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/numpy/distutils/misc_util.py", line 999, in get_subpackage

config = self._get_configuration_from_setup_py(

File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/numpy/distutils/misc_util.py", line 941, in _get_configuration_from_setup_py

config = setup_module.configuration(*args)

File "sklearn/utils/setup.py", line 8, in configuration

from Cython import Tempita

ModuleNotFoundError: No module named 'Cython'

----------------------------------------

ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/_4/hxl9577j27z87t2b7b516jv40000gn/T/pip-install-1bwoznca/scikit-learn/setup.py'"'"'; __file__='"'"'/private/var/folders/_4/hxl9577j27z87t2b7b516jv40000gn/T/pip-install-1bwoznca/scikit-learn/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/_4/hxl9577j27z87t2b7b516jv40000gn/T/pip-record-fcqytin5/install-record.txt --single-version-externally-managed --compile Check the logs for full command output
Try:
pip3 install --upgrade cython
Also try in a virtual environment,it's build into Python now trough venv.
# Make 
python3 -m venv sci_env
 
# Cd in
cd sci_env
 
# Activate
source bin/activate  

# Install
(sci_env) mint@mint $
pip3 install cython
pip3 install scikit-learn
I have seen this message a couple of time now,
it can have to do with 3.8 and that some 3-party lib that have to do a fix for 3.8.