I was trying to install python and its scientific libraries on a clean install of Mountain Lion, with Xcode and its command line tools.
I installed homebrew and, through it, a fresh python 2.7 as I didn't want to mess up with the one Apple provides. I also installed gfortran always via homebrew.
Then I install Numpy from its source, using the flag to build it using gfortran. I did this because if I pip install it then the scipy installation will fail.
With installed, I tested it through bumpy.test('full') and it says OK.
At this point I tried to install scipy, both using pip or from source. The result is the same, it installs but i get a HUGE number of failures and one error when I test it using scipy.test(). Any idea of how to fix this?
The reported error is
ERROR: test_logm_consistency (test_matfuncs.TestExpM)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/scipy/linalg/tests/test_matfuncs.py", line 124, in test_logm_consistency
assert_array_almost_equal(expm(logm(a)), a)
File "/usr/local/lib/python2.7/site-packages/scipy/linalg/matfuncs.py", line 453, in logm
errest = norm(expm(F)-A,1) / norm(A,1)
File "/usr/local/lib/python2.7/site-packages/scipy/linalg/matfuncs.py", line 49, in expm
A_L1 = norm(A,1)
File "/usr/local/lib/python2.7/site-packages/scipy/linalg/misc.py", line 12, in norm
a = np.asarray_chkfinite(a)
File "/usr/local/lib/python2.7/site-packages/numpy/lib/function_base.py", line 590, in asarray_chkfinite
"array must not contain infs or NaNs")
ValueError: array must not contain infs or NaNs
The failures are instead related to boas, basic, dot, asum, nrm2, arpack.
Any idea of how to fix this?
My advice is to always set up python computing enviroments (especially with finicky packages like scipy and numpy) in a virtualenv. virtualenv is a tool that allows you to set up and switch in and out of isolated python environments, so that installing and changing things in one environment doesn't mess with the others.
EDIT: another reason to use virtualenv is that if you screw everything up, you haven't messed up your global system configuration and you can just delete the virtualenv and start over from scratch to fix it. I also recommend virtualenvwrapper which is basically just some sugar that makes virtualenv more intuitive and faster to use.
Also to address your actual question: I believe that you still have to use the development branch of scipy in order for it to compile successfully on OSX 10.8. I followed the instructions here pretty much exactly and everything worked fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With