Bug 2137289

Summary: python-Bottleneck fails to build with numpy 1.23
Product: [Fedora] Fedora Reporter: Miro Hrončok <mhroncok>
Component: python-BottleneckAssignee: Björn Esser (besser82) <besser82>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 38CC: besser82, cstratak, gwync, jspaleta, orion, quantum.analyst, rdieter, thrnciar, tomspur
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-Bottleneck-1.3.7-1.fc39 python-Bottleneck-1.3.7-1.fc38 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-08 04:28:29 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2056294    
Bug Blocks: 2117176, 2131120, 2135404, 2168842    

Description Miro Hrončok 2022-10-24 11:08:16 UTC
Description of problem:
When updating numpy to 1.23.4, I realized python-Bottleneck fails to build with it.

https://copr.fedorainfracloud.org/coprs/churchyard/numpy-1.23/package/python-Bottleneck/

=================================== FAILURES ===================================
_________________________ test_list_input[move_argmin] _________________________

func = <built-in function move_argmin>

    @pytest.mark.parametrize("func", bn.get_functions("all"), ids=lambda x: x.__name__)
    def test_list_input(func):
        """Test that bn.xxx gives the same output as bn.slow.xxx for list input."""
        msg = "\nfunc %s | input %s (%s) | shape %s\n"
        msg += "\nInput array:\n%s\n"
        name = func.__name__
        if name == "replace":
            return
        func0 = eval("bn.slow.%s" % name)
        for i, a in enumerate(lists()):
            with warnings.catch_warnings():
                warnings.simplefilter("ignore")
                try:
>                   actual = func(a)
E                   TypeError: wrong number of arguments

bottleneck/tests/list_input_test.py:42: TypeError

During handling of the above exception, another exception occurred:

func = <built-in function move_argmin>

    @pytest.mark.parametrize("func", bn.get_functions("all"), ids=lambda x: x.__name__)
    def test_list_input(func):
        """Test that bn.xxx gives the same output as bn.slow.xxx for list input."""
        msg = "\nfunc %s | input %s (%s) | shape %s\n"
        msg += "\nInput array:\n%s\n"
        name = func.__name__
        if name == "replace":
            return
        func0 = eval("bn.slow.%s" % name)
        for i, a in enumerate(lists()):
            with warnings.catch_warnings():
                warnings.simplefilter("ignore")
                try:
                    actual = func(a)
                    desired = func0(a)
                except TypeError:
                    actual = func(a, 2)
>                   desired = func0(a, 2)

bottleneck/tests/list_input_test.py:46: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
bottleneck/slow/move.py:75: in move_argmin
    return move_func(argmin, a, window, min_count, axis=axis)
