Compiling SciPy on Mountain Lion

July 27, 2012 in Data,Internet

Update 8/1: The fix I described below has just been added to the development branch. Mountain Lion users can install the development branch with:

pip install -e git+

(note this requires a Fortran compiler; see here for more detail)

I've been updating my post on installing Python/NumPy/SciPy/IPython on Lion to work with Mountain Lion. For the most part, everything works smoothly -- except SciPy.

Trying to compile the stable version of SciPy under Mountain Lion results in errors. It can be fixed by adjusting four files that refer to the deprecated vecLib library and need to be updated withApple's Accelerate framework. A pull request containing the fix has been submitted but not yet accepted into the development branch, and even upon acceptance may take some time to appear in the stable version.

In the meantime, cutting-edge users will need to install SciPy from the modified branch. The following code will do the trick -- at your own risk!!
pip install git+
Please note that this fix is not guaranteed to be bug-free -- in fact, it will fail some BLAS tests. If you absolutely need a stable version of SciPy, you should consider holding off on upgrading to OSX 10.8 until it is fully supported by the main SciPy branch.

{ 8 comments… read them below or add one }

Bismayan July 28, 2012 at 12:36 am


after I followed your instructions, I got scipy to build successfully. But when i try to use scipy from python , it still says that the module doesnt exist. Any idea what’s going on?


J July 28, 2012 at 12:53 pm

It sounds like you have multiple versions of Python on your system — is it possible that you installed pip for a downloaded python, but are still using the python that shipped with your mac?


Daniel M July 28, 2012 at 5:33 pm

Thank you so much for this! I have been tearing my hair out for the past couple of days waiting on a fix for this. Managed to get numpy/matplotlib installed perfectly, but scipy has been the problem, installed and working now. Cheers.


Mike July 29, 2012 at 3:20 pm

note that if doing this with python 3 I ran into another compile error with scipy that I reported and is being fixed here:


Aaron Andalman August 7, 2012 at 11:31 pm

Thank for the great post. I ran into the same compilation error, but switching to the dev branch of scipy didn’t fix it for me. I was getting the #include veclib… error, but now I get the following compilation error in the same file. Any suggestions:

C compiler: /usr/bin/llvm-gcc -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -O3 -w -pipe -march=core2 -msse4 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes

creating build/temp.macosx-10.5-intel-2.7/scipy/sparse/linalg/eigen
creating build/temp.macosx-10.5-intel-2.7/scipy/sparse/linalg/eigen/arpack
creating build/temp.macosx-10.5-intel-2.7/scipy/sparse/linalg/eigen/arpack/ARPACK
creating build/temp.macosx-10.5-intel-2.7/scipy/sparse/linalg/eigen/arpack/ARPACK/FWRAPPERS

compile options: ‘-Iscipy/sparse/linalg/eigen/arpack/ARPACK/SRC -I/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include -c’

llvm-gcc: scipy/sparse/linalg/eigen/arpack/ARPACK/FWRAPPERS/veclib_cabi_c.c

In file included from /System/Library/Frameworks/vecLib.framework/Headers/vecLib.h:43,
from /System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.h:20,
from scipy/sparse/linalg/eigen/arpack/ARPACK/FWRAPPERS/veclib_cabi_c.c:2:

/System/Library/Frameworks/vecLib.framework/Headers/vfp.h:51:23: error: immintrin.h: No such file or directory

In file included from /System/Library/Frameworks/vecLib.framework/Headers/vecLib.h:43,
from /System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.h:20,
from scipy/sparse/linalg/eigen/arpack/ARPACK/FWRAPPERS/veclib_cabi_c.c:2:

/System/Library/Frameworks/vecLib.framework/Headers/vfp.h: In function ‘vceilf’:
/System/Library/Frameworks/vecLib.framework/Headers/vfp.h:53: error: incompatible types in return


Elke August 22, 2012 at 6:02 am

Thanks a million – worked on a fresh Mountain Lion for both Python2 and Python3 within Virtualenvs.


Arlo Bryer August 30, 2012 at 6:06 am


I tried your instructions but unfortunately I get a load of errors which I asked about at:

Do you have any ideas what the problem might be?



J August 30, 2012 at 10:26 am

Hi Arlo,

It sounds like you don’t have the required compiler on your system. See the full instructions ( for information on how to get it.


Leave a Comment

{ 3 trackbacks }

Previous post:

Next post: