[Tutor] solutions to API version mismatch

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Wed May 11 22:37:19 CEST 2005



On Wed, 11 May 2005, Charmaine Chia wrote:

> My computer only has the following versions installed: Python 2.1.3+,
> 2.2.3+ and 2.3.4.  I have changed my PYTHONPATH to use look for
> different site-packages (I've tried version 1.5 and 2.2 -- 1.5 was
> attempted in case the scripts were written in/during that version).


Hi Charmiane,

You may want to find which third-party modules are required by that code,
as some modules do require some special attention.  I would recommend not
just trying to get the code to compile, but to also document your work on
what additional third-party modules are required.  It's good to document
external dependencies so that future code maintainers like yourself don't
get tripped up so badly.

The particular module that's causing you problems appears to be Numeric
Python, a third-party module that adds good numerical computing support to
Python.  Numeric is an example of an "extension module", which can't be
just copied directly, but must be specifically compiled to a particular
version of Python, because quite a bit of Numeric is compiled in C.


Our recommendation is to install Numeric for the current version of Python
on your system.  Numeric can be found here:

    http://sourceforge.net/project/showfiles.php?group_id=1369

It looks like you were trying Python 2.2 on a Unix system.  You should be
able to grab 'Numeric-23.8.tar.gz', untar it, go into its source
directory, and then execute:

    $ rm -rf build
    $ python2.2 setup.py build
    $ python2.2 setup.py install

to install Numeric for your system.  You may need to repeat this process
if you have multiple versions of Python on your system.



> Do you think this problem can be simply solved by installing an older
> version of Python (matching the version in which the scripts and modules
> were written in) so that API versions match?

Yes, this will also work, although there are some disadvantages to using
the legacy versions of Python.


> If so, would there be any major disadvantage(s) for using an older
> version of Python?

There have been bug fixes and some significant improvements to the
language and Standard Library.  Here are summaries of changes to Python
since Python 1.5:

    http://www.python.org/1.6/#news
    http://www.amk.ca/python/2.0/
    http://www.amk.ca/python/2.1/
    http://www.python.org/doc/2.2.3/whatsnew/whatsnew22.html
    http://www.python.org/doc/2.3/whatsnew/
    http://www.python.org/doc/2.4.1/whatsnew/whatsnew24.html

Although the language core has stayed fairly consistant between 1.5 to the
later versions, I think that the extensive fixes to the Standard Library,
as well as the performance enhancements, warrants the upgrade.

Code that runs under 1.5 should run under 2.1, 2.2, and 2.3, although
there are some rare-and-unusual exceptions that are documented in the
summary change notes above.


Best of wishes to you!



More information about the Tutor mailing list