bottleneck/slow/move.py:149: in move_func
    y[tuple(idx2)] = func(a[tuple(idx1)], axis=axis, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

a = array([0.]), axis = -1

    def argmin(a, axis):
        a = np.array(a, copy=False)
        flip = [slice(None)] * a.ndim
        flip[axis] = slice(None, None, -1)
>       a = a[flip]  # if tie, pick index of rightmost tie
E       IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

bottleneck/slow/move.py:59: IndexError
_________________________ test_list_input[move_argmax] _________________________

func = <built-in function move_argmax>

    @pytest.mark.parametrize("func", bn.get_functions("all"), ids=lambda x: x.__name__)
    def test_list_input(func):
        """Test that bn.xxx gives the same output as bn.slow.xxx for list input."""
        msg = "\nfunc %s | input %s (%s) | shape %s\n"
        msg += "\nInput array:\n%s\n"
        name = func.__name__
        if name == "replace":
            return
        func0 = eval("bn.slow.%s" % name)
        for i, a in enumerate(lists()):
            with warnings.catch_warnings():
                warnings.simplefilter("ignore")
                try:
>                   actual = func(a)
E                   TypeError: wrong number of arguments

bottleneck/tests/list_input_test.py:42: TypeError

During handling of the above exception, another exception occurred:

func = <built-in function move_argmax>

    @pytest.mark.parametrize("func", bn.get_functions("all"), ids=lambda x: x.__name__)
    def test_list_input(func):
        """Test that bn.xxx gives the same output as bn.slow.xxx for list input."""
        msg = "\nfunc %s | input %s (%s) | shape %s\n"
        msg += "\nInput array:\n%s\n"
        name = func.__name__
        if name == "replace":
            return
        func0 = eval("bn.slow.%s" % name)
        for i, a in enumerate(lists()):
            with warnings.catch_warnings():
                warnings.simplefilter("ignore")
                try:
                    actual = func(a)
                    desired = func0(a)
                except TypeError:
                    actual = func(a, 2)
>                   desired = func0(a, 2)

bottleneck/tests/list_input_test.py:46: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
bottleneck/slow/move.py:101: in move_argmax
    return move_func(argmax, a, window, min_count, axis=axis)
bottleneck/slow/move.py:149: in move_func
    y[tuple(idx2)] = func(a[tuple(idx1)], axis=axis, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

a = array([0.]), axis = -1

    def argmax(a, axis):
        a = np.array(a, copy=False)
        flip = [slice(None)] * a.ndim
        flip[axis] = slice(None, None, -1)
>       a = a[flip]  # if tie, pick index of rightmost tie
E       IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

bottleneck/slow/move.py:85: IndexError
____________________________ test_move[move_argmin] ____________________________

func = <built-in function move_argmin>

    @pytest.mark.parametrize("func", bn.get_functions("move"), ids=lambda x: x.__name__)
    def test_move(func):
        """Test that bn.xxx gives the same output as a reference function."""
        fmt = (
            "\nfunc %s | window %d | min_count %s | input %s (%s) | shape %s | "
            "axis %s | order %s\n"
        )
        fmt += "\nInput array:\n%s\n"
        aaae = assert_array_almost_equal
        func_name = func.__name__
        func0 = eval("bn.slow.%s" % func_name)
        if func_name == "move_var":
            decimal = 3
        else:
            decimal = 5
        for i, a in enumerate(arrays(func_name)):
            axes = range(-1, a.ndim)
            for axis in axes:
                windows = range(1, a.shape[axis])
                for window in windows:
                    min_counts = list(range(1, window + 1)) + [None]
                    for min_count in min_counts:
                        actual = func(a, window, min_count, axis=axis)
>                       desired = func0(a, window, min_count, axis=axis)

bottleneck/tests/move_test.py:33: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
bottleneck/slow/move.py:75: in move_argmin
    return move_func(argmin, a, window, min_count, axis=axis)
bottleneck/slow/move.py:149: in move_func
    y[tuple(idx2)] = func(a[tuple(idx1)], axis=axis, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

a = array([inf]), axis = -1

    def argmin(a, axis):
        a = np.array(a, copy=False)
        flip = [slice(None)] * a.ndim
        flip[axis] = slice(None, None, -1)
>       a = a[flip]  # if tie, pick index of rightmost tie
E       IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

bottleneck/slow/move.py:59: IndexError
____________________________ test_move[move_argmax] ____________________________

func = <built-in function move_argmax>

    @pytest.mark.parametrize("func", bn.get_functions("move"), ids=lambda x: x.__name__)
    def test_move(func):
        """Test that bn.xxx gives the same output as a reference function."""
        fmt = (
            "\nfunc %s | window %d | min_count %s | input %s (%s) | shape %s | "
            "axis %s | order %s\n"
        )
        fmt += "\nInput array:\n%s\n"
        aaae = assert_array_almost_equal
        func_name = func.__name__
        func0 = eval("bn.slow.%s" % func_name)
        if func_name == "move_var":
            decimal = 3
        else:
            decimal = 5
        for i, a in enumerate(arrays(func_name)):
            axes = range(-1, a.ndim)
            for axis in axes:
                windows = range(1, a.shape[axis])
                for window in windows:
                    min_counts = list(range(1, window + 1)) + [None]
                    for min_count in min_counts:
                        actual = func(a, window, min_count, axis=axis)
>                       desired = func0(a, window, min_count, axis=axis)

bottleneck/tests/move_test.py:33: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
bottleneck/slow/move.py:101: in move_argmax
    return move_func(argmax, a, window, min_count, axis=axis)
bottleneck/slow/move.py:149: in move_func
    y[tuple(idx2)] = func(a[tuple(idx1)], axis=axis, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

a = array([inf]), axis = -1

    def argmax(a, axis):
        a = np.array(a, copy=False)
        flip = [slice(None)] * a.ndim
        flip[axis] = slice(None, None, -1)
>       a = a[flip]  # if tie, pick index of rightmost tie
E       IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

bottleneck/slow/move.py:85: IndexError
________________________ test_arg_parsing[move_argmin] _________________________

func = <built-in function move_argmin>, decimal = 5

    @pytest.mark.parametrize("func", bn.get_functions("move"), ids=lambda x: x.__name__)
    def test_arg_parsing(func, decimal=5):
        """test argument parsing."""

        name = func.__name__
        func0 = eval("bn.slow.%s" % name)

        a = np.array([1.0, 2, 3])

        fmt = "\n%s" % func
        fmt += "%s\n"
        fmt += "\nInput array:\n%s\n" % a

        actual = func(a, 2)
>       desired = func0(a, 2)

bottleneck/tests/move_test.py:71: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
bottleneck/slow/move.py:75: in move_argmin
    return move_func(argmin, a, window, min_count, axis=axis)
bottleneck/slow/move.py:149: in move_func
    y[tuple(idx2)] = func(a[tuple(idx1)], axis=axis, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

a = array([1.]), axis = -1

    def argmin(a, axis):
        a = np.array(a, copy=False)
        flip = [slice(None)] * a.ndim
        flip[axis] = slice(None, None, -1)
>       a = a[flip]  # if tie, pick index of rightmost tie
E       IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

bottleneck/slow/move.py:59: IndexError
________________________ test_arg_parsing[move_argmax] _________________________

func = <built-in function move_argmax>, decimal = 5

    @pytest.mark.parametrize("func", bn.get_functions("move"), ids=lambda x: x.__name__)
    def test_arg_parsing(func, decimal=5):
        """test argument parsing."""

        name = func.__name__
        func0 = eval("bn.slow.%s" % name)

        a = np.array([1.0, 2, 3])

        fmt = "\n%s" % func
        fmt += "%s\n"
        fmt += "\nInput array:\n%s\n" % a

        actual = func(a, 2)
>       desired = func0(a, 2)

bottleneck/tests/move_test.py:71: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
bottleneck/slow/move.py:101: in move_argmax
    return move_func(argmax, a, window, min_count, axis=axis)
bottleneck/slow/move.py:149: in move_func
    y[tuple(idx2)] = func(a[tuple(idx1)], axis=axis, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

a = array([1.]), axis = -1

    def argmax(a, axis):
        a = np.array(a, copy=False)
        flip = [slice(None)] * a.ndim
        flip[axis] = slice(None, None, -1)
>       a = a[flip]  # if tie, pick index of rightmost tie
E       IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

bottleneck/slow/move.py:85: IndexError
=========================== short test summary info ============================
FAILED bottleneck/tests/list_input_test.py::test_list_input[move_argmin] - In...
FAILED bottleneck/tests/list_input_test.py::test_list_input[move_argmax] - In...
FAILED bottleneck/tests/move_test.py::test_move[move_argmin] - IndexError: on...
FAILED bottleneck/tests/move_test.py::test_move[move_argmax] - IndexError: on...
FAILED bottleneck/tests/move_test.py::test_arg_parsing[move_argmin] - IndexEr...
FAILED bottleneck/tests/move_test.py::test_arg_parsing[move_argmax] - IndexEr...
================ 6 failed, 185 passed, 51962 warnings in 56.06s ================


Version-Release number of selected component: 1.3.2-5


How reproducible:
Fetch numpy from his PR:
https://src.fedoraproject.org/rpms/numpy/pull-request/27
Or use this Copr:
https://copr.fedorainfracloud.org/coprs/churchyard/numpy-1.23/
And build this package.

Actual results: Package fails to build.


Expected results: Package builds successfully.


Let me know if we should delay the update or proceed.

Comment 1 Miro Hrončok 2022-11-08 14:46:38 UTC
No response, so I'm proceeding with the numpy update.

Comment 2 Ben Cotton 2023-02-07 14:57:39 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 38 development cycle.
Changing version to 38.

Comment 3 Elliott Sales de Andrade 2023-02-20 04:11:19 UTC
This is blocking the latest xarray update as the use of np.bool breaks since NumPy 1.23 removed those aliases. I think it's fixed in the latest version.

Comment 4 Elliott Sales de Andrade 2023-03-26 06:36:20 UTC
We're now past F38 Beta and the package is (at least partially) broken. Do you have plans to make an update?

Comment 5 Tomáš Hrnčiar 2023-04-04 12:24:28 UTC
I've opened PR myself since Bottleneck is blocking Python 3.12 effort.

PR: https://src.fedoraproject.org/rpms/python-Bottleneck/pull-request/4

Comment 6 Tomáš Hrnčiar 2023-04-04 12:28:55 UTC
I've just realized this is a F38 bugzilla. This is the correct PR: https://src.fedoraproject.org/rpms/python-Bottleneck/pull-request/5

Comment 7 Fedora Update System 2023-05-08 04:09:39 UTC
FEDORA-2023-f48885ca7a has been submitted as an update to Fedora 38. https://bodhi.fedoraproject.org/updates/FEDORA-2023-f48885ca7a

Comment 8 Fedora Update System 2023-05-08 04:25:55 UTC
FEDORA-2023-becec70b15 has been submitted as an update to Fedora 39. https://bodhi.fedoraproject.org/updates/FEDORA-2023-becec70b15

Comment 9 Fedora Update System 2023-05-08 04:28:29 UTC
FEDORA-2023-becec70b15 has been pushed to the Fedora 39 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 10 Fedora Update System 2023-05-09 03:16:41 UTC
FEDORA-2023-f48885ca7a has been pushed to the Fedora 38 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-f48885ca7a`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-f48885ca7a

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 11 Fedora Update System 2023-05-17 01:30:25 UTC
FEDORA-2023-f48885ca7a has been pushed to the Fedora 38 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 12 Red Hat Bugzilla 2023-09-19 04:28:44 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 120 days