Skip to content

test failures for setuptools >= 60.0 #20692

@kloczek

Description

@kloczek

Describe the issue:

numpy test suite is failing with error message distutils Version classes are deprecated. Use packaging.version instead.

Reproduce the code example:

I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.
- `python3 -sBm build -w`
- run `runtests.py`

Error message:

+ cd numpy-1.22.0
+ /usr/bin/python3 runtests.py
Building, see build.log...
    ... build in progress
    ... build in progress
Build OK
NumPy version 1.22.0
NumPy relaxed strides checking option: True
NumPy CPU features:  SSE SSE2 SSE3 SSSE3* SSE41* POPCNT* SSE42* AVX* F16C* FMA3* AVX2* AVX512F? AVX512CD? AVX512_KNL? AVX512_KNM? AVX512_SKX? AVX512_CLX? AVX512_CNL? AVX512_ICL?

================================================================================== ERRORS ==================================================================================
_______________________________________ ERROR collecting build/testenv/lib64/python3.8/site-packages/numpy/core/tests/test_cython.py _______________________________________
numpy/core/tests/test_cython.py:22: in <module>
    required_version = LooseVersion("0.29.21")
        LooseVersion = <class 'distutils.version.LooseVersion'>
        __builtins__ = <builtins>
        __cached__ = '/home/tkloczko/rpmbuild/BUILD/numpy-1.22.0/build/testenv/lib64/python3.8/site-packages/numpy/core/tests/__pycache__/test_cython.cpython-38.pyc'
        __doc__    = None
        __file__   = '/home/tkloczko/rpmbuild/BUILD/numpy-1.22.0/build/testenv/lib64/python3.8/site-packages/numpy/core/tests/test_cython.py'
        __loader__ = <_pytest.assertion.rewrite.AssertionRewritingHook object at 0x7fb259630730>
        __name__   = 'numpy.core.tests.test_cython'
        __package__ = 'numpy.core.tests'
        __spec__   = ModuleSpec(name='numpy.core.tests.test_cython', loader=<_pytest.assertion.rewrite.AssertionRewritingHook object at 0x7...home/tkloczko/rpmbuild/BUILD/numpy-1.22.0/build/testenv/lib64/python3.8/site-packages/numpy/core/tests/test_cython.py')
        __warningregistry__ = {'version': 341}
        cython     = <module 'cython' from '/usr/lib64/python3.8/site-packages/cython.py'>
        cython_version = '0.29.26'
        np         = <module 'numpy' from '/home/tkloczko/rpmbuild/BUILD/numpy-1.22.0/build/testenv/lib64/python3.8/site-packages/numpy/__init__.py'>
        os         = <module 'os' from '/usr/lib64/python3.8/os.py'>
        pytest     = <module 'pytest' from '/usr/lib/python3.8/site-packages/pytest/__init__.py'>
        shutil     = <module 'shutil' from '/usr/lib64/python3.8/shutil.py'>
        subprocess = <module 'subprocess' from '/usr/lib64/python3.8/subprocess.py'>
        sys        = <module 'sys' (built-in)>
/usr/lib/python3.8/site-packages/setuptools/_distutils/version.py:53: in __init__
    warnings.warn(
E   DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
        self       = <[AttributeError("'LooseVersion' object has no attribute 'vstring'") raised in repr()] LooseVersion object at 0x7fb258d68d00>
        vstring    = '0.29.21'
____________________________________ ERROR collecting build/testenv/lib64/python3.8/site-packages/numpy/random/tests/test_extending.py _____________________________________
numpy/random/tests/test_extending.py:39: in <module>
    required_version = LooseVersion('0.29.21')
        LooseVersion = <class 'distutils.version.LooseVersion'>
        __builtins__ = <builtins>
        __cached__ = '/home/tkloczko/rpmbuild/BUILD/numpy-1.22.0/build/testenv/lib64/python3.8/site-packages/numpy/random/tests/__pycache__/test_extending.cpython-38.pyc'
        __doc__    = None
        __file__   = '/home/tkloczko/rpmbuild/BUILD/numpy-1.22.0/build/testenv/lib64/python3.8/site-packages/numpy/random/tests/test_extending.py'
        __loader__ = <_pytest.assertion.rewrite.AssertionRewritingHook object at 0x7fb259630730>
        __name__   = 'numpy.random.tests.test_extending'
        __package__ = 'numpy.random.tests'
        __spec__   = ModuleSpec(name='numpy.random.tests.test_extending', loader=<_pytest.assertion.rewrite.AssertionRewritingHook object a...tkloczko/rpmbuild/BUILD/numpy-1.22.0/build/testenv/lib64/python3.8/site-packages/numpy/random/tests/test_extending.py')
        __warningregistry__ = {'version': 359}
        cffi       = None
        cython     = <module 'cython' from '/usr/lib64/python3.8/site-packages/cython.py'>
        cython_version = '0.29.26'
        exec_mod_from_location = <function exec_mod_from_location at 0x7fb259a4f1f0>
        np         = <module 'numpy' from '/home/tkloczko/rpmbuild/BUILD/numpy-1.22.0/build/testenv/lib64/python3.8/site-packages/numpy/__init__.py'>
        numba      = None
        os         = <module 'os' from '/usr/lib64/python3.8/os.py'>
        pytest     = <module 'pytest' from '/usr/lib/python3.8/site-packages/pytest/__init__.py'>
        shutil     = <module 'shutil' from '/usr/lib64/python3.8/shutil.py'>
        subprocess = <module 'subprocess' from '/usr/lib64/python3.8/subprocess.py'>
        sys        = <module 'sys' (built-in)>
        w          = []
        warnings   = <module 'warnings' from '/usr/lib64/python3.8/warnings.py'>
/usr/lib/python3.8/site-packages/setuptools/_distutils/version.py:53: in __init__
    warnings.warn(
E   DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
        self       = <[AttributeError("'LooseVersion' object has no attribute 'vstring'") raised in repr()] LooseVersion object at 0x7fb2530617c0>
        vstring    = '0.29.21'
========================================================================= short test summary info ==========================================================================
ERROR numpy/core/tests/test_cython.py - DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
ERROR numpy/random/tests/test_extending.py - DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1292 deselected, 2 errors in 15.44s

NumPy/Python version information:

numpy 1.22.0
python 3.8.12

BTW is it any reason why numpy is not using pytest straight?
Here is pytest output

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-numpy-1.22.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-numpy-1.22.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra --import-mode=importlib
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /home/tkloczko/rpmbuild/BUILD/numpy-1.22.0, configfile: pytest.ini
plugins: benchmark-3.4.1, hypothesis-6.34.1
collected 0 items / 1 error

================================================================================== ERRORS ==================================================================================
______________________________________________________________________ ERROR collecting test session _______________________________________________________________________
/usr/lib/python3.8/site-packages/pluggy/_manager.py:115: in register
    hook._maybe_apply_history(hookimpl)
        hook       = <_HookCaller 'pytest_addoption'>
        hookcallers = []
        hookimpl   = <HookImpl plugin_name='/home/tkloczko/rpmbuild/BUILD/numpy-1.22.0/build/testenv/lib64/python3.8/site-packages/numpy/co...test' from '/home/tkloczko/rpmbuild/BUILD/numpy-1.22.0/build/testenv/lib64/python3.8/site-packages/numpy/conftest.py'>>
        hookimpl_opts = {'hookwrapper': False, 'optionalhook': False, 'specname': None, 'tryfirst': False, ...}
        method     = <function pytest_addoption at 0x7fb89d720c10>
        name       = 'pytest_addoption'
        plugin     = <module 'conftest' from '/home/tkloczko/rpmbuild/BUILD/numpy-1.22.0/build/testenv/lib64/python3.8/site-packages/numpy/conftest.py'>
        plugin_name = '/home/tkloczko/rpmbuild/BUILD/numpy-1.22.0/build/testenv/lib64/python3.8/site-packages/numpy/conftest.py'
        self       = <_pytest.config.PytestPluginManager object at 0x7fb9039e50d0>
/usr/lib/python3.8/site-packages/pluggy/_hooks.py:300: in _maybe_apply_history
    res = self._hookexec(self.name, [method], kwargs, False)
        kwargs     = {'parser': <_pytest.config.argparsing.Parser object at 0x7fb902e87460>, 'pluginmanager': <_pytest.config.PytestPluginManager object at 0x7fb9039e50d0>}
        method     = <HookImpl plugin_name='/home/tkloczko/rpmbuild/BUILD/numpy-1.22.0/build/testenv/lib64/python3.8/site-packages/numpy/co...test' from '/home/tkloczko/rpmbuild/BUILD/numpy-1.22.0/build/testenv/lib64/python3.8/site-packages/numpy/conftest.py'>>
        result_callback = None
        self       = <_HookCaller 'pytest_addoption'>
/usr/lib/python3.8/site-packages/pluggy/_manager.py:80: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
        firstresult = False
        hook_name  = 'pytest_addoption'
        kwargs     = {'parser': <_pytest.config.argparsing.Parser object at 0x7fb902e87460>, 'pluginmanager': <_pytest.config.PytestPluginManager object at 0x7fb9039e50d0>}
        methods    = [<HookImpl plugin_name='/home/tkloczko/rpmbuild/BUILD/numpy-1.22.0/build/testenv/lib64/python3.8/site-packages/numpy/c...est' from '/home/tkloczko/rpmbuild/BUILD/numpy-1.22.0/build/testenv/lib64/python3.8/site-packages/numpy/conftest.py'>>]
        self       = <_pytest.config.PytestPluginManager object at 0x7fb9039e50d0>
build/testenv/lib64/python3.8/site-packages/numpy/conftest.py:56: in pytest_addoption
    parser.addoption("--available-memory", action="store", default=None,
        parser     = <_pytest.config.argparsing.Parser object at 0x7fb902e87460>
/usr/lib/python3.8/site-packages/_pytest/config/argparsing.py:96: in addoption
    self._anonymous.addoption(*opts, **attrs)
        attrs      = {'action': 'store', 'default': None, 'help': 'Set amount of memory available for running the test suite. This can resu...memory to be skipped. Equivalent to setting environment variable NPY_AVAILABLE_MEM. Default: determinedautomatically.'}
        opts       = ('--available-memory',)
        self       = <_pytest.config.argparsing.Parser object at 0x7fb902e87460>
/usr/lib/python3.8/site-packages/_pytest/config/argparsing.py:355: in addoption
    raise ValueError("option names %s already added" % conflict)
E   ValueError: option names {'--available-memory'} already added
        attrs      = {'action': 'store', 'default': None, 'help': 'Set amount of memory available for running the test suite. This can resu...memory to be skipped. Equivalent to setting environment variable NPY_AVAILABLE_MEM. Default: determinedautomatically.'}
        conflict   = {'--available-memory'}
        optnames   = ('--available-memory',)
        self       = <_pytest.config.argparsing.OptionGroup object at 0x7fb902e87490>
========================================================================= short test summary info ==========================================================================
ERROR  - ValueError: option names {'--available-memory'} already added
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================================= 1 error in 1.32s =============================================================================

Metadata

Metadata

Assignees

No one assigned

    Labels

    32 - InstallationProblems installing or compiling NumPy

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions