-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
$ python2 setup.py build_ext --inplace
running build_ext
skipping 'cy_dcumsum.c' Cython extension (up-to-date)
building 'cy_dcumsum' extension
creating build/temp.macosx-10.12-x86_64-2.7
clang -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/2.7.13_1/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c cy_dcumsum.c -o build/temp.macosx-10.12-x86_64-2.7/cy_dcumsum.o
cy_dcumsum.c:517:10: fatal error: 'numpy/arrayobject.h' file not found
#include "numpy/arrayobject.h"
^
1 error generated.
error: command 'clang' failed with exit status 1
#####################################################################
I googled this compilation issue online and found a workaround by inserting the "include_dirs = [np.get_include()]" inside the Extension clause of the setup.py file.
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy as np
setup(
cmdclass = {'build_ext': build_ext},
ext_modules = [Extension("cy_dcumsum", ["cy_dcumsum.pyx"], include_dirs = [np.get_include()])]
)