title: Missing numpy header while installing sklearn on Alpine Linux
body: <p>I'm trying to install sklearn on top of a Docker image (<code>FROM astronomerinc/ap-airflow:master-1.10.5-onbuild</code>). Environment coming with the source image:</p>
  
  <ul>
  <li>Alpine Linux v3.10  (kernel <code>4.9.93-linuxkit-aufs</code>)</li>
  <li>Python 3.7.3</li>
  <li>numpy==1.17.2 </li>
  <li>pandas==0.25.1 </li>
  <li>pandas-gbq==0.11.0</li>
  <li>...</li>
  </ul>
  
  <p>I had <code>scipy==1.3.1</code> in my <code>requirements.txt</code> and had no issues installing it with pip, however when I added <code>scikit-learn</code> to <code>requirements.txt</code> and rebuilt again, I got this error saying a numpy header is missing:</p>
  
  <pre><code>    creating build/temp.linux-x86_64-3.7
      creating build/temp.linux-x86_64-3.7/sklearn
      creating build/temp.linux-x86_64-3.7/sklearn/svm
      creating build/temp.linux-x86_64-3.7/sklearn/svm/src
      creating build/temp.linux-x86_64-3.7/sklearn/svm/src/libsvm
      compile options: '-I/usr/lib/python3.7/site-packages/numpy/core/include -c'
      g++: sklearn/svm/src/libsvm/libsvm_template.cpp
      ar: adding 1 object files to build/temp.linux-x86_64-3.7/liblibsvm-skl.a
      running build_ext
      customize UnixCCompiler
      customize UnixCCompiler using build_ext
      resetting extension 'sklearn.svm.liblinear' language from 'c' to 'c++'.
      customize UnixCCompiler
      customize UnixCCompiler using build_ext
      building 'sklearn.__check_build._check_build' extension
      compiling C sources
      C compiler: gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -DTHREAD_STACK_SIZE=0x100000 -fPIC
  
      creating build/temp.linux-x86_64-3.7/sklearn/__check_build
      compile options: '-I/usr/lib/python3.7/site-packages/numpy/core/include -I/usr/lib/python3.7/site-packages/numpy/core/include -I/usr/include/python3.7m -c'
      gcc: sklearn/__check_build/_check_build.c
      gcc -shared -Wl,--as-needed -Wl,--as-needed build/temp.linux-x86_64-3.7/sklearn/__check_build/_check_build.o -L/usr/lib -Lbuild/temp.linux-x86_64-3.7 -lpython3.7m -o build/lib.linux-x86_64-3.7/sklearn/__check_build/_check_build.cpython-37m-x86_64-linux-gnu.so
      building 'sklearn.cluster._dbscan_inner' extension
      compiling C++ sources
      C compiler: g++ -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -DTHREAD_STACK_SIZE=0x100000 -fPIC
  
      creating build/temp.linux-x86_64-3.7/sklearn/cluster
      compile options: '-I/usr/lib/python3.7/site-packages/numpy/core/include -I/usr/lib/python3.7/site-packages/numpy/core/include -I/usr/include/python3.7m -c'
      g++: sklearn/cluster/_dbscan_inner.cpp
      sklearn/cluster/_dbscan_inner.cpp:652:10: fatal error: numpy/arrayobject.h: No such file or directory
       #include "numpy/arrayobject.h"
                ^~~~~~~~~~~~~~~~~~~~~
      compilation terminated.
      error: Command "g++ -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/lib/python3.7/site-packages/numpy/core/include -I/usr/lib/python3.7/site-packages/numpy/core/include -I/usr/include/python3.7m -c sklearn/cluster/_dbscan_inner.cpp -o build/temp.linux-x86_64-3.7/sklearn/cluster/_dbscan_inner.o -MMD -MF build/temp.linux-x86_64-3.7/sklearn/cluster/_dbscan_inner.o.d" failed with exit status 1
      ----------------------------------------
  ERROR: Command errored out with exit status 1: /usr/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-o8ktwf40/scikit-learn/setup.py'"'"'; __file__='"'"'/tmp/pip-install-o8ktwf40/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 /tmp/pip-record-p6ejlhi_/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.
  WARNING: You are using pip version 19.2.1, however version 19.2.3 is available.
  You should consider upgrading via the 'pip install --upgrade pip' command.
  The command '/bin/sh -c pip install --no-cache-dir -q -r requirements.txt' returned a non-zero code: 1
  
  </code></pre>
  
  <hr>
  
  <p>Several things I've tried:</p>
  
  <ul>
  <li>upgrading pip</li>
  <li>specifying an older version of <code>scikit-learn</code></li>
  <li>"explicitly" installing <code>py3-numpy</code></li>
  </ul>
  
  <p>None of them worked unfortunately. <a href="http://notesbyanerd.com/2018/11/02/pip-install-cant-find-numpy-header/" rel="nofollow noreferrer">This post</a> recommends setting the path manually but that just wasn't the answer I was looking for. </p>
  
  <p>Insights? Any help is appreciated!</p>