Skip to content

Conversation

@lazka
Copy link
Member

@lazka lazka commented Dec 21, 2025

No description provided.

@ognevny
Copy link
Collaborator

ognevny commented Dec 21, 2025

I've pushed numba update so the check should pass soon

@striezel
Copy link
Collaborator

The check fails even with numba 0.63.1:

  Pip Check Failed for mingw-w64-ucrt-x86_64-python-numpy
  Running `pip check` didn't suceed. Maybe missing dependencies?
  Here is what it failed.
  numba 0.63.1 has requirement numpy<2.4,>=1.22, but you have numpy 2.4.0.

@ognevny
Copy link
Collaborator

ognevny commented Dec 22, 2025

the best way to ensure is trying script with numba. if there is such requirement, ImportError will be raised

update: there is no maximum required version https://github.com/numba/numba/blob/main/numba%2F__init__.py#L34-L40

@striezel
Copy link
Collaborator

update: there is no maximum required version https://github.com/numba/numba/blob/main/numba%2F__init__.py#L34-L40

That's only on the main branch. However, if you take a look at the tagged version, then things look different: https://github.com/numba/numba/blob/7484a86bd9ce4d7dbc386da887f62a7bd54be597/numba/__init__.py#L42-L45 There's a hard-coded requirement for NumPy 2.3 or less. This requirement was added in commit numba/numba@be9b583. Looks like the numba folks pin their dependencies before a release is made / tagged to certain upper versions, but they don't seem to do that on the main branch.

We could revert that (it will probably work with NumPy 2.4, too), or we wait for the next numba release which will hopefully support NumPy 2.4.x, or we convince the numba developers to not pin their dependencies in that way anymore.

@lazka lazka marked this pull request as draft December 23, 2025 17:46
@lazka
Copy link
Member Author

lazka commented Dec 23, 2025

I tried some small examples and they failed, so looks like it is incompatible. Let's wait a bit then.

@ognevny
Copy link
Collaborator

ognevny commented Dec 23, 2025

even with patched numpy requirements?

@lazka
Copy link
Member Author

lazka commented Dec 23, 2025

yes

import numpy as np
from numba import jit

# Numba-accelerated function
@jit(nopython=True)
def matrix_multiply_numba(A, B):
    """Matrix multiplication with Numba JIT compilation"""
    m, n = A.shape
    n, p = B.shape
    C = np.zeros((m, p))
    
    for i in range(m):
        for j in range(p):
            for k in range(n):
                C[i, j] += A[i, k] * B[k, j]
    
    return C

A = np.random.rand(500, 500)
B = np.random.rand(500, 500)
matrix_multiply_numba(A[:10, :10], B[:10, :10])
  File "C:/msys64/clang64/lib/python3.12/site-packages/numba/np/arraymath.py", line 2225, in <module>
    @overload(np.trapz)
              ^^^^^^^^
  File "C:/msys64/clang64/lib/python3.12/site-packages/numpy/__init__.py", line 792, in __getattr__
    raise AttributeError(f"module {__name__!r} has no attribute {attr!r}")
AttributeError: module 'numpy' has no attribute 'trapz'. Did you mean: 'trace'?

@lazka
Copy link
Member Author

lazka commented Dec 23, 2025

maybe backport this numba/numba#10329 ?

that just leads to:

  File "C:/msys64/clang64/lib/python3.12/site-packages/numba/np/arraymath.py", line 4957, in <module>
    @overload(np.in1d)
              ^^^^^^^
  File "C:/msys64/clang64/lib/python3.12/site-packages/numpy/__init__.py", line 792, in __getattr__
    raise AttributeError(f"module {__name__!r} has no attribute {attr!r}")
AttributeError: module 'numpy' has no attribute 'in1d'. Did you mean: 'int16'?

edit: upstream issue for 2.4: numba/numba#10263

@lazka lazka force-pushed the python-numpy-2.4.0 branch from 10ecd0e to 2e26dd3 Compare December 23, 2025 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants