-
-
Notifications
You must be signed in to change notification settings - Fork 11.2k
Description
Describe the issue:
I'm seeing this on multiple architectures (amd64 and riscv64) and it's easy to reproduce.
On Ubuntu 24.04, in a new venv
apt-get install python3-venv python3-dev gcc
pip install -r https://raw.githubusercontent.com/numpy/numpy/refs/heads/main/requirements/test_requirements.txt
pip install numpy==2.3.1
import numpy
>>> numpy.test(label='full', extra_argv=['-k','test_npy_uintp_type_enum'])
NumPy version 2.3.1
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? AVX512_SPR?
F [100%]
==================================================================================================== FAILURES ====================================================================================================
____________________________________________________________________________________________ test_npy_uintp_type_enum ____________________________________________________________________________________________
@pytest.mark.skipif(sysconfig.get_platform() == 'win-arm64', reason='no checks module on win-arm64')
def test_npy_uintp_type_enum():
> import checks
E ModuleNotFoundError: No module named 'checks'
root/venv/lib/python3.12/site-packages/numpy/_core/tests/test_cython.py:350: ModuleNotFoundError
============================================================================================ short test summary info =============================================================================================
FAILED root/venv/lib/python3.12/site-packages/numpy/_core/tests/test_cython.py::test_npy_uintp_type_enum - ModuleNotFoundError: No module named 'checks'
1 failed, 51734 deselected in 5.29s
False
Now look what happens if I run another test in the same file and then re-run test_npy_uintp_type_enum
>>> numpy.test(label='full', extra_argv=['-k','test_npystring_allocators_other_dtype'])
NumPy version 2.3.1
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? AVX512_SPR?
. [100%]
1 passed, 48585 deselected in 6.77s
True
>>> numpy.test(label='full', extra_argv=['-k','test_npy_uintp_type_enum'])
NumPy version 2.3.1
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? AVX512_SPR?
. [100%]
1 passed, 48585 deselected in 4.32s
True
The second time it passes, presumably because the checks module got built by the other test. Looking at the code, without actually understanding any of it, it would seem that the test_npy_uintp_type_enum function is missing the install_temp argument. Adding it certainly seems to fix the issue locally for me. Happy to submit a patch if it's agreed that this is the correct fix.
Reproduce the code example:
import numpy
numpy.test(label='full', extra_argv=['-k','test_npy_uintp_type_enum'])
Error message:
F [100%]
==================================================================================================== FAILURES ====================================================================================================
____________________________________________________________________________________________ test_npy_uintp_type_enum ____________________________________________________________________________________________
@pytest.mark.skipif(sysconfig.get_platform() == 'win-arm64', reason='no checks module on win-arm64')
def test_npy_uintp_type_enum():
> import checks
E ModuleNotFoundError: No module named 'checks'
root/venv/lib/python3.12/site-packages/numpy/_core/tests/test_cython.py:350: ModuleNotFoundError
============================================================================================ short test summary info =============================================================================================
FAILED root/venv/lib/python3.12/site-packages/numpy/_core/tests/test_cython.py::test_npy_uintp_type_enum - ModuleNotFoundError: No module named 'checks'
1 failed, 51734 deselected in 5.29s
False
Python and NumPy Versions:
2.3.1
3.12.3 (main, Jun 18 2025, 17:59:45) [GCC 13.3.0]
Runtime Environment:
[{'numpy_version': '2.3.1',
'python': '3.12.3 (main, Jun 18 2025, 17:59:45) [GCC 13.3.0]',
'uname': uname_result(system='Linux', node='c46f9de936db', release='5.15.0-94-generic', version='#104-Ubuntu SMP Tue Jan 9 15:25:40 UTC 2024', machine='x86_64')},
{'simd_extensions': {'baseline': ['SSE', 'SSE2', 'SSE3'],
'found': ['SSSE3',
'SSE41',
'POPCNT',
'SSE42',
'AVX',
'F16C',
'FMA3',
'AVX2'],
'not_found': ['AVX512F',
'AVX512CD',
'AVX512_KNL',
'AVX512_KNM',
'AVX512_SKX',
'AVX512_CLX',
'AVX512_CNL',
'AVX512_ICL',
'AVX512_SPR']}},
{'architecture': 'Haswell',
'filepath': '/root/venv/lib/python3.12/site-packages/numpy.libs/libscipy_openblas64_-56d6093b.so',
'internal_api': 'openblas',
'num_threads': 32,
'prefix': 'libscipy_openblas',
'threading_layer': 'pthreads',
'user_api': 'blas',
'version': '0.3.29'}]
Context for the issue:
I'm getting intermittent build failures when building numpy==2.3.1 for riscv64. My Python 3.11 build worked fine but my 3.12 build failed. Perhaps the tests are not run in a predefined order. If this is the case, the issue could cause flakiness in all builds, not just the riscv64 ones.