Python on Leopard issues

arthurwoll at gmail.com arthurwoll at gmail.com
Tue Dec 18 10:56:27 EST 2007


Hi Folks: I am new to python, and, (thanks to on-site help) just
installed ipython, matplotlib, numpy and scipy on my PPC running
Leopard (10.5.1). Since scipy.org's install page is out-dated -- it
recommends beginning by re-installing python (http://www.scipy.org/
Installing_SciPy/Mac_OS_X) -- I thought I would document my steps:

1. My experience is that the python that ships with 10.5.1 (developer
tools / xcode) is both up to date (version 2.5.1) and works FINE.
(e.g. without doing anything, you can start up python from a command
line, and even arrow up to previous commands).

2. ipython: Installing ipython (ipython-0.8.2.tar.gz) went just as
advertised here: http://ipython.scipy.org/moin/Download.

3. fortran: Installed gfortran (gfortran-4.2.1.dmg) from (http://
r.research.att.com/tools/) -- no trouble.

4. FFTW: Installed the fftw libraries (3.1.2) as described on
scipy.org -- no trouble.

5. Numpy: built, installed numpy as described on scipy.org. No trouble
(to test, use "import numpy" followed by, e.g. "numpy.test(1,10)" from
within python

6. Scipy: Trouble. The necessary steps are documented but not so easy
to find.   There are two issues.

6.a: Although my new version of numpy is installed, python gives
(mistaken) precedence to a built in version.  To fix this, I placed
the line:
export PYTHONPATH=/Library/Python/2.5/site-packages
in my shell configuration file: ~/.profile

6.b: Although I just installed gfortran, the python build step doesn't
know to use it. Instead of "python setup.py build" you need to use
"python setup.py config_fc --fcompiler=gfortran build"

6.c: The installation step "sudo python setup.py install" worked, as
does "import scipy".  scipy.test(1,10) gives two failures, but 1714
successes, which is an A+ on any test.  For the record the failures
are

======================================================================
FAIL: check loadmat case sparse
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.5/site-packages/scipy/io/tests/test_mio.py",
line 85, in cc
    self._check_case(name, files, expected)
  File "/Library/Python/2.5/site-packages/scipy/io/tests/test_mio.py",
line 80, in _check_case
    self._check_level(k_label, expected, matdict[k])
  File "/Library/Python/2.5/site-packages/scipy/io/tests/test_mio.py",
line 63, in _check_level
    decimal = 5)
  File "/Library/Python/2.5/site-packages/numpy/testing/utils.py",
line 232, in assert_array_almost_equal
    header='Arrays are not almost equal')
  File "/Library/Python/2.5/site-packages/numpy/testing/utils.py",
line 217, in assert_array_compare
    assert cond, msg
AssertionError:
Arrays are not almost equal
test sparse; file /Library/Python/2.5/site-packages/scipy/io/tests/./
data/testsparse_6.5.1_GLNX86.mat, variable testsparse
(mismatch 46.6666666667%)
 x: array([[  3.03865194e-319,   3.16202013e-322,   1.04346664e-320,
          2.05531309e-320,   2.56123631e-320],
       [  3.16202013e-322,   0.00000000e+000,   0.00000000e+000,...
 y: array([[ 1.,  2.,  3.,  4.,  5.],
       [ 2.,  0.,  0.,  0.,  0.],
       [ 3.,  0.,  0.,  0.,  0.]])

======================================================================
FAIL: check_dot (scipy.lib.tests.test_blas.test_fblas1_simple)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.5/site-packages/scipy/lib/blas/tests/
test_blas.py", line 76, in check_dot
    assert_almost_equal(f([3j,-4,3-4j],[2,3,1]),-9+2j)
  File "/Library/Python/2.5/site-packages/numpy/testing/utils.py",
line 158, in assert_almost_equal
    assert round(abs(desired - actual),decimal) == 0, msg
AssertionError:
Items are not equal:
 ACTUAL: (-1.998528003692627+1.0484833485089376e-37j)
 DESIRED: (-9+2j)

----------------------------------------------------------------------

7. Matplotlib: Retrieved here: (http://sourceforge.net/projects/
matplotlib) and installed following the normal steps: ("python
setup.py build",  "sudo python setup.py install"). To test this one,
run python as:
ipython -pylab
Typing, e.g. "plot([1,2,3]) makes a nice plot window...

NOTE:  matplotlib requires libraries (freetype, libpng, zlib) that
were installed (and presumably found by matplotlib) during my
"macports" (http://www.macports.org/index.php) installation
ImageMagick.





More information about the Python-list mailing list