Python on Leopard issues

C

Chris

Are others having fundamental issues on OSX 10.5 with python 2.5.1? I was
excited that Python 2.5 was included, but this excitement was very short
lived. Almost nothing works. Upon startup I get this message:

'import site' failed; use -v for traceback

and sure enough, all of the built-in packages are non-existent. I'm not sure
why Apple bothered including an improperly-configured version. Does
anyone have an easy fix for this, or should I go to ActiveState and install a
version that works?

Thanks.
 
D

Diez B. Roggisch

Chris said:
Are others having fundamental issues on OSX 10.5 with python 2.5.1? I was
excited that Python 2.5 was included, but this excitement was very short
lived. Almost nothing works. Upon startup I get this message:

'import site' failed; use -v for traceback

and sure enough, all of the built-in packages are non-existent. I'm not sure
why Apple bothered including an improperly-configured version. Does
anyone have an easy fix for this, or should I go to ActiveState and install a
version that works?

While Apple is far from being perfect, I strongly doubt that they ship a
python as damaged as this - after all, they rely for some system stuff
on the shipped interpreter.

But I bet you didn't install leopard fresh, but upgraded? And did you by
any chance have a python 2.5 installed before?

Anyway, without much more information (where is the python framework
located and so forth) there is no chance of being more helpful.

Diez
 
A

arthurwoll

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,149
Latest member
Vinay Kumar Nevatia0
Top