[SciPy-user] Problems with porting code using weave

Lars Bittrich lars.bittrich at googlemail.com
Fri Mar 24 08:46:32 CST 2006


Hi,

I just tried to port my code to the new SciPy (scipy 0.4.7.1715 / numpy 
0.9.7.2248). I got some problems with weave which are usually hard to track 
down. So I looked at the tests:

scipy.test(10, 10)

runs without any errors. But I was really surprised when I got a few errors 
running:

scipy.weave.test(1)

  Found 16 tests for scipy.weave.slice_handler
  Found 0 tests for scipy.weave.c_spec
  Found 9 tests for scipy.weave.build_tools
  Found 0 tests for scipy.weave.inline_tools
  Found 1 tests for scipy.weave.ast_tools
  Found 0 tests for scipy.weave.wx_spec
  Found 2 tests for scipy.weave.blitz_tools
building extensions here: /home/bittrich/.python23_compiled/m15
  Found 1 tests for scipy.weave.ext_tools
  Found 3 tests for scipy.weave.standard_array_spec
  Found 26 tests for scipy.weave.catalog
  Found 74 tests for scipy.weave.size_check
  Found 0 tests for __main__
................warning: specified build_dir '_bad_path_' does not exist or is 
not writable. Trying default locations
...warning: specified build_dir '..' does not exist or is not writable. Trying 
default locations
..warning: specified build_dir '_bad_path_' does not exist or is not writable. 
Trying default locations
...warning: specified build_dir '..' does not exist or is not writable. Trying 
default locations
.....F....copying /home/bittrich/.python23_compiled/linux223compiled_catalog 
-> /tmp/tmpIvzGBO
copying /tmp/tmpIvzGBO/linux223compiled_catalog 
-> /home/bittrich/.python23_compiled
.........copying /home/bittrich/.python23_compiled/linux223compiled_catalog 
-> /tmp/tmpvpgFD0
copying /tmp/tmpvpgFD0/linux223compiled_catalog 
-> /home/bittrich/.python23_compiled
.copying /home/bittrich/.python23_compiled/linux223compiled_catalog 
-> /tmp/tmp2Mm4v7
copying /tmp/tmp2Mm4v7/linux223compiled_catalog 
-> /home/bittrich/.python23_compiled
............removing '/tmp/tmp2vO62Qcat_test' (and everything under it)
Exception bsddb._db.DBNoSuchFileError: <bsddb._db.DBNoSuchFileError instance 
at 0x4a279bec> in  ignored
.removing '/tmp/tmpuIJkqocat_test' (and everything under it)
.............................E..E........E................EEEE.............
======================================================================
ERROR: check_1d_3 
(scipy.weave.tests.test_size_check.test_dummy_array_indexing)
----------------------------------------------------------------------
Traceback (most recent call last):
  File 
"/opt/cp/lib/python2.3/site-packages/scipy/weave/tests/test_size_check.py", 
line 207, in check_1d_3
    if nx.which[0] != "numarray":
AttributeError: 'module' object has no attribute 'which'

======================================================================
ERROR: check_1d_6 
(scipy.weave.tests.test_size_check.test_dummy_array_indexing)
----------------------------------------------------------------------
Traceback (most recent call last):
  File 
"/opt/cp/lib/python2.3/site-packages/scipy/weave/tests/test_size_check.py", 
line 214, in check_1d_6
    if nx.which[0] != "numarray":
AttributeError: 'module' object has no attribute 'which'

======================================================================
ERROR: through a bunch of different indexes at it for good measure.
----------------------------------------------------------------------
Traceback (most recent call last):
  File 
"/opt/cp/lib/python2.3/site-packages/scipy/weave/tests/test_size_check.py", 
line 265, in check_1d_random
    self.generic_1d('a[%s:%s:%s]' %(beg,end,step))
  File 
"/opt/cp/lib/python2.3/site-packages/scipy/weave/tests/test_size_check.py", 
line 174, in generic_1d
    self.generic_wrap(a,expr)
  File 
"/opt/cp/lib/python2.3/site-packages/scipy/weave/tests/test_size_check.py", 
line 164, in generic_wrap
    desired = array(eval(expr).shape)
  File "<string>", line 0, in ?
ValueError: slice step cannot be zero

======================================================================
ERROR: through a bunch of different indexes at it for good measure.
----------------------------------------------------------------------
Traceback (most recent call last):
  File 
"/opt/cp/lib/python2.3/site-packages/scipy/weave/tests/test_size_check.py", 
line 289, in check_2d_random
    self.generic_2d(expr)
  File 
"/opt/cp/lib/python2.3/site-packages/scipy/weave/tests/test_size_check.py", 
line 177, in generic_2d
    self.generic_wrap(a,expr)
  File 
"/opt/cp/lib/python2.3/site-packages/scipy/weave/tests/test_size_check.py", 
line 164, in generic_wrap
    desired = array(eval(expr).shape)
  File "<string>", line 0, in ?
ValueError: slice step cannot be zero

======================================================================
ERROR: through a bunch of different indexes at it for good measure.
----------------------------------------------------------------------
Traceback (most recent call last):
  File 
"/opt/cp/lib/python2.3/site-packages/scipy/weave/tests/test_size_check.py", 
line 303, in check_3d_random
    self.generic_3d(expr)
  File 
"/opt/cp/lib/python2.3/site-packages/scipy/weave/tests/test_size_check.py", 
line 180, in generic_3d
    self.generic_wrap(a,expr)
  File 
"/opt/cp/lib/python2.3/site-packages/scipy/weave/tests/test_size_check.py", 
line 164, in generic_wrap
    desired = array(eval(expr).shape)
  File "<string>", line 0, in ?
ValueError: slice step cannot be zero

======================================================================
ERROR: check_calculated_index 
(scipy.weave.tests.test_size_check.test_expressions)
----------------------------------------------------------------------
Traceback (most recent call last):
  File 
"/opt/cp/lib/python2.3/site-packages/scipy/weave/tests/test_size_check.py", 
line 410, in check_calculated_index
    size_check.check_expr(expr,locals())
  File "/usr/lib/python2.3/site-packages/weave/size_check.py", line 52, in 
check_expr
    exec(expr,values)
  File "<string>", line 1, in ?
NameError: name 'a' is not defined

======================================================================
ERROR: check_calculated_index2 
(scipy.weave.tests.test_size_check.test_expressions)
----------------------------------------------------------------------
Traceback (most recent call last):
  File 
"/opt/cp/lib/python2.3/site-packages/scipy/weave/tests/test_size_check.py", 
line 415, in check_calculated_index2
    size_check.check_expr(expr,locals())
  File "/usr/lib/python2.3/site-packages/weave/size_check.py", line 52, in 
check_expr
    exec(expr,values)
  File "<string>", line 1, in ?
NameError: name 'a' is not defined

======================================================================
FAIL: check_type_match_array 
(scipy.weave.tests.test_standard_array_spec.test_array_converter)
----------------------------------------------------------------------
Traceback (most recent call last):
  File 
"/opt/cp/lib/python2.3/site-packages/scipy/weave/tests/test_standard_array_spec.py", 
line 40, in check_type_match_array
    assert(s.type_match(arange(4)))
AssertionError

----------------------------------------------------------------------
Ran 132 tests in 0.804s

FAILED (failures=1, errors=7)




I wondered why there is no such test already in scipy.test(10, 10). I also 
tried scipy.weave.test(10, 10). That test really takes a long time and breaks 
with a segmentation fault. Using gdb I got:




[...]

None
.file changed
None
.file changed
None
after and after2 should be equal in the following
before, after, after2: 2 3 3
.file changed
None
.file changed
None
.file changed
None
.file changed
None
hash: 123
.file changed
None
..file changed
None
/home/bittrich/.python23_compiled/sc_47e62d08f4ce8af8a6c67863d921b7942.cpp: In
   function `PyObject* compiled_func(PyObject*, PyObject*)':
/home/bittrich/.python23_compiled/sc_47e62d08f4ce8af8a6c67863d921b7942.cpp:648: 
error: parse
   error before `!' token
/home/bittrich/.python23_compiled/sc_47e62d08f4ce8af8a6c67863d921b7942.cpp: In
   function `PyObject* compiled_func(PyObject*, PyObject*)':
/home/bittrich/.python23_compiled/sc_47e62d08f4ce8af8a6c67863d921b7942.cpp:648: 
error: parse
   error before `!' token
Efile changed
None
/home/bittrich/.python23_compiled/sc_47e62d08f4ce8af8a6c67863d921b7943.cpp: In
   function `PyObject* compiled_func(PyObject*, PyObject*)':
/home/bittrich/.python23_compiled/sc_47e62d08f4ce8af8a6c67863d921b7943.cpp:648: 
error: parse
   error before `!' token
/home/bittrich/.python23_compiled/sc_47e62d08f4ce8af8a6c67863d921b7943.cpp: In
   function `PyObject* compiled_func(PyObject*, PyObject*)':
/home/bittrich/.python23_compiled/sc_47e62d08f4ce8af8a6c67863d921b7943.cpp:648: 
error: parse
   error before `!' token
Efile changed
None
.file changed
None
.file changed
None
.file changed
None
.file changed
None
.file changed
None
.file changed
None
.file changed
None

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1075425408 (LWP 23435)]
0x400cde50 in clearerr () from /lib/tls/libc.so.6
(gdb)
(gdb) bt
#0  0x400cde50 in clearerr () from /lib/tls/libc.so.6
#1  0x08079725 in PyDict_DelItemString ()
#2  0x0807b5b5 in PyObject_Print ()
#3  0x4363f962 in compiled_func (self=0x0, args=0x0) at object.h:175
#4  0x080fde6a in PyCFunction_Call ()
#5  0x0805b989 in PyObject_Call ()
#6  0x080ab5c7 in PyEval_CallObjectWithKeywords ()
#7  0x080a0df6 in _PyBuiltin_Init ()
#8  0x080fde6a in PyCFunction_Call ()
#9  0x080ab834 in PyEval_CallObjectWithKeywords ()
#10 0x080a9bee in Py_MakePendingCalls ()
#11 0x080ab96d in PyEval_CallObjectWithKeywords ()
#12 0x080ab72c in PyEval_CallObjectWithKeywords ()
#13 0x080a9bee in Py_MakePendingCalls ()
#14 0x080aa77c in PyEval_EvalCodeEx ()
#15 0x080ab8e9 in PyEval_CallObjectWithKeywords ()
#16 0x080ab72c in PyEval_CallObjectWithKeywords ()
#17 0x080a9bee in Py_MakePendingCalls ()
#18 0x080aa77c in PyEval_EvalCodeEx ()
#19 0x080ab8e9 in PyEval_CallObjectWithKeywords ()
#20 0x080ab72c in PyEval_CallObjectWithKeywords ()
#21 0x080a9bee in Py_MakePendingCalls ()
#22 0x080aa77c in PyEval_EvalCodeEx ()
#23 0x080fd9b7 in PyStaticMethod_New ()
#24 0x0805b989 in PyObject_Call ()
#25 0x080623d8 in PyMethod_Fini ()
#26 0x0805b989 in PyObject_Call ()
#27 0x080aba52 in PyEval_CallObjectWithKeywords ()
#28 0x080ab6b9 in PyEval_CallObjectWithKeywords ()
#29 0x080a9bee in Py_MakePendingCalls ()
#30 0x080aa77c in PyEval_EvalCodeEx ()
#31 0x080fd9b7 in PyStaticMethod_New ()
#32 0x0805b989 in PyObject_Call ()
#33 0x080623d8 in PyMethod_Fini ()
#34 0x0805b989 in PyObject_Call ()
#35 0x0808e6fb in _PyObject_SlotCompare ()
#36 0x0805b989 in PyObject_Call ()
#37 0x080aba52 in PyEval_CallObjectWithKeywords ()
#38 0x080ab6b9 in PyEval_CallObjectWithKeywords ()
#39 0x080a9bee in Py_MakePendingCalls ()
#40 0x080aa77c in PyEval_EvalCodeEx ()
#41 0x080fd9b7 in PyStaticMethod_New ()
#42 0x0805b989 in PyObject_Call ()
#43 0x080623d8 in PyMethod_Fini ()
#44 0x0805b989 in PyObject_Call ()
#45 0x0808e6fb in _PyObject_SlotCompare ()
#46 0x0805b989 in PyObject_Call ()
#47 0x080aba52 in PyEval_CallObjectWithKeywords ()
#48 0x080ab6b9 in PyEval_CallObjectWithKeywords ()
#49 0x080a9bee in Py_MakePendingCalls ()

I am using Debian Sarge and have already installed the patch glibc package. So 
there are no problems with weave while using old scipy (debian stable 
package).

Best regards,
Lars



More information about the SciPy-user mailing list