Skip to content

Test failures on Debian if built with bottleneck #1208

Closed
@ghisvail

Description

@ghisvail

On my attempt to package xarray for Debian, I encountered the following issue whereby the package build process (which sequentially runs build, test, install for all supported Python versions) would succeed if the bottleneck build dependency is omitted, but fail at the test stage otherwise. The version of bottleneck currently available in Debian is 1.2.0. The log from pytest is pasted below:

=================================== FAILURES ===================================
___________________ TestDataArray.test_groupby_apply_center ____________________

self = <xarray.test.test_dataarray.TestDataArray testMethod=test_groupby_apply_center>

    def test_groupby_apply_center(self):
        def center(x):
            return x - np.mean(x)
    
        array = self.make_groupby_example_array()
        grouped = array.groupby('abc')
    
        expected_ds = array.to_dataset()
        exp_data = np.hstack([center(self.x[:, :9]),
                              center(self.x[:, 9:10]),
                              center(self.x[:, 10:])])
        expected_ds['foo'] = (['x', 'y'], exp_data)
        expected_centered = expected_ds['foo']
>       self.assertDataArrayAllClose(expected_centered, grouped.apply(center))

xarray/test/test_dataarray.py:1481: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
xarray/test/__init__.py:197: in assertDataArrayAllClose
    assert_xarray_allclose(ar1, ar2, rtol=rtol, atol=atol)
xarray/test/__init__.py:235: in assert_xarray_allclose
    assert_xarray_allclose(a.variable, b.variable)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

a = <xarray.Variable (x: 10, y: 20)>
array([[ 0.09890759,  0.25838611, -0.45524894...108,
        -0.4202902 , -0.3395864 , -0.15065542, -0.03596724, -0.44654371]])
b = <xarray.Variable (x: 10, y: 20)>
array([[ 0.09890759,  0.25838611, -0.45524894...108,
        -0.4202902 , -0.3395864 , -0.15065542, -0.03596724, -0.44654371]])
rtol = 1e-05, atol = 1e-08

    def assert_xarray_allclose(a, b, rtol=1e-05, atol=1e-08):
        import xarray as xr
        ___tracebackhide__ = True  # noqa: F841
        assert type(a) == type(b)
        if isinstance(a, xr.Variable):
            assert a.dims == b.dims
            allclose = data_allclose_or_equiv(
                a.values, b.values, rtol=rtol, atol=atol)
