'numpy/arrayobject.h' file not found, solved by changing setup.py#2
Open
baroobob wants to merge 2 commits into
Open
'numpy/arrayobject.h' file not found, solved by changing setup.py#2baroobob wants to merge 2 commits into
baroobob wants to merge 2 commits into
Conversation
added 2 commits
September 17, 2015 12:02
to get rid of an error about failing to find numpy/arrayobject.h
to generate model.c and kept Extension to avoid the numpy/arrayobject.h not found error.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When I followed the instructions in code/README.md and attempted to compile the model like this:
python setup.py build_ext --inplace
I got this error:
Cythonizing model.pyx
running build_ext
building 'model' extension
clang -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch x86_64 -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c model.c -o build/temp.macosx-10.10-x86_64-2.7/model.o
model.c:265:10: fatal error: 'numpy/arrayobject.h' file not found
include "numpy/arrayobject.h"
^
1 error generated.
error: command 'clang' failed with exit status 1
The word on the street at stackoverflow is that include_dirs sometimes gets ignored in the latest version of distutils, see dashesy's comment here:
http://stackoverflow.com/questions/20333128/cimport-gives-fatal-error-numpy-arrayobject-h-file-not-found
I decided to try using Extension in setup.py to specify include_dirs and it worked! If someone could be so kind as to try this out and confirm it works for them as well then this change should be merged into the repo so others do not have to repeat this debugging process.