[Tutor] solutions to API version mismatch

Charmaine Chia charmainellchia at gmail.com
Wed May 11 22:05:16 CEST 2005


Hi there,

I'm a new Python user and am basically running scripts that a
colleague wrote a few years back.  I believe the scripts were written
on an older version of Python and aren't updated, and currently I can
only run these scripts on an older computer (unix based).  I am in the
process of trying to run these scripts locally (also unix based), but
I've been running into a few problems.

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).

***********************************************
I believe I have all the necessary modules to support the scripts, and
my best attemp so far still has the following error message (version
1.5 site-packages):


/python1.5/site-packages/Numeric/Numeric.py:76: RuntimeWarning: Python
C API version mismatch for module multiarray: This Python has API
version 1012, module multiarray has version 1007.
  import multiarray

/python1.5/site-packages/Numeric/Numeric.py:76: RuntimeWarning: Python
C API version mismatch for module _numpy: This Python has API version
1012, module _numpy has version 1007.
  import multiarray

/python1.5/site-packages/Numeric/Numeric.py:77: RuntimeWarning: Python
C API version mismatch for module umath: This Python has API version
1012, module umath has version 1007.
  from umath import * # Substitute fast_umath for "unsafe" math
free(): invalid pointer 0x4029bcf0!
free(): invalid pointer 0x4029bd68!
free(): invalid pointer 0x4029bdb8!
Segmentation fault
***********************************************
***********************************************
When trying to run the same script using the 2.2 site-packages, the errors are:


/python2.2/site-packages/Numeric/Numeric.py:86: RuntimeWarning: Python
C API version mismatch for module multiarray: This Python has API
version 1012, module multiarray has version 1011.
  import multiarray

/python2.2/site-packages/Numeric/Numeric.py:86: RuntimeWarning: Python
C API version mismatch for module _numpy: This Python has API version
1012, module _numpy has version 1011.
  import multiarray

/python2.2/site-packages/Numeric/Numeric.py:87: RuntimeWarning: Python
C API version mismatch for module umath: This Python has API version
1012, module umath has version 1011.
  from umath import *

/python2.2/site-packages/multipack/minpack.py:2: RuntimeWarning:
Python C API version mismatch for module _minpack: This Python has API
version 1012, module _minpack has version 1011.
  import _minpack

/python2.2/site-packages/multipack/odepack.py:2: RuntimeWarning:
Python C API version mismatch for module _odepack: This Python has API
version 1012, module _odepack has version 1011.
  import _odepack

/python2.2/site-packages/multipack/quadpack.py:2: RuntimeWarning:
Python C API version mismatch for module _quadpack: This Python has
API version 1012, module _quadpack has version 1011.
  import _quadpack

/python2.2/site-packages/multipack/fitpack.py:31: RuntimeWarning:
Python C API version mismatch for module _fitpack: This Python has API
version 1012, module _fitpack has version 1011.
  import _fitpack

/python2.2/site-packages/Numeric/LinearAlgebra.py:8: RuntimeWarning:
Python C API version mismatch for module lapack_lite: This Python has
API version 1012, module lapack_lite has version 1011.
  import lapack_lite

/python2.2/site-packages/Numeric/RandomArray.py:1: RuntimeWarning:
Python C API version mismatch for module ranlib: This Python has API
version 1012, module ranlib has version 1011.
  import ranlib

/python2.2/site-packages/SpecialFuncs/SpecialFuncs.py:1:
RuntimeWarning: Python C API version mismatch for module cephes: This
Python has API version 1012, module cephes has version 1007.
  from cephes import *

/bin/lapack/qr.py:3: RuntimeWarning: Python C API version mismatch for
module lapack: This Python has API version 1012, module lapack has
version 1007.
  from lapack import *
Traceback (most recent call last):
  File "/data/mril/mril2/llchia/bin/fit_t2.py", line 568, in ?
    apply(main,args+[options])
  File "/data/mril/mril2/llchia/bin/fit_t2.py", line 505, in main
    process_volumes(input, output, options)
  File "/data/mril/mril2/llchia/bin/fit_t2.py", line 358, in process_volumes
    t2_volume = create_output_volume(input_volume, output)
  File "/data/mril/mril2/llchia/bin/fit_t2.py", line 302, in
create_output_volume
    t2_image.initialize(input_volume.shape()[1:],input_volume.start()[1:],
  File "/data/mril/mril2/llchia/bin/minc/minc.py", line 585, in start
    start[indexdict[dim]] = self.variables[dim].start[0]
TypeError: can't convert complex to float; use abs(z)
***********************************************

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?

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

Or is there a simple way to update/convert the modules so that the API
versions match?

Any help is greatly appreciated.
Charmaine


More information about the Tutor mailing list