[Pythonmac-SIG] Building numpy/scipy for python3 on MacOS Lion

Eddy Barratt eddybarratt1 at yahoo.co.uk
Thu Mar 22 01:08:38 CET 2012


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'). In the end I get the following message:

2 warnings generated.
gcc-4.2 -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -isysroot /Developer/SDKs/MacOSX10.6.sdk -g build/temp.macosx-10.6-intel-3.2/numpy/core/src/dummymodule.o -Lbuild/temp.macosx-10.6-intel-3.2 -o build/lib.macosx-10.6-intel-3.2/numpy/core/_dummy.so
sh: gcc-4.2: command not found
sh: gcc-4.2: command not found
error: Command "gcc-4.2 -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -isysroot /Developer/SDKs/MacOSX10.6.sdk -g build/temp.macosx-10.6-intel-3.2/numpy/core/src/dummymodule.o -Lbuild/temp.macosx-10.6-intel-3.2 -o build/lib.macosx-10.6-intel-3.2/numpy/core/_dummy.so" failed with exit status 127


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 using pip from a virtual environment: 

>>> source /usr/local/share/python/virtualenvwrapper.sh
>>> 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 all but ready to give up on Python3! 

Eddy 


More information about the Pythonmac-SIG mailing list