"Illegal instruction" on import

Hello,

I've installed 1.0.0 on Python 2.4 (Debian Etch) and am getting just this:
Python 2.4.4 (#2, Jan 24 2010, 11:19:18)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib.pyplot as plt
Illegal instruction

I've had some build problems with numpy 1.1 and matplotlib:

numpy:

Installed /usr/lib/python2.4/site-packages/numpy-1.5.1rc1-py2.4-linux-i686.egg
Processing dependencies for numpy
Finished processing dependencies for numpy
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
   File "atexit.py", line 24, in _run_exitfuncs
     func(*targs, **kargs)
   File "/tmp/easy_install-HPBq58/numpy-1.5.1rc1/numpy/distutils/misc_util.py", line 251, in clean_up_temporary_directory
ImportError: No module named numpy.distutils
Error in sys.exitfunc:
Traceback (most recent call last):
   File "/usr/lib/python2.4/atexit.py", line 24, in _run_exitfuncs
     func(*targs, **kargs)
   File "/tmp/easy_install-HPBq58/numpy-1.5.1rc1/numpy/distutils/misc_util.py", line 251, in clean_up_temporary_directory
ImportError: No module named numpy.distutils
orchidea 10.0.0.1 /usr/local/bin % easy_install numpy.distutils
Searching for numpy.distutils

matplotlib:

cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
   File "build/bdist.linux-i686/egg/matplotlib/backends/qt4_editor/formlayout.py", line 275
     field.setCheckState(Qt.Checked if value else Qt.Unchecked)
                                     ^
SyntaxError: invalid syntax

But could this be the cause?

···

--

Regards,
mk

--
Premature optimization is the root of all fun.

2010-11-03 19:26, Marcin Krol skrev:

matplotlib:
      field.setCheckState(Qt.Checked if value else Qt.Unchecked)
                                      ^
SyntaxError: invalid syntax

The code above is a conditional expression, and those are mentioned [0] on the "what's new in python 2.5"-page, so I would guess that line is invalid in python 2.4, that you use.

I would replace it by

if value:
   field.setCheckState(Qt.Checked)
else:
    field.setCheckedState(Qt.Unchecked)

and see if that particular error goes away.

There could of course be many similar issues, but I see that the system requirements lists python 2.4 or newer as required [1], so perhaps those constructs are often avoided.

In any case, if my guesses are correct, I would consider using the conditional expression in matplotlib as a bug, given that python 2.4 is mentioned in the requirements.

Regards

Johan

[0]: http://docs.python.org/whatsnew/2.5.html
[1]: http://matplotlib.sourceforge.net/users/installing.html