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+https://github.com/scipy/scipy#egg=scipy-dev

(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+https://github.com/minrk/scipy-1.git@accelerate
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

Hey,

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?

Reply

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?

Reply

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.

Reply

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:
https://github.com/scipy/scipy/pull/279

Reply

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

Reply

Elke August 22, 2012 at 6:02 am

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

Reply

Arlo Bryer August 30, 2012 at 6:06 am

Hi,

I tried your instructions but unfortunately I get a load of errors which I asked about at:
http://stackoverflow.com/questions/12092306/how-to-install-scipy-with-pip-on-mac-mountain-lion-os-x-v10-8

Do you have any ideas what the problem might be?

Thanks!

Reply

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 (http://www.thisisthegreenroom.com/?p=4141) for information on how to get it.

Reply

Leave a Comment

{ 3 trackbacks }

Previous post:

Next post: