Issue 1:
Description

Attempting to build scikit-learn master on macOS with the stock Xcode compiler fails due to the lack of OpenMP support.

Steps/Code to Reproduce

git clone https://github.com/scikit-learn/scikit-learn
git checkout 2718d6212f92220d5f228bfaf7bff0e75ea14965
cd scikit-learn
python setup.py build_ext --inplace

Expected Results

The build completes without errors.

Actual Results

The short answer is we see the following error, clang: error: unsupported option '-fopenmp'. The full build log is included below to provide more detail.

Build Log:

$ python setup.py build_ext --inplace
Partial import of sklearn during the build process.
/Users/jkirkham/miniconda/envs/np/lib/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'install_requires'
warnings.warn(msg)
blas_opt_info:
blas_mkl_info:
customize UnixCCompiler
libraries mkl_rt not found in ['/Users/jkirkham/miniconda/envs/np/lib']
NOT AVAILABLE

blis_info:
customize UnixCCompiler
customize UnixCCompiler
customize UnixCCompiler
customize UnixCCompiler
FOUND:
libraries = ['blas', 'cblas', 'lapack', 'blas', 'cblas', 'lapack']
library_dirs = ['/Users/jkirkham/miniconda/envs/np/lib']
define_macros = [('HAVE_CBLAS', None)]
include_dirs = ['/Users/jkirkham/miniconda/envs/np/include']
language = c

customize UnixCCompiler
customize UnixCCompiler
customize UnixCCompiler
FOUND:
libraries = ['blas', 'cblas', 'lapack', 'blas', 'cblas', 'lapack', 'blas', 'cblas', 'lapack']
library_dirs = ['/Users/jkirkham/miniconda/envs/np/lib']
define_macros = [('HAVE_CBLAS', None)]
include_dirs = ['/Users/jkirkham/miniconda/envs/np/include']
language = c

Compiling sklearn/__check_build/_check_build.pyx because it changed.
Compiling sklearn/preprocessing/_csr_polynomial_expansion.pyx because it changed.
Compiling sklearn/cluster/_dbscan_inner.pyx because it changed.
Compiling sklearn/cluster/_hierarchical.pyx because it changed.
Compiling sklearn/cluster/_k_means_elkan.pyx because it changed.
Compiling sklearn/cluster/_k_means.pyx because it changed.
Compiling sklearn/datasets/_svmlight_format.pyx because it changed.
Compiling sklearn/decomposition/_online_lda.pyx because it changed.
Compiling sklearn/decomposition/cdnmf_fast.pyx because it changed.
Compiling sklearn/ensemble/_gradient_boosting.pyx because it changed.
Compiling sklearn/feature_extraction/_hashing.pyx because it changed.
Compiling sklearn/manifold/_utils.pyx because it changed.
Compiling sklearn/manifold/_barnes_hut_tsne.pyx because it changed.
Compiling sklearn/metrics/cluster/expected_mutual_info_fast.pyx because it changed.
Compiling sklearn/metrics/pairwise_fast.pyx because it changed.
Compiling sklearn/neighbors/ball_tree.pyx because it changed.
Compiling sklearn/neighbors/kd_tree.pyx because it changed.
Compiling sklearn/neighbors/dist_metrics.pyx because it changed.
Compiling sklearn/neighbors/typedefs.pyx because it changed.
Compiling sklearn/neighbors/quad_tree.pyx because it changed.
Compiling sklearn/tree/_tree.pyx because it changed.
Compiling sklearn/tree/_splitter.pyx because it changed.
Compiling sklearn/tree/_criterion.pyx because it changed.
Compiling sklearn/tree/_utils.pyx because it changed.
Compiling sklearn/utils/sparsefuncs_fast.pyx because it changed.
Compiling sklearn/utils/_cython_blas.pyx because it changed.
Compiling sklearn/utils/arrayfuncs.pyx because it changed.
Compiling sklearn/utils/murmurhash.pyx because it changed.
Compiling sklearn/utils/lgamma.pyx because it changed.
Compiling sklearn/utils/graph_shortest_path.pyx because it changed.
Compiling sklearn/utils/fast_dict.pyx because it changed.
Compiling sklearn/utils/seq_dataset.pyx because it changed.
Compiling sklearn/utils/weight_vector.pyx because it changed.
Compiling sklearn/utils/_random.pyx because it changed.
Compiling sklearn/utils/_logistic_sigmoid.pyx because it changed.
Compiling sklearn/svm/libsvm.pyx because it changed.
Compiling sklearn/svm/liblinear.pyx because it changed.
Compiling sklearn/svm/libsvm_sparse.pyx because it changed.
Compiling sklearn/linear_model/cd_fast.pyx because it changed.
Compiling sklearn/linear_model/sgd_fast.pyx because it changed.
Compiling sklearn/linear_model/sag_fast.pyx because it changed.
Compiling sklearn/_isotonic.pyx because it changed.
[ 1/42] Cythonizing sklearn/__check_build/_check_build.pyx
[ 2/42] Cythonizing sklearn/_isotonic.pyx
[ 3/42] Cythonizing sklearn/cluster/_dbscan_inner.pyx
[ 4/42] Cythonizing sklearn/cluster/_hierarchical.pyx
[ 5/42] Cythonizing sklearn/cluster/_k_means.pyx
[ 6/42] Cythonizing sklearn/cluster/_k_means_elkan.pyx
[ 7/42] Cythonizing sklearn/datasets/_svmlight_format.pyx
[ 8/42] Cythonizing sklearn/decomposition/_online_lda.pyx
[ 9/42] Cythonizing sklearn/decomposition/cdnmf_fast.pyx
[10/42] Cythonizing sklearn/ensemble/_gradient_boosting.pyx
[11/42] Cythonizing sklearn/feature_extraction/_hashing.pyx
[12/42] Cythonizing sklearn/linear_model/cd_fast.pyx
[13/42] Cythonizing sklearn/linear_model/sag_fast.pyx
[14/42] Cythonizing sklearn/linear_model/sgd_fast.pyx
[15/42] Cythonizing sklearn/manifold/_barnes_hut_tsne.pyx
[16/42] Cythonizing sklearn/manifold/_utils.pyx
[17/42] Cythonizing sklearn/metrics/cluster/expected_mutual_info_fast.pyx
[18/42] Cythonizing sklearn/metrics/pairwise_fast.pyx
[19/42] Cythonizing sklearn/neighbors/ball_tree.pyx
[20/42] Cythonizing sklearn/neighbors/dist_metrics.pyx
[21/42] Cythonizing sklearn/neighbors/kd_tree.pyx
[22/42] Cythonizing sklearn/neighbors/quad_tree.pyx
[23/42] Cythonizing sklearn/neighbors/typedefs.pyx
[24/42] Cythonizing sklearn/preprocessing/_csr_polynomial_expansion.pyx
[25/42] Cythonizing sklearn/svm/liblinear.pyx
[26/42] Cythonizing sklearn/svm/libsvm.pyx
[27/42] Cythonizing sklearn/svm/libsvm_sparse.pyx
[28/42] Cythonizing sklearn/tree/_criterion.pyx
[29/42] Cythonizing sklearn/tree/_splitter.pyx
[30/42] Cythonizing sklearn/tree/_tree.pyx
[31/42] Cythonizing sklearn/tree/_utils.pyx
[32/42] Cythonizing sklearn/utils/_cython_blas.pyx
[33/42] Cythonizing sklearn/utils/_logistic_sigmoid.pyx
[34/42] Cythonizing sklearn/utils/_random.pyx
[35/42] Cythonizing sklearn/utils/arrayfuncs.pyx
[36/42] Cythonizing sklearn/utils/fast_dict.pyx
[37/42] Cythonizing sklearn/utils/graph_shortest_path.pyx
[38/42] Cythonizing sklearn/utils/lgamma.pyx
[39/42] Cythonizing sklearn/utils/murmurhash.pyx
[40/42] Cythonizing sklearn/utils/seq_dataset.pyx
/Users/jkirkham/miniconda/envs/np/lib/python3.7/site-packages/Cython/Compiler/Main.py:367: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /Users/jkirkham/Developer/scikit-learn/sklearn/utils/seq_dataset.pxd
tree = Parsing.p_module(s, pxd, full_module_name)
[41/42] Cythonizing sklearn/utils/sparsefuncs_fast.pyx
[42/42] Cythonizing sklearn/utils/weight_vector.pyx
running build_ext
running build_src
build_src
building library "libsvm-skl" sources
building extension "sklearn.__check_build._check_build" sources
building extension "sklearn.preprocessing._csr_polynomial_expansion" sources
building extension "sklearn.cluster._dbscan_inner" sources
building extension "sklearn.cluster._hierarchical" sources
building extension "sklearn.cluster._k_means_elkan" sources
building extension "sklearn.cluster._k_means" sources
building extension "sklearn.datasets._svmlight_format" sources
building extension "sklearn.decomposition._online_lda" sources
building extension "sklearn.decomposition.cdnmf_fast" sources
building extension "sklearn.ensemble._gradient_boosting" sources
building extension "sklearn.feature_extraction._hashing" sources
building extension "sklearn.manifold._utils" sources
building extension "sklearn.manifold._barnes_hut_tsne" sources
building extension "sklearn.metrics.cluster.expected_mutual_info_fast" sources
building extension "sklearn.metrics.pairwise_fast" sources
building extension "sklearn.neighbors.ball_tree" sources
building extension "sklearn.neighbors.kd_tree" sources
building extension "sklearn.neighbors.dist_metrics" sources
building extension "sklearn.neighbors.typedefs" sources
building extension "sklearn.neighbors.quad_tree" sources
building extension "sklearn.tree._tree" sources
building extension "sklearn.tree._splitter" sources
building extension "sklearn.tree._criterion" sources
building extension "sklearn.tree._utils" sources
building extension "sklearn.utils.sparsefuncs_fast" sources
building extension "sklearn.utils._cython_blas" sources
building extension "sklearn.utils.arrayfuncs" sources
building extension "sklearn.utils.murmurhash" sources
building extension "sklearn.utils.lgamma" sources
building extension "sklearn.utils.graph_shortest_path" sources
building extension "sklearn.utils.fast_dict" sources
building extension "sklearn.utils.seq_dataset" sources
building extension "sklearn.utils.weight_vector" sources
building extension "sklearn.utils._random" sources
building extension "sklearn.utils._logistic_sigmoid" sources
building extension "sklearn.svm.libsvm" sources
building extension "sklearn.svm.liblinear" sources
building extension "sklearn.svm.libsvm_sparse" sources
building extension "sklearn.linear_model.cd_fast" sources
building extension "sklearn.linear_model.sgd_fast" sources
building extension "sklearn.linear_model.sag_fast" sources
building extension "sklearn._isotonic" sources
building data_files sources
build_src: building npy-pkg config files
customize UnixCCompiler
customize UnixCCompiler using build_clib
building 'libsvm-skl' library
compiling C++ sources
C compiler: g++ -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Users/jkirkham/miniconda/envs/np/include -arch x86_64 -I/Users/jkirkham/miniconda/envs/np/include -arch x86_64

creating build
creating build/temp.macosx-10.9-x86_64-3.7
creating build/temp.macosx-10.9-x86_64-3.7/sklearn
creating build/temp.macosx-10.9-x86_64-3.7/sklearn/svm
creating build/temp.macosx-10.9-x86_64-3.7/sklearn/svm/src
creating build/temp.macosx-10.9-x86_64-3.7/sklearn/svm/src/libsvm
compile options: '-I/Users/jkirkham/miniconda/envs/np/lib/python3.7/site-packages/numpy/core/include -I/Users/jkirkham/miniconda/envs/np/include/python3.7m -c'
g++: sklearn/svm/src/libsvm/libsvm_template.cpp
ar: adding 1 object files to build/temp.macosx-10.9-x86_64-3.7/liblibsvm-skl.a
ranlib:@ build/temp.macosx-10.9-x86_64-3.7/liblibsvm-skl.a
customize UnixCCompiler
customize UnixCCompiler using build_ext_subclass
customize UnixCCompiler
customize UnixCCompiler using build_ext_subclass
building 'sklearn.__check_build._check_build' extension
compiling C sources
C compiler: gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/jkirkham/miniconda/envs/np/include -arch x86_64 -I/Users/jkirkham/miniconda/envs/np/include -arch x86_64

creating build/temp.macosx-10.9-x86_64-3.7/sklearn/__check_build
compile options: '-I/Users/jkirkham/miniconda/envs/np/lib/python3.7/site-packages/numpy/core/include -I/Users/jkirkham/miniconda/envs/np/lib/python3.7/site-packages/numpy/core/include -I/Users/jkirkham/miniconda/envs/np/include/python3.7m -c'
extra options: '-fopenmp'
gcc: sklearn/__check_build/_check_build.c
clang: error: unsupported option '-fopenmp'
error: Command "gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/jkirkham/miniconda/envs/np/include -arch x86_64 -I/Users/jkirkham/miniconda/envs/np/include -arch x86_64 -I/Users/jkirkham/miniconda/envs/np/lib/python3.7/site-packages/numpy/core/include -I/Users/jkirkham/miniconda/envs/np/lib/python3.7/site-packages/numpy/core/include -I/Users/jkirkham/miniconda/envs/np/include/python3.7m -c sklearn/__check_build/_check_build.c -o build/temp.macosx-10.9-x86_64-3.7/sklearn/__check_build/_check_build.o -MMD -MF build/temp.macosx-10.9-x86_64-3.7/sklearn/__check_build/_check_build.o.d -fopenmp" failed with exit status 1

