[Numpy-discussion] OS X Lion: llvm: numpy and scipy

Samuel John scipy@samueljohn...
Tue Sep 20 09:52:48 CDT 2011


Hi!

On 20.09.2011, at 14:41, David Cournapeau wrote:
> On Tue, Sep 20, 2011 at 5:13 AM, Samuel John <scipy@samueljohn.de> wrote:
>> Ralf, thanks for your answer.
>> 
>> However, in short:
>> 
>>  I want `pip install numpy; pip install scipy` to work on OS X Lion without extra effort :-)
[...]
> I will try to look at this problem next week, when I will receive a
> new laptop with Lion on it. If I forget about it, please ping me at
> the end of next week, we need to fix this,

Congratulation to your new Mac :-)

When I download scipy.10.0b2 and get gfortran via homebrew:
    brew install gfortran (which is not the issue here)
    cd scipy-0.10.0b2
    python setup.py build
    python setup.py install

Then, scipy.test() causes segfaults or malloc errors:

> samuel@ubi:~/Downloads/scipy-0.10.0b2 $ cd ..
> samuel@ubi:~/Downloads $ ipython
> Python 2.7.2 (default, Sep 16 2011, 11:18:55) 
> Type "copyright", "credits" or "license" for more information.
> 
> IPython 0.11 -- An enhanced Interactive Python.
> ?         -> Introduction and overview of IPython's features.
> %quickref -> Quick reference.
> help      -> Python's own help system.
> object?   -> Details about 'object', use 'object??' for extra details.
> 
> In [1]: import scipy
> 
> In [2]: scipy.test()
> Running unit tests for scipy
> NumPy version 1.6.1
> NumPy is installed in /usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy
> SciPy version 0.10.0b2
> SciPy is installed in /usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy
> Python version 2.7.2 (default, Sep 16 2011, 11:18:55) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)]
> nose version 1.1.2
> ...................................................................................................................................................................................F.FSegmentation fault: 11
> samuel@ubi:~/Downloads $ ipython
> Python 2.7.2 (default, Sep 16 2011, 11:18:55) 
> Type "copyright", "credits" or "license" for more information.
> 
> IPython 0.11 -- An enhanced Interactive Python.
> ?         -> Introduction and overview of IPython's features.
> %quickref -> Quick reference.
> help      -> Python's own help system.
> object?   -> Details about 'object', use 'object??' for extra details.
> 
> In [1]: import scipy
> 
> In [2]: scipy.test()
> Running unit tests for scipy
> NumPy version 1.6.1
> NumPy is installed in /usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy
> SciPy version 0.10.0b2
> SciPy is installed in /usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy
> Python version 2.7.2 (default, Sep 16 2011, 11:18:55) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)]
> nose version 1.1.2
> ...................................................................................................................................................................................F.FFPython(93907,0x7fff7201b960) malloc: *** error for object 0x105ce5630: pointer being freed was not allocated
> *** set a breakpoint in malloc_error_break to debug
> Abort trap: 6


However, when setting the CC, CXX and FFLAGS explicitly to avoid llvm:

export CC=gcc-4.2 
export CXX=g++-4.2 
export FFLAGS=-ff2c
python setup.py build
python setup.py install

Then scipy.test() works fine:

> In [2]: scipy.test()
> Running unit tests for scipy
> NumPy version 1.6.1
> NumPy is installed in /usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy
> SciPy version 0.10.0b2
> SciPy is installed in /usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy
> Python version 2.7.2 (default, Sep 16 2011, 11:18:55) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)]
> nose version 1.1.2
> ............................................................................................................................................................................................................................K............................................................................................................/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/interpolate/fitpack2.py:674: UserWarning: 
> The coefficients of the spline returned have been computed as the
> minimal norm least-squares solution of a (numerically) rank deficient
> system (deficiency=7). If deficiency is large, the results may be
> inaccurate. Deficiency may strongly depend on the value of eps.
>   warnings.warn(message)
> ....../usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/interpolate/fitpack2.py:605: UserWarning: 
> The required storage space exceeds the available storage space: nxest
> or nyest too small, or s too small.
> The weighted least-squares spline corresponds to the current set of
> knots.
>   warnings.warn(message)
> ........................K..K....../usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/numeric.py:1920: RuntimeWarning: invalid value encountered in absolute
>   return all(less_equal(absolute(x-y), atol + rtol * absolute(y)))
> ............................................................................................................................................................................................................................................................................................................................................................................................................................................/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/io/wavfile.py:31: WavFileWarning: Unfamiliar format bytes
>   warnings.warn("Unfamiliar format bytes", WavFileWarning)
> /usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/io/wavfile.py:121: WavFileWarning: chunk not understood
>   warnings.warn("chunk not understood", WavFileWarning)
> ...............................................................................................................................................................................................................................SSSSSS......SSSSSS......SSSS...............................................................................S............................................................................................................................................................................................................................................................K..................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................SSSSSSSSSSS.......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................K...............................................................K...........................................................................................................................................................KK.............................................................................................................................................................................................................................................................................................................................................................................................................................................K.K.............................................................................................................................................................................................................................................................................................................................................................................................K........K..............SSSSSSS............................................................................................................................................................................................................................................................................................................................................................................................../usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/stats/distributions.py:4110: RuntimeWarning: overflow encountered in exp
>   return exp(c*x-exp(x)-gamln(c))
> ................................./usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/stats/distributions.py:4592: RuntimeWarning: invalid value encountered in sqrt
>   vals = 2*(bt+1.0)*sqrt(b-2.0)/((b-3.0)*sqrt(b))
> .........................................................................................................................................................................................................................................................................................................S................................................................................................................................................................................................/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/stats/distributions.py:5107: RuntimeWarning: divide by zero encountered in divide
>   return where((lam <= 0) | (abs(x) < 1.0/arr(lam)), Px, 0.0)
> .......................................................................................................................................................................................................................................................................................................................................................................................................................
> ----------------------------------------------------------------------
> Ran 5651 tests in 53.627s
> 
> OK (KNOWNFAIL=12, SKIP=36)
> Out[2]: <nose.result.TextTestResult run=5651 errors=0 failures=0>


Samuel


More information about the NumPy-Discussion mailing list