[SciPy-dev] crash with 'import scipy.linalg' and 'import scipy.io'

John Pye john@curioussymbols....
Wed Mar 7 22:50:14 CST 2007


Further on this...

I reverted to the standard ubuntu matplotlib just to be safe. That
didn't fix the problem.

I looked at that __multiarray_api.h (judging from those underscores, it
must be top secret :-) and without having any kind of detailed
understanding of it, I see that there are some global variables here. I
wonder if it's possible that things are getting messed up by the fact
that I have got embedded python loading some modules that were already
loaded *outside* my embedded python frame, even though the same
interpreter is being reused.

Perhaps it's a categorical "you can't use scipy in embedded python". But
hopefully not.

Cheers
JP


John Pye wrote:
> Hi all,
>
> I am getting a crash when I call "from scipy import io". Normally this
> works fine, but when I make the call from an *embedded* python script,
> it goes haywire. See below for some GDB output. You can see the C code
> has done some stuff, then the embedded python frame starts up. But there
> is a crash when it gets to "import scipy.linalg", although "import
> scipy" works fine. "import scipy.io" also gives a crash.
>
> Note that this is with standard Ubuntu packages for numpy and scipy, but
> with a locally build newer package of matplotlib.
>
> john@roadwork:~/ascend$ dpkg -l matplotlib python-scipy python-numpy
> Desired=Unknown/Install/Remove/Purge/Hold
> | Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
> |/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err:
> uppercase=bad)
> ||/ Name                       Version                    Description
> +++-==========================-==========================-====================================================================
> ii  matplotlib                 0.90.0-2                   Matlab(TM)
> style python plotting package
> ii  python-numpy               1.0rc1-0ubuntu1            Numerical
> Python adds a fast array facility to the Python language
> ii  python-scipy               0.5.1-3ubuntu2             scientific
> tools for Python
> john@roadwork:~/ascend$
>
> Has anyone else seen this behaviour? Is there anything I can do to work
> around this problem?
>
> Cheers
> JP
>
> base/generic/integrator/ida.c:1707 (integrator_ida_write_matrix):
> Calculating dg/dx...
> base/generic/system/jacobian.c:78 (system_jacobian): nr = 0
> base/generic/system/jacobian.c:79 (system_jacobian): nv = 2
> base/generic/linear/mtx_basic.c:3234 (mtx_write_region_mmio): Wrote
> matrix range (0 x 2) to file
> WROTE MATRICES TO FILE. NOW PROCESSING...
> IMPORTING scipy...
> IMPORTING scipy.linang...
>
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread -1209911104 (LWP 22996)]
> 0xb5a60b41 in PyArray_API () from
> /usr/lib/python2.4/site-packages/numpy/core/multiarray.so
> (gdb) where
> #0  0xb5a60b41 in PyArray_API () from
> /usr/lib/python2.4/site-packages/numpy/core/multiarray.so
> #1  0xb3987fc7 in init_flinalg () at
> /usr/lib/python2.4/site-packages/numpy/core/include/numpy/__multiarray_api.h:952
> #2  0x080d6844 in _PyImport_LoadDynamicModule (name=0xbf8577d7
> "scipy.linalg._flinalg",
>     pathname=0xbf856767
> "/usr/lib/python2.4/site-packages/scipy/linalg/_flinalg.so",
> fp=0x869f8a8) at ../Python/importdl.c:53
> #3  0x080d47d5 in load_module (name=0xbf8577d7 "scipy.linalg._flinalg",
> fp=0xb5a60b40,
>     buf=0xbf856767
> "/usr/lib/python2.4/site-packages/scipy/linalg/_flinalg.so", type=3,
> loader=0x8) at ../Python/import.c:1689
> #4  0x080d4f8b in import_submodule (mod=0xb482550c, subname=0xbf8577e4
> "_flinalg", fullname=0xbf8577d7 "scipy.linalg._flinalg")
>     at ../Python/import.c:2276
> #5  0x080d540a in load_next (mod=0xb482550c, altmod=0x8124c58,
> p_name=<value optimized out>,
>     buf=0xbf8577d7 "scipy.linalg._flinalg", p_buflen=0xbf8577cc) at
> ../Python/import.c:2096
> #6  0x080d563e in PyImport_ImportModuleEx (name=0xb39b5f54 "_flinalg",
> globals=0xb39a11c4, locals=0xb39a11c4, fromlist=0x8124c58)
>     at ../Python/import.c:1931
> #7  0x080af9e0 in builtin___import__ (self=0x0, args=0xb39b81bc) at
> ../Python/bltinmodule.c:45
> #8  0x08058c27 in PyObject_Call (func=0x8, arg=0xb39b81bc, kw=0x0) at
> ../Objects/abstract.c:1795
> #9  0x080b395c in PyEval_CallObjectWithKeywords (func=0xb7debd6c,
> arg=0xb39b81bc, kw=0x0) at ../Python/ceval.c:3435
> #10 0x080b77b3 in PyEval_EvalFrame (f=0x8424b1c) at ../Python/ceval.c:2020
> #11 0x080ba4b9 in PyEval_EvalCodeEx (co=0xb39b6aa0, globals=0xb39a11c4,
> locals=0xb39a11c4, args=0x0, argcount=0, kws=0x0,
>     kwcount=0, defs=0x0, defcount=0, closure=0x0) at ../Python/ceval.c:2741
> #12 0x080ba527 in PyEval_EvalCode (co=0xb39b6aa0, globals=0xb39a11c4,
> locals=0xb39a11c4) at ../Python/ceval.c:484
> #13 0x080d3d8c in PyImport_ExecCodeModuleEx (name=0xbf85abb7
> "scipy.linalg.flinalg", co=0xb39b6aa0,
>     pathname=0xbf858b07
> "/usr/lib/python2.4/site-packages/scipy/linalg/flinalg.pyc") at
> ../Python/import.c:636
> #14 0x080d4406 in load_source_module (name=0xbf85abb7
> "scipy.linalg.flinalg",
>     pathname=0xbf858b07
> "/usr/lib/python2.4/site-packages/scipy/linalg/flinalg.pyc", fp=<value
> optimized out>)
>     at ../Python/import.c:915
> #15 0x080d4f8b in import_submodule (mod=0xb482550c, subname=0xbf85abc4
> "flinalg", fullname=0xbf85abb7 "scipy.linalg.flinalg")
>     at ../Python/import.c:2276
> #16 0x080d540a in load_next (mod=0xb482550c, altmod=0x8124c58,
> p_name=<value optimized out>,
>     buf=0xbf85abb7 "scipy.linalg.flinalg", p_buflen=0xbf85abac) at
> ../Python/import.c:2096
> #17 0x080d563e in PyImport_ImportModuleEx (name=0xb39b5e54 "flinalg",
> globals=0xb481ef0c, locals=0xb481ef0c, fromlist=0xb48215cc)
>     at ../Python/import.c:1931
> #18 0x080af9e0 in builtin___import__ (self=0x0, args=0xb39b80f4) at
> ../Python/bltinmodule.c:45
> #19 0x08058c27 in PyObject_Call (func=0x8, arg=0xb39b80f4, kw=0x0) at
> ../Objects/abstract.c:1795
> #20 0x080b395c in PyEval_CallObjectWithKeywords (func=0xb7debd6c,
> arg=0xb39b80f4, kw=0x0) at ../Python/ceval.c:3435
> #21 0x080b77b3 in PyEval_EvalFrame (f=0x81a7374) at ../Python/ceval.c:2020
> #22 0x080ba4b9 in PyEval_EvalCodeEx (co=0xb39b6960, globals=0xb481ef0c,
> locals=0xb481ef0c, args=0x0, argcount=0, kws=0x0,
>     kwcount=0, defs=0x0, defcount=0, closure=0x0) at ../Python/ceval.c:2741
> #23 0x080ba527 in PyEval_EvalCode (co=0xb39b6960, globals=0xb481ef0c,
> locals=0xb481ef0c) at ../Python/ceval.c:484
> #24 0x080d3d8c in PyImport_ExecCodeModuleEx (name=0xbf85df97
> "scipy.linalg.basic", co=0xb39b6960,
>     pathname=0xbf85bee7
> "/usr/lib/python2.4/site-packages/scipy/linalg/basic.pyc") at
> ../Python/import.c:636
> #25 0x080d4406 in load_source_module (name=0xbf85df97 "scipy.linalg.basic",
>     pathname=0xbf85bee7
> "/usr/lib/python2.4/site-packages/scipy/linalg/basic.pyc", fp=<value
> optimized out>)
>     at ../Python/import.c:915
> #26 0x080d4f8b in import_submodule (mod=0xb482550c, subname=0xbf85dfa4
> "basic", fullname=0xbf85df97 "scipy.linalg.basic")
>     at ../Python/import.c:2276
> #27 0x080d540a in load_next (mod=0xb482550c, altmod=0x8124c58,
> p_name=<value optimized out>,
>     buf=0xbf85df97 "scipy.linalg.basic", p_buflen=0xbf85df8c) at
> ../Python/import.c:2096
> ---Type <return> to continue, or q <return> to quit---
>
> _______________________________________________
> Scipy-dev mailing list
> Scipy-dev@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-dev
>   


More information about the Scipy-dev mailing list