Versions

Python 3.7.2 | packaged by conda-forge | (default, Mar 19 2019, 20:46:22)

[Clang 4.0.1 (tags/RELEASE_401/final)]

NumPy 1.16.2

SciPy 1.2.1

Used scikit-learn commit ( 2718d62 ) for the build.

More details about the build environment are included below.

Environment:

channels:
- conda-forge
- defaults
dependencies:
- appnope=0.1.0=py37_1000
- backcall=0.1.0=py_0
- blas=2.4=openblas
- bzip2=1.0.6=h1de35cc_1002
- ca-certificates=2019.3.9=hecc5488_0
- certifi=2019.3.9=py37_0
- cython=0.29.6=py37h0a44026_0
- decorator=4.4.0=py_0
- ipython=7.4.0=py37h24bf2e0_0
- ipython_genutils=0.2.0=py_1
- jedi=0.13.3=py37_0
- libblas=3.8.0=4_openblas
- libcblas=3.8.0=4_openblas
- libcxx=4.0.1=h579ed51_0
- libcxxabi=4.0.1=hebd6815_0
- libffi=3.2.1=h6de7cb9_1006
- libgfortran=3.0.1=0
- liblapack=3.8.0=4_openblas
- liblapacke=3.8.0=4_openblas
- ncurses=6.1=h0a44026_1002
- numpy=1.16.2=py37hbb3c62a_1
- openblas=0.3.5=h436c29b_1001
- openssl=1.1.1b=h01d97ff_2
- parso=0.3.4=py_0
- pexpect=4.6.0=py37_1000
- pickleshare=0.7.5=py37_1000
- pip=19.0.3=py37_0
- prompt_toolkit=2.0.9=py_0
- ptyprocess=0.6.0=py37_1000
- pygments=2.3.1=py_0
- python=3.7.2=hbdd33cc_0
- readline=7.0=hcfe32e1_1001
- scipy=1.2.1=py37hbd7caa9_1
- setuptools=40.8.0=py37_0
- six=1.12.0=py37_1000
- sqlite=3.26.0=h1765d9f_1001
- tk=8.6.9=ha441bb4_1000
- traitlets=4.3.2=py37_1000
- wcwidth=0.1.7=py_1
- wheel=0.33.1=py37_0
- xz=5.2.4=h1de35cc_1001
- zlib=1.2.11=h1de35cc_1004

Issue 2:
@jnothman, @agramfort, @NicolasHug (#13252)

Description

Build on macOS succeeds at f652b95~1 but fails at f652b95.

Steps/Code to Reproduce

git clone https://github.com/scikit-learn/scikit-learn.git

cd scikit-learn

pip3 install --user Cython

pip3 install --user numpy

pip3 install --user .

Actual Results

creating build/temp.macosx-10.14-x86_64-3.7/sklearn/__check_build
compile options: '-I/Users/xxxxx/Library/Python/3.7/lib/python/site-packages/numpy/core/include -I/Users/xxxxx/Library/Python/3.7/lib/python/site-packages/numpy/core/include -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c'
extra options: '-fopenmp'
clang: sklearn/__check_build/_check_build.c
clang: error: unsupported option '-fopenmp'
error: Command "clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/Users/xxxxx/Library/Python/3.7/lib/python/site-packages/numpy/core/include -I/Users/xxxxx/Library/Python/3.7/lib/python/site-packages/numpy/core/include -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c sklearn/__check_build/_check_build.c -o build/temp.macosx-10.14-x86_64-3.7/sklearn/__check_build/_check_build.o -MMD -MF build/temp.macosx-10.14-x86_64-3.7/sklearn/__check_build/_check_build.o.d -fopenmp" failed with exit status 1