>           assert allclose, '{}\n{}'.format(a.values, b.values)
E           AssertionError: [[ 0.09890759  0.25838611 -0.45524894  0.19438977  0.33283847 -0.43268996
E             -0.48217406  0.19246675 -0.35439804  0.11269385 -0.41444651 -0.48431908
E             -0.39910098  0.49254261 -0.30480298 -0.32417743 -0.07204188  0.2693067
E              0.26276671  0.33348262]
E            [-0.34499113  0.46303903 -0.35713035  0.15563781 -0.01807461  0.08631493
E             -0.17055826  0.12467856  0.02713384 -0.3631607  -0.37158371  0.30343557
E             -0.19175157  0.19976175 -0.36999787 -0.30401142 -0.48258481 -0.34936509
E              0.19736374 -0.09867697]
E            [ 0.09397107  0.20609742 -0.0663552  -0.19143598  0.01839407  0.34196996
E             -0.14854474  0.31282176  0.00777962  0.10738644  0.37057503 -0.15718542
E              0.04364944 -0.06578303 -0.23842453  0.34648799  0.49288676  0.41277933
E              0.50145361 -0.3835484 ]
E            [-0.21291174 -0.45514573  0.12111804 -0.28319255  0.32380163 -0.3474909
E              0.23764942 -0.39402155  0.08587823  0.40455906  0.21993109 -0.48659786
E              0.34223771 -0.46998904  0.3689656   0.27974461 -0.00213432 -0.29371619
E              0.39490332  0.2572515 ]
E            [ 0.0058088  -0.10393215  0.39392373  0.26350055 -0.49707502 -0.23407721
E              0.06441153  0.09532245  0.26361004  0.24034371 -0.46882038  0.49472167
E             -0.31433938  0.26932964 -0.00890849 -0.40142042  0.03952812  0.17389542
E             -0.25081914  0.45069667]
E            [ 0.21532826 -0.05997302  0.02021198  0.48875992 -0.0297901  -0.17712176
E             -0.44359239  0.2964151  -0.30089817 -0.22969758  0.03411299  0.280227
E             -0.24713806 -0.10428751  0.23407841  0.39648906 -0.10151348  0.50768613
E              0.44325196 -0.10753505]
E            [-0.25493908  0.12975219 -0.24043256  0.15334854  0.44570823  0.12942852
E             -0.25521364  0.07838812 -0.3195924   0.08087772 -0.27026464  0.31757927
E              0.00234494  0.23580586  0.47520352 -0.43470572 -0.37470029  0.31202043
E             -0.09424153 -0.17970934]
E            [ 0.37067661  0.38608375  0.38549098 -0.33920416  0.35198984  0.16994992
E              0.22551435  0.32186772  0.19998808 -0.01718303  0.42852689 -0.31499095
E             -0.42404301 -0.16993069  0.44848428 -0.24842595  0.45198088  0.04095394
E             -0.42434055  0.08295308]
E            [-0.062468   -0.31612011  0.46015728  0.01154732  0.07488519  0.18989284
E             -0.27148594  0.26888518 -0.35489493 -0.02320481  0.23154296  0.3228651
E              0.21833924  0.32340958 -0.12142829 -0.08212185  0.00699867 -0.10949993
E             -0.07059468 -0.0616217 ]
E            [ 0.33549783 -0.42434389 -0.45991471  0.09982218  0.32355871 -0.36587924
E             -0.12447734 -0.23565156 -0.31755871 -0.31261466 -0.4069172   0.42464878
E             -0.42271043 -0.25510055  0.39021108 -0.4202902  -0.3395864  -0.15065542
E             -0.03596724 -0.44654371]]
E           [[ 0.09890759  0.25838611 -0.45524894  0.19438977  0.33283847 -0.43268996
E             -0.48217406  0.19246675 -0.35439804  0.47884013 -0.41444651 -0.48431908
E             -0.39910098  0.49254261 -0.30480298 -0.32417743 -0.07204188  0.2693067
E              0.26276671  0.33348262]
E            [-0.34499113  0.46303903 -0.35713035  0.15563781 -0.01807461  0.08631493
E             -0.17055826  0.12467856  0.02713384  0.00298558 -0.37158371  0.30343557
E             -0.19175157  0.19976175 -0.36999787 -0.30401142 -0.48258481 -0.34936509
E              0.19736374 -0.09867697]
E            [ 0.09397107  0.20609742 -0.0663552  -0.19143598  0.01839407  0.34196996
E             -0.14854474  0.31282176  0.00777962  0.47353272  0.37057503 -0.15718542
E              0.04364944 -0.06578303 -0.23842453  0.34648799  0.49288676  0.41277933
E              0.50145361 -0.3835484 ]
E            [-0.21291174 -0.45514573  0.12111804 -0.28319255  0.32380163 -0.3474909
E              0.23764942 -0.39402155  0.08587823  0.77070534  0.21993109 -0.48659786
E              0.34223771 -0.46998904  0.3689656   0.27974461 -0.00213432 -0.29371619
E              0.39490332  0.2572515 ]
E            [ 0.0058088  -0.10393215  0.39392373  0.26350055 -0.49707502 -0.23407721
E              0.06441153  0.09532245  0.26361004  0.60649    -0.46882038  0.49472167
E             -0.31433938  0.26932964 -0.00890849 -0.40142042  0.03952812  0.17389542
E             -0.25081914  0.45069667]
E            [ 0.21532826 -0.05997302  0.02021198  0.48875992 -0.0297901  -0.17712176
E             -0.44359239  0.2964151  -0.30089817  0.13644871  0.03411299  0.280227
E             -0.24713806 -0.10428751  0.23407841  0.39648906 -0.10151348  0.50768613
E              0.44325196 -0.10753505]
E            [-0.25493908  0.12975219 -0.24043256  0.15334854  0.44570823  0.12942852
E             -0.25521364  0.07838812 -0.3195924   0.447024   -0.27026464  0.31757927
E              0.00234494  0.23580586  0.47520352 -0.43470572 -0.37470029  0.31202043
E             -0.09424153 -0.17970934]
E            [ 0.37067661  0.38608375  0.38549098 -0.33920416  0.35198984  0.16994992
E              0.22551435  0.32186772  0.19998808  0.34896325  0.42852689 -0.31499095
E             -0.42404301 -0.16993069  0.44848428 -0.24842595  0.45198088  0.04095394
E             -0.42434055  0.08295308]
E            [-0.062468   -0.31612011  0.46015728  0.01154732  0.07488519  0.18989284
E             -0.27148594  0.26888518 -0.35489493  0.34294147  0.23154296  0.3228651
E              0.21833924  0.32340958 -0.12142829 -0.08212185  0.00699867 -0.10949993
E             -0.07059468 -0.0616217 ]
E            [ 0.33549783 -0.42434389 -0.45991471  0.09982218  0.32355871 -0.36587924
E             -0.12447734 -0.23565156 -0.31755871  0.05353162 -0.4069172   0.42464878
E             -0.42271043 -0.25510055  0.39021108 -0.4202902  -0.3395864  -0.15065542
E             -0.03596724 -0.44654371]]

xarray/test/__init__.py:233: AssertionError
_______________________ TestDataArray.test_groupby_math ________________________

self = <xarray.test.test_dataarray.TestDataArray testMethod=test_groupby_math>

    def test_groupby_math(self):
        array = self.make_groupby_example_array()
        for squeeze in [True, False]:
            grouped = array.groupby('x', squeeze=squeeze)
    
            expected = array + array.coords['x']
            actual = grouped + array.coords['x']
            self.assertDataArrayIdentical(expected, actual)
    
            actual = array.coords['x'] + grouped
            self.assertDataArrayIdentical(expected, actual)
    
            ds = array.coords['x'].to_dataset('X')
            expected = array + ds
            actual = grouped + ds
            self.assertDatasetIdentical(expected, actual)
    
            actual = ds + grouped
            self.assertDatasetIdentical(expected, actual)
    
        grouped = array.groupby('abc')
        expected_agg = (grouped.mean() - np.arange(3)).rename(None)
        actual = grouped - DataArray(range(3), [('abc', ['a', 'b', 'c'])])
        actual_agg = actual.groupby('abc').mean()
>       self.assertDataArrayAllClose(expected_agg, actual_agg)

xarray/test/test_dataarray.py:1527: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
xarray/test/__init__.py:197: in assertDataArrayAllClose
    assert_xarray_allclose(ar1, ar2, rtol=rtol, atol=atol)
xarray/test/__init__.py:235: in assert_xarray_allclose
    assert_xarray_allclose(a.variable, b.variable)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

a = <xarray.Variable (abc: 3)>
array([  4.66319277e-001,  -4.76053212e-001,   1.49956297e+247])
b = <xarray.Variable (abc: 3)>
array([  4.66319277e-01,  -4.76053212e-01,  -9.90547784e+75])
rtol = 1e-05, atol = 1e-08

    def assert_xarray_allclose(a, b, rtol=1e-05, atol=1e-08):
        import xarray as xr
        ___tracebackhide__ = True  # noqa: F841
        assert type(a) == type(b)
        if isinstance(a, xr.Variable):
            assert a.dims == b.dims
            allclose = data_allclose_or_equiv(
                a.values, b.values, rtol=rtol, atol=atol)
>           assert allclose, '{}\n{}'.format(a.values, b.values)
E           AssertionError: [  4.66319277e-001  -4.76053212e-001   1.49956297e+247]
E           [  4.66319277e-01  -4.76053212e-01  -9.90547784e+75]

xarray/test/__init__.py:233: AssertionError
----------------------------- Captured stderr call -----------------------------
/<<PKGBUILDDIR>>/.pybuild/pythonX.Y_2.7/build/xarray/test/test_dataarray.py:1515: FutureWarning: the order of the arguments on DataArray.to_dataset has changed; you now need to supply ``name`` as a keyword argument
  ds = array.coords['x'].to_dataset('X')
________________________ TestDataArray.test_groupby_sum ________________________

self = <xarray.test.test_dataarray.TestDataArray testMethod=test_groupby_sum>

    def test_groupby_sum(self):
        array = self.make_groupby_example_array()
        grouped = array.groupby('abc')
    
        expected_sum_all = Dataset(
            {'foo': Variable(['abc'], np.array([self.x[:, :9].sum(),
                                                self.x[:, 10:].sum(),
                                                self.x[:, 9:10].sum()]).T),
             'abc': Variable(['abc'], np.array(['a', 'b', 'c']))})['foo']
        self.assertDataArrayAllClose(expected_sum_all, grouped.reduce(np.sum))
>       self.assertDataArrayAllClose(expected_sum_all, grouped.sum())

xarray/test/test_dataarray.py:1426: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
xarray/test/__init__.py:197: in assertDataArrayAllClose
    assert_xarray_allclose(ar1, ar2, rtol=rtol, atol=atol)
xarray/test/__init__.py:235: in assert_xarray_allclose
    assert_xarray_allclose(a.variable, b.variable)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

a = <xarray.Variable (abc: 3)>
array([ 45.64328315,  47.37700685,   5.99867891])
b = <xarray.Variable (abc: 3)>
array([  4.56432831e+001,   4.73770068e+001,   1.49956297e+248])
rtol = 1e-05, atol = 1e-08

    def assert_xarray_allclose(a, b, rtol=1e-05, atol=1e-08):
        import xarray as xr
        ___tracebackhide__ = True  # noqa: F841
        assert type(a) == type(b)
        if isinstance(a, xr.Variable):
            assert a.dims == b.dims
            allclose = data_allclose_or_equiv(
                a.values, b.values, rtol=rtol, atol=atol)
>           assert allclose, '{}\n{}'.format(a.values, b.values)
E           AssertionError: [ 45.64328315  47.37700685   5.99867891]
E           [  4.56432831e+001   4.73770068e+001   1.49956297e+248]

xarray/test/__init__.py:233: AssertionError
============= 3 failed, 1149 passed, 340 skipped in 39.32 seconds ==============

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions