Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to compile the cy_dcumsum.c program on a mac laptop #49

Open
jianle4github opened this issue Oct 4, 2017 · 0 comments
Open

Failed to compile the cy_dcumsum.c program on a mac laptop #49

jianle4github opened this issue Oct 4, 2017 · 0 comments

Comments

@jianle4github
Copy link

jianle4github commented Oct 4, 2017

$ 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()])]
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant