numpy is a great python module which adds many useful numeric features to python. Basically the following are my experiences following the installation instructions on the Scipy/Numpy site. Those instructions are very vague at times and thus I have tried to clarify things here.
First follow setup directions here. HOWEVER you need to add to your path the location of the new python before proceeding. Now the very annoying/confusing part: you MUST unset LDFLAGS, CFLAGS, CPPFLAGS, CXXFLAGS, FFLAGS, and FF. I have no clue why this is the case but it apparently is.
There is one big annoyance with numpy when cross compiling. The ccompiler.py script is junk. Meaning it does not behave as expected since it does not treat the returns from standard python function properly mainly gen_lib_options, which only returns the library and library dirs needed for linking but IGNORES the arguments need to pick the proper libraries, in my case “-m32″ and “-fPIC”. (Leave out “-m32″ for 64bit.)
I managed to solve this problem by editing numpy/distutils/ccompiler.py:378 to read: lib_opts = ["-m32","-fPIC" After that it should be smooth sailing. (Leave out "-m32" for 64bit.)
You will also need to add the following to site.cfg (where $EXTDIR is replaced with the actual string since this file will not read environmental variables.):
[DEFAULT]
library_dirs = $EXTDIR/lib:/usr/local/lib:/usr/lib
include_dirs = $EXTDIR/include:/usr/local/include:/usr/include
[fftw]
libraries = fftw3
[atlas]
atlas_libs = lapack, f77blas, cblas, atlas
After that just do the standard python install.
- build: $ python setup.py build –fcompiler=gnu95
- Install: $ python setup.py config_fc –fcompiler=gnu95 install –prefix=$EXTDIR
Here is a block quote version for easier cut/pasting:
python setup.py build --fcompiler=gnu95
python setup.py config_fc --fcompiler=gnu95 install --prefix=$EXTDIR
Update (2009-10-2):
The newest release of numpy (1.3.0) seems to install well.
Previous warning:
In OS X to get fortran code to compile I needed to edit the gnu.py file to remove the addition of cc_dynamic to the list of libraries to compile against since it is un-needed since OS X 10.5
Can be ignored.