Skip to content

Scikit-learn can not be built with OpenMP support #14624

Closed
@sundaycat

Description

@sundaycat

Description

I got this error while compiling the source code of scikit-learn on my Mac. I have been follow the introduction step by step given by Advanced installation instructions. But still have the following error:

Any help will be appreciated

Steps/Code to Reproduce

sudo python setup.py install

Expected Results

Complie and install successfully

Actual Results

Partial import of sklearn during the build process.

/Users/sundaycat/.pyenv/versions/anaconda3-5.3.1/lib/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'project_urls'
  warnings.warn(msg)
/Users/sundaycat/.pyenv/versions/anaconda3-5.3.1/lib/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'python_requires'
  warnings.warn(msg)
/Users/sundaycat/.pyenv/versions/anaconda3-5.3.1/lib/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'install_requires'
  warnings.warn(msg)
C compiler: gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/sundaycat/.pyenv/versions/anaconda3-5.3.1/include -arch x86_64 -I/Users/sundaycat/.pyenv/versions/anaconda3-5.3.1/include -arch x86_64

compile options: '-c'
extra options: '-fopenmp'
gcc: test_openmp.c
clang: error: unsupported option '-fopenmp'
clang: error: unsupported option '-fopenmp'
Traceback (most recent call last):
  File "setup.py", line 290, in <module>
    setup_package()
  File "setup.py", line 286, in setup_package
    setup(**metadata)
  File "/Users/sundaycat/.pyenv/versions/anaconda3-5.3.1/lib/python3.7/site-packages/numpy/distutils/core.py", line 135, in setup
    config = configuration()
  File "setup.py", line 174, in configuration
    config.add_subpackage('sklearn')
  File "/Users/sundaycat/.pyenv/versions/anaconda3-5.3.1/lib/python3.7/site-packages/numpy/distutils/misc_util.py", line 1034, in add_subpackage
    caller_level = 2)
  File "/Users/sundaycat/.pyenv/versions/anaconda3-5.3.1/lib/python3.7/site-packages/numpy/distutils/misc_util.py", line 1003, in get_subpackage
    caller_level = caller_level + 1)
  File "/Users/sundaycat/.pyenv/versions/anaconda3-5.3.1/lib/python3.7/site-packages/numpy/distutils/misc_util.py", line 940, 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 "/Users/sundaycat/Dev/scikit-learn/sklearn/_build_utils/__init__.py", line 43, in maybe_cythonize_extensions
    with_openmp = check_openmp_support()
  File "/Users/sundaycat/Dev/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.

Versions

scikit-learn: lastest version
python: 3.7
Numpy: 1.15.1
SciPy: 1.1.0
Joblib: 0.13.2

Platform: MacOS 10.14.6

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions