Scipy vImage.h Problem
From charlesreid1
Linked to from this page: Mac_OS_X_Lion
While compiling scipy, I ran into a problem with vImage.h
not being found:
$ python setup.py build [...] customize UnixCCompiler customize UnixCCompiler using build_clib customize Gnu95FCompiler Found executable /usr/local/bin/gfortran customize Gnu95FCompiler customize Gnu95FCompiler using build_clib building 'arpack_scipy' library compiling C sources C compiler: clang -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe compile options: '-Iscipy/sparse/linalg/eigen/arpack/ARPACK/SRC -I/Users/charlesreid/pkg/numpy/std/lib/python2.7/site-packages/numpy/core/include -c' clang: scipy/sparse/linalg/eigen/arpack/ARPACK/FWRAPPERS/veclib_cabi_c.c clang: warning: argument unused during compilation: '-mno-fused-madd' In file included from scipy/sparse/linalg/eigen/arpack/ARPACK/FWRAPPERS/veclib_cabi_c.c:2: /System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.h:24:10: fatal error: 'vImage/vImage.h' file not found #include <vImage/vImage.h> ^ 1 error generated. clang: warning: argument unused during compilation: '-mno-fused-madd' In file included from scipy/sparse/linalg/eigen/arpack/ARPACK/FWRAPPERS/veclib_cabi_c.c:2: /System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.h:24:10: fatal error: 'vImage/vImage.h' file not found #include <vImage/vImage.h> ^ 1 error generated. error: Command "clang -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -Iscipy/sparse/linalg/eigen/arpack/ARPACK/SRC -I/Users/charlesreid/pkg/numpy/std/lib/python2.7/site-packages/numpy/core/include -c scipy/sparse/linalg/eigen/arpack/ARPACK/FWRAPPERS/veclib_cabi_c.c -o build/temp.macosx-10.8-intel-2.7/scipy/sparse/linalg/eigen/arpack/ARPACK/FWRAPPERS/veclib_cabi_c.o" failed with exit status 1
This was resolved by looking in the file /System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.h
and seeing that the problematic include statement was wrapped with an ifndef statement:
#ifndef VIMAGE_H #include <vImage/vImage.h> #endif
So, it is possible to bypass the vImage.h include by adding the flag -DVIMAGE_H
to the compilation commands that scipy issues. Do this by modifying the CFLAGS
environmental variable:
$ CFLAGS="-DVIMAGE_H" python setup.py build
When you compile, you'll see a bunch of spew and warnings and whatnot, but it should compile okay.
Test it out by adding /path/to/scipy/install/lib/python2.7/site-packages
to your $PYTHONPATH
, then run the following command in Python:
$ python Python 2.7.2 (default, Oct 11 2012, 20:14:37) [GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from scipy import * >>>
You should not see any error messages.