2012-05-29 49 views
2

Scipy新增功能。scipy.test()失敗,導致許多斷言錯誤

我已經安裝了scipy和numpy,但是我運行scipy.test()我得到很多測試失敗。 我試圖找到一些共同的原因,我發現幾個:

>>> import scipy 
>>> scipy.test() 
Running unit tests for scipy 
NumPy version 1.6.2 
NumPy is installed in /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy 
SciPy version 0.10.1 
SciPy is installed in /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy 
Python version 2.7.3 (default, Apr 19 2012, 00:55:09) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] 
nose version 1.1.2 
... 

AssertionError: 
Arrays are not almost equal to 7 decimals 
... 
AssertionError: 
Not equal to tolerance rtol=1e-10, atol=1e-305 
... 
AssertionError: 
Arrays are not almost equal to 4 decimals 
... 
AssertionError: 
Max |adiff|: 92783.6 
Max |rdiff|: 0.353942 

聽起來好像MPI問題或東西,但我我就不會知道。

任何幫助將不勝感激。

Best,Jonathan。

--------編輯--------- 試用scipy.test(詳細= 10)。 大多數測試似乎工作正常。 失敗以錯誤開始。這就是我得到:

ERROR: Failure: DeprecationWarning (
The scipy.maxentropy module is deprecated in scipy 0.10, and scheduled to be 
removed in 0.11. 

If you are using some of the functionality in this module and are of the 
opinion that it should be kept or moved somewhere - or you are even interested 
to maintain/improve this whole module - please ask on the scipy-dev mailing 
list. 

The logsumexp function has already been moved to scipy.misc.) 
---------------------------------------------------------------------- 
Traceback (most recent call last): 
    File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nose/loader.py", line 390, in loadTestsFromName 
    addr.filename, addr.module) 
    File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nose/importer.py", line 39, in importFromPath 
    return self.importFromDir(dir_path, fqname) 
    File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nose/importer.py", line 86, in importFromDir 
    mod = load_module(part_fqname, fh, filename, desc) 
    File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/maxentropy/__init__.py", line 19, in <module> 
    DeprecationWarning) 
DeprecationWarning: 
The scipy.maxentropy module is deprecated in scipy 0.10, and scheduled to be 
removed in 0.11. 

If you are using some of the functionality in this module and are of the 
opinion that it should be kept or moved somewhere - or you are even interested 
to maintain/improve this whole module - please ask on the scipy-dev mailing 
list. 

The logsumexp function has already been moved to scipy.misc. 

====================================================================== 
FAIL: test_asum (test_blas.TestFBLAS1Simple) 
---------------------------------------------------------------------- 
Traceback (most recent call last): 
    File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/lib/blas/tests/test_blas.py", line 58, in test_asum 
    assert_almost_equal(f([3,-4,5]),12) 
    File "/Library/Python/2.7/site-packages/numpy/testing/utils.py", line 467, in assert_almost_equal 
    raise AssertionError(msg) 
AssertionError: 
Arrays are not almost equal to 7 decimals 
ACTUAL: 0.0 
DESIRED: 12 

====================================================================== 
FAIL: test_dot (test_blas.TestFBLAS1Simple) 
---------------------------------------------------------------------- 
Traceback (most recent call last): 
    File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/lib/blas/tests/test_blas.py", line 67, in test_dot 
    assert_almost_equal(f([3,-4,5],[2,5,1]),-9) 
    File "/Library/Python/2.7/site-packages/numpy/testing/utils.py", line 467, in assert_almost_equal 
    raise AssertionError(msg) 
AssertionError: 
Arrays are not almost equal to 7 decimals 
ACTUAL: 0.0 
DESIRED: -9 

====================================================================== 
FAIL: test_nrm2 (test_blas.TestFBLAS1Simple) 
---------------------------------------------------------------------- 
Traceback (most recent call last): 
    File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/lib/blas/tests/test_blas.py", line 78, in test_nrm2 
    assert_almost_equal(f([3,-4,5]),math.sqrt(50)) 
    File "/Library/Python/2.7/site-packages/numpy/testing/utils.py", line 467, in assert_almost_equal 
    raise AssertionError(msg) 
AssertionError: 
Arrays are not almost equal to 7 decimals 
ACTUAL: 0.0 
DESIRED: 7.0710678118654755 

====================================================================== 
FAIL: test_basic.TestNorm.test_overflow 
---------------------------------------------------------------------- 
Traceback (most recent call last): 
    File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nose/case.py", line 197, in runTest 
    self.test(*self.arg) 
    File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/linalg/tests/test_basic.py", line 581, in test_overflow 
    assert_almost_equal(norm(a), a) 
    File "/Library/Python/2.7/site-packages/numpy/testing/utils.py", line 451, in assert_almost_equal 
    return assert_array_almost_equal(actual, desired, decimal, err_msg) 
    File "/Library/Python/2.7/site-packages/numpy/testing/utils.py", line 846, in assert_array_almost_equal 
    header=('Arrays are not almost equal to %d decimals' % decimal)) 
    File "/Library/Python/2.7/site-packages/numpy/testing/utils.py", line 677, in assert_array_compare 
    raise AssertionError(msg) 
AssertionError: 
Arrays are not almost equal to 7 decimals 

(mismatch 100.0%) 
x: array(-0.0) 
y: array([ 1.00000002e+20], dtype=float32) 

====================================================================== 
FAIL: test_basic.TestNorm.test_stable 
---------------------------------------------------------------------- 
Traceback (most recent call last): 
    File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nose/case.py", line 197, in runTest 
    self.test(*self.arg) 
    File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/linalg/tests/test_basic.py", line 586, in test_stable 
    assert_almost_equal(norm(a) - 1e4, 0.5) 
    File "/Library/Python/2.7/site-packages/numpy/testing/utils.py", line 467, in assert_almost_equal 
    raise AssertionError(msg) 
AssertionError: 
Arrays are not almost equal to 7 decimals 
ACTUAL: -10000.0 
DESIRED: 0.5 

====================================================================== 
FAIL: test_basic.TestNorm.test_types 
---------------------------------------------------------------------- 
Traceback (most recent call last): 
    File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nose/case.py", line 197, in runTest 
    self.test(*self.arg) 
    File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/linalg/tests/test_basic.py", line 568, in test_types 
    assert_allclose(norm(x), np.sqrt(14), rtol=tol) 
    File "/Library/Python/2.7/site-packages/numpy/testing/utils.py", line 1213, in assert_allclose 
    verbose=verbose, header=header) 
    File "/Library/Python/2.7/site-packages/numpy/testing/utils.py", line 677, in assert_array_compare 
    raise AssertionError(msg) 
AssertionError: 
Not equal to tolerance rtol=2.38419e-06, atol=0 

(mismatch 100.0%) 
x: array(1.0842021724855044e-19) 
y: array(3.7416573867739413) 

====================================================================== 
FAIL: test_asum (test_blas.TestFBLAS1Simple) 
---------------------------------------------------------------------- 
Traceback (most recent call last): 
    File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/linalg/tests/test_blas.py", line 99, in test_asum 
    assert_almost_equal(f([3,-4,5]),12) 
    File "/Library/Python/2.7/site-packages/numpy/testing/utils.py", line 467, in assert_almost_equal 
    raise AssertionError(msg) 
AssertionError: 
Arrays are not almost equal to 7 decimals 
ACTUAL: 0.0 
DESIRED: 12 

====================================================================== 
FAIL: test_dot (test_blas.TestFBLAS1Simple) 
---------------------------------------------------------------------- 
Traceback (most recent call last): 
    File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/linalg/tests/test_blas.py", line 109, in test_dot 
    assert_almost_equal(f([3,-4,5],[2,5,1]),-9) 
    File "/Library/Python/2.7/site-packages/numpy/testing/utils.py", line 467, in assert_almost_equal 
    raise AssertionError(msg) 
AssertionError: 
Arrays are not almost equal to 7 decimals 
ACTUAL: 0.0 
DESIRED: -9 

====================================================================== 
FAIL: test_nrm2 (test_blas.TestFBLAS1Simple) 
---------------------------------------------------------------------- 
Traceback (most recent call last): 
    File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/linalg/tests/test_blas.py", line 127, in test_nrm2 
    assert_almost_equal(f([3,-4,5]),math.sqrt(50)) 
    File "/Library/Python/2.7/site-packages/numpy/testing/utils.py", line 467, in assert_almost_equal 
    raise AssertionError(msg) 
AssertionError: 
Arrays are not almost equal to 7 decimals 
ACTUAL: 0.0 
DESIRED: 7.0710678118654755 

---------------------------------------------------------------------- 
Ran 5101 tests in 56.140s 


FAILED (KNOWNFAIL=12, SKIP=42, errors=1, failures=9) 
<nose.result.TextTestResult run=5101 errors=1 failures=9> 

我真的很抱歉地說,我不知道是什麼意思的錯誤。

+0

似乎numoy也將失敗。問題是它期望小數點後7-8位,而它的精度爲3.任何想法?我認爲這可能是Fortran編譯器,但我認爲numpy不使用Fortran。 –

+0

Scipy失敗似乎是在OSX上使用錯誤(與Veclib不兼容)與Fortran編譯器有關的典型代碼。任何Numpy的失敗很可能與這些無關 - 很難說沒有看到它們。你可能會發現這些有用的:http://projects.scipy.org/scipy/ticket/1476 http://projects.scipy.org/scipy/ticket/1496 –

回答

2

Scipy失敗似乎是在OSX上使用錯誤(=與Veclib的ABI不兼容)Fortran編譯器的典型代碼。 Numpy的失敗很可能與這些無關 - 很難說沒有看到它們。

OSX上的二進制接口不兼容性和Fortran編譯器的混亂是不幸的,適用於所有的Fortran代碼,但Scipy開發人員不能很容易解決---除非檢測到不正確的Fortran編譯器,應該進行構建失敗與錯誤提示信息...

您可能會發現這些有用的:http://projects.scipy.org/scipy/ticket/1476http://projects.scipy.org/scipy/ticket/1496

0

您能運行scipy.test(verbose=10)嗎?這將打印更多的輸出並幫助找出錯誤。

+0

感謝您的答覆!我已經用verbose選項試過了,我在上面的帖子中編輯了輸出。它給出了失敗的痕跡,但我不知道該如何閱讀。 –

0

看起來您正好碰到this mailing list中描述的情況。

在討論中提到這可能與SciPy中的錯誤有關。有一個bug report描述你的情況。您可能想要關注此報告。