2013-05-07 126 views
3

我有一段代碼在我的linux系統上運行良好,但是當我讓一個同事在他的Windows系統上運行它時,它只是崩潰了python。我已經能夠將它縮小到non_zero的Numpy函數的問題,但我想知道是否有人知道爲什麼這會崩潰?Numpy.count_nonzero在64位Windows平臺上崩潰

代碼段(足以崩潰的64位蟒蛇2.7.3)

import numpy as np 
data = np.zeros(2500,dtype='float32, (25000,2)float32') 
""" The following 3 lines are not necessary but asking for the amount 
of non_zeros in an array filled with zeros feels 'silly' 
""" 
data[0][0] = 1 
data[0][1][0] = 2 
data[0][1][1] = 3 
time_elements = np.count_nonzero(data) 

我最有可能會提交錯誤報告與NumPy的人,所以我將不勝感激,如果人們誰可以重新這個系統指定他們用來重新創建它的版本/系統。

PS:所安裝的numpy的是從http://www.lfd.uci.edu/~gohlke/pythonlibs

+1

我的系統崩潰:'Mac 10.6.8','Python 2.7.3','IPython 0.13.1','Numpy 1.7.0'。 Python迅速(幾秒鐘後)打印'Segmentation fault'並退出到命令行。 – askewchan 2013-05-07 14:03:55

回答

1

這是一個錯誤NumPy的截取的64位版本;它看起來不像平臺是相關的。 VOID_nonzero從numpy的/核心/ src目錄/多陣列/ arraytypes.c.src遞歸調用本身,直到它運行的堆棧空間(我的系統上超過87000堆棧幀):

#0 0x00002aaaaab98a4a in ??() 
    from /opt/.../python/2.7.3/lib64/libpython2.7.so.1.0 
#1 0x00002aaaaab9b2a4 in ??() 
    from /opt/.../python/2.7.3/lib64/libpython2.7.so.1.0 
#2 0x00002aaaaab9b6bd in _PyArg_ParseTuple_SizeT() 
    from /opt/.../python/2.7.3/lib64/libpython2.7.so.1.0 
#3 0x00002aaaae7f7b72 in VOID_nonzero (ip=0x2aaab2d623f4 "", 
    ap=<value optimized out>) 
    at numpy/core/src/multiarray/arraytypes.c.src:2345 
#4 0x00002aaaae7f7bc7 in VOID_nonzero (ip=0x2aaab2d623f0 "", 
    ap=0x7fffff3ff118) at numpy/core/src/multiarray/arraytypes.c.src:2363 
[...] 
#87292 0x00002aaaae7f7bc7 in VOID_nonzero (ip=0x2aaab2d0d010 "", 
    ap=0x7fffff3ff118) at numpy/core/src/multiarray/arraytypes.c.src:2363 
#87293 0x00002aaaae7cce87 in reduce_count_nonzero_loop (iter=0xbcc670, 
    dataptr=0xbcc770, strides=0xbcc760, countptr=0xbcc738, 
    iternext=0x2aaaae7beb60 <npyiter_buffered_reduce_iternext_iters2>, 
    needs_api=0, skip_first_count=0, data=0x2aaaae7f7ac0) 
    at numpy/core/src/multiarray/item_selection.c:2127 
#87294 0x00002aaaae8180f1 in PyArray_ReduceWrapper (operand=0xa099d7, out=0x0, 
    wheremask=<value optimized out>, operand_dtype=0xa04ce8, 
    result_dtype=<value optimized out>, casting=NPY_SAME_KIND_CASTING, 
    axis_flags=0x7fffffffcb90 "\001\024`", reorderable=1, skipna=0, 
    skipwhichna=0x0, keepdims=0, subok=0, 
    assign_identity=0x2aaaae811500 <assign_reduce_identity_zero>, 
    loop=0x2aaaae7ccdd0 <reduce_count_nonzero_loop>, 
    masked_loop=0x2aaaae7f8c00 <reduce_count_nonzero_masked_loop>, 
    advanced_masked_loop=0, data=0x2aaaae7f7ac0, buffersize=0, 
    funcname=0x2aaaae85fa61 "count_nonzero") 
    at numpy/core/src/multiarray/reduction.c:1000 
#87295 0x00002aaaae827c6e in PyArray_ReduceCountNonzero (
    __NPY_UNUSED_TAGGEDself=<value optimized out>, args=<value optimized out>, 
    kwds=<value optimized out>) 
    at numpy/core/src/multiarray/item_selection.c:2218 
#87296 array_count_nonzero (__NPY_UNUSED_TAGGEDself=<value optimized out>, 
    args=<value optimized out>, kwds=<value optimized out>) 
    at numpy/core/src/multiarray/multiarraymodule.c:2091 
#87297 0x00002aaaaab8cd14 in PyEval_EvalFrameEx() 
    from /opt/.../python/2.7.3/lib64/libpython2.7.so.1.0 
#87298 0x00002aaaaab8e4c2 in PyEval_EvalCodeEx() 
    from /opt/.../python/2.7.3/lib64/libpython2.7.so.1.0 
#87299 0x00002aaaaab8e512 in PyEval_EvalCode() 
    from /opt/.../python/2.7.3/lib64/libpython2.7.so.1.0 
#87300 0x00002aaaaaba7ff2 in ??() 
    from /opt/.../python/2.7.3/lib64/libpython2.7.so.1.0 
#87301 0x00002aaaaaba81ea in PyRun_StringFlags() 
    from /opt/.../python/2.7.3/lib64/libpython2.7.so.1.0 
#87302 0x00002aaaaaba93b0 in PyRun_SimpleStringFlags() 
    from /opt/.../python/2.7.3/lib64/libpython2.7.so.1.0 
#87303 0x00002aaaaabb9a26 in Py_Main() 
    from /opt/.../python/2.7.3/lib64/libpython2.7.so.1.0 
#87304 0x00000036c961d994 in __libc_start_main() from /lib64/libc.so.6 
#87305 0x0000000000400649 in _start() 

當地人:

key = 0xa82d00 
    value = 0xa05f80 
    savedflags = 1287 
    new = 0xa04c90 
    title = 0x7fffff3ff800 
    offset = 2 
    pos = 2 
    i = <value optimized out> 
    len = <value optimized out> 
+0

開發人員必須改變一些東西,因爲如果您運行我在我的OP中發佈的默認Python代碼片段,NumPy將安裝在Ubuntu 12.04 LTS上,它運行得很好。 – 2013-05-07 15:16:36

+0

我會將這些信息包含在我提出的github問題中,如果這對你很好。 – 2013-05-07 15:28:46

+0

@BasJansen當然沒問題。我平分了違規提交併在github問題上貼了一個補丁;如果我有時間,我會提交拉請求。 – ecatmur 2013-05-07 15:41:26

相關問題