scikit-learn / scikit-learn

scikit-learn: machine learning in Python
https://scikit-learn.org
BSD 3-Clause "New" or "Revised" License
59.43k stars 25.26k forks source link

scikit-learn cannot be built with OpenMP support. #15742

Closed momouang closed 4 years ago

momouang commented 4 years ago

I was trying to install sklearn in python 3.8, but it won't let me go successfully

momouangde-MacBook-Pro:~ momo$ pip3 install scikit-learn Collecting scikit-learn Using cached https://files.pythonhosted.org/packages/1e/ce/9d8c88e68af0a5b5c5d78d8d2b7bcadfd45e1d6afc863ccb9aee30765b06/scikit-learn-0.21.3.tar.gz 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) Requirement already satisfied: joblib>=0.11 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from scikit-learn) (0.14.0) Installing collected packages: 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/vd/ds5bpscj0f71mkrqw8ljq8v80000gn/T/pip-install-0xl31eoy/scikit-learn/setup.py'"'"'; file='"'"'/private/var/folders/vd/ds5bpscj0f71mkrqw8ljq8v80000gn/T/pip-install-0xl31eoy/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/vd/ds5bpscj0f71mkrqw8ljq8v80000gn/T/pip-record-tbh7i_4u/install-record.txt --single-version-externally-managed --compile cwd: /private/var/folders/vd/ds5bpscj0f71mkrqw8ljq8v80000gn/T/pip-install-0xl31eoy/scikit-learn/ Complete output (50 lines): Partial import of sklearn during the build process. C compiler: gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g

compile options: '-c'
extra options: '-fopenmp'
gcc: test_openmp.c
clang: error: unsupported option '-fopenmp'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/private/var/folders/vd/ds5bpscj0f71mkrqw8ljq8v80000gn/T/pip-install-0xl31eoy/scikit-learn/setup.py", line 290, in <module>
    setup_package()
  File "/private/var/folders/vd/ds5bpscj0f71mkrqw8ljq8v80000gn/T/pip-install-0xl31eoy/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/vd/ds5bpscj0f71mkrqw8ljq8v80000gn/T/pip-install-0xl31eoy/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 76, in configuration
    maybe_cythonize_extensions(top_path, config)
  File "/private/var/folders/vd/ds5bpscj0f71mkrqw8ljq8v80000gn/T/pip-install-0xl31eoy/scikit-learn/sklearn/_build_utils/__init__.py", line 42, in maybe_cythonize_extensions
    with_openmp = check_openmp_support()
  File "/private/var/folders/vd/ds5bpscj0f71mkrqw8ljq8v80000gn/T/pip-install-0xl31eoy/scikit-learn/sklearn/_build_utils/openmp_helpers.py", line 140, in check_openmp_support
    raise CompileError(err_message)
distutils.errors.CompileError:
                    ***

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

- If your compiler supports OpenMP but the build still fails, please
  submit a bug report at:

    https://github.com/scikit-learn/scikit-learn/issues

- If you want to build scikit-learn without OpenMP support, you can set
  the environment variable SKLEARN_NO_OPENMP and rerun the build
  command. Note however that some estimators will run in sequential
  mode and their `n_jobs` parameter will have no effect anymore.

                    ***

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

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/vd/ds5bpscj0f71mkrqw8ljq8v80000gn/T/pip-install-0xl31eoy/scikit-learn/setup.py'"'"'; file='"'"'/private/var/folders/vd/ds5bpscj0f71mkrqw8ljq8v80000gn/T/pip-install-0xl31eoy/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/vd/ds5bpscj0f71mkrqw8ljq8v80000gn/T/pip-record-tbh7i_4u/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.

Expected Results

my result is to connect sklearn with touchdesigner and i've set the path inside TD however the module couldn't be built properly

Versions

NumPy 1.17.4 Python 3.8.0 (v3.8.0:fa919fdf25, Oct 14 2019, 10:23:27) [Clang 6.0 (clang-600.0.57)] SciPy 1.3.3

If anyone could help i would be very appreciated

jeremiedbb commented 4 years ago

Hi, we don't have wheels for python3.8 yet. But we will have for the 0.22 release coming very soon :) In the meantime I suggest you to switch to python 3.7

momouang commented 4 years ago

oh sure and is there any code example for me to lower my python level ?? i'm a beginner in python field

jeremiedbb commented 4 years ago

The easiest and cleanest way is to use environments. I use conda environment but you can check other kinds of environment. Here's what you can do with conda:

you can look at the doc of miniconda for more detailed explanations.

Closing the issue because it's a usage question. If you have related questions, you can go to https://gitter.im/scikit-learn/scikit-learn or stackoverflow.

jeremiedbb commented 4 years ago

Actually we just released a release candidate with python 3.8 support. So you can ignore my previous comment and install scikit-learn with pip3 install --pre -U scikit-learn.