[SciPy-User] Building numpy/scipy for python3 on MacOS Lion

Eddy Barratt eddybarratt1@yahoo.co...
Tue Mar 27 17:31:18 CDT 2012


I've made some progress with this problem, with much assistance from Ned Deily on the pythonmac mailing list. I can now build numpy for python3, but scipy still won't build.

Too install numpy:
The scipy website (http://www.scipy.org/Installing_SciPy/Mac_OS_X) suggests working around the C compiler problem with three typed commands, but these are insufficient, you need one more:

$ export CC=clang
$ export CXX=clang
$ export FFLAGS=-ff2c
$ export LDSHARED='clang -bundle -undefined dynamic_lookup \
    -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -g'

After this building from source should work. See here for details: http://python.6.n6.nabble.com/Building-numpy-scipy-for-python3-on-MacOS-Lion-td4642828.html

Problem building scipy:
I don't know what the issue here is, something with the C compiler again though I think. Here are the error messages. I'd greatly appreciate any thoughts on this matter.

Thanks, Eddy

compiling C sources 
C compiler: clang -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3 -isysroot /Developer/SDKs/MacOSX10.6.sdk -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk 

compile options: '-DNO_ATLAS_INFO=3 -DUSE_VENDOR_BLAS=1 -I/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/3.2/include/python3.2m -c' 
extra options: '-msse3' 
clang: scipy/sparse/linalg/dsolve/_superlumodule.c 
In file included from scipy/sparse/linalg/dsolve/_superlumodule.c:18: 
In file included from /Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/numpy/core/include/numpy/arrayobject.h:15: 
In file included from /Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/numpy/core/include/numpy/ndarrayobject.h:17: 
In file included from /Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/numpy/core/include/numpy/ndarraytypes.h:1972: 
/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/numpy/core/include/numpy/npy_deprecated_api.h:11:2: warning: #warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API" [-W#warnings] 
#warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API" 
 ^ 
scipy/sparse/linalg/dsolve/_superlumodule.c:268:9: error: non-void function 'PyInit__superlu' should return a value [-Wreturn-type] 
        return; 
        ^ 
1 warning and 1 error generated. 
In file included from scipy/sparse/linalg/dsolve/_superlumodule.c:18: 
In file included from /Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/numpy/core/include/numpy/arrayobject.h:15: 
In file included from /Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/numpy/core/include/numpy/ndarrayobject.h:17: 
In file included from /Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/numpy/core/include/numpy/ndarraytypes.h:1972: 
/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/numpy/core/include/numpy/npy_deprecated_api.h:11:2: warning: #warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API" [-W#warnings] 
#warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API" 
 ^ 
scipy/sparse/linalg/dsolve/_superlumodule.c:268:9: error: non-void function 'PyInit__superlu' should return a value [-Wreturn-type] 
        return; 
        ^ 
1 warning and 1 error generated. 
error: Command "clang -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3 -isysroot /Developer/SDKs/MacOSX10.6.sdk -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -DNO_ATLAS_INFO=3 -DUSE_VENDOR_BLAS=1 -I/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/3.2/include/python3.2m -c scipy/sparse/linalg/dsolve/_superlumodule.c -o build/temp.macosx-10.6-intel-3.2/scipy/sparse/linalg/dsolve/_superlumodule.o -msse3" failed with exit status 1 








----- Original Message -----
From: Eddy Barratt <eddybarratt1@yahoo.co.uk>
To: "scipy-user@scipy.org" <scipy-user@scipy.org>
Cc: 
Sent: Monday, 12 March 2012, 15:46
Subject: Building numpy/scipy for python3 on MacOS Lion

I can't get Numpy or Scipy to work with Python3 on Mac OSX Lion.

I have used pip successfully to install numpy, scipy and matplotlib, and they work well with Python2.7, but in Python3 typing 'import numpy' brings up 'No module named numpy'. I've tried downloading the source code directly and then running 'python3 setup.py build', but I get various error warnings, some in red that have to do with fortran (e.g. 'Could not locate executable f95'). The error message that appears to fail in the end is 'RuntimeError: Broken toolchain: cannot link a simple C program', and appears to be related to the previous line 'sh: gcc-4.2: command not found'.

The Scipy website (http://www.scipy.org/Installing_SciPy/Mac_OS_X) suggests that there may be issues with the c compiler, but the same problems didn't arise using pip to install for python2.7. I have followed the instructions on the website regarding changing the compiler but this has not made any difference.


I have also tried installing from a virtual environment:


>>> mkvirtualenv -p python3.2 test1
>>> pip install numpy

But this fails with "Command python setup.py egg_info failed with error code 1 in /Users/Eddy/.virtualenvs/test1/build/numpy"
I've considered making python3 default, and then I thought a pip install might work, but I don't know how to do that. Does anyone have any suggestions for how I might proceed? I'm relatively new to Python but it's something I feel I'm likely to become more involved in so I'd like to start using Python3 before I get too established with 2.7. Thanks for your help.

Eddy



More information about the SciPy-User mailing list