Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Numpy 2 compatible build #943

Open
dkbarn opened this issue Jan 3, 2024 · 3 comments
Open

Numpy 2 compatible build #943

dkbarn opened this issue Jan 3, 2024 · 3 comments
Assignees
Milestone

Comments

@dkbarn
Copy link

dkbarn commented Jan 3, 2024

I haven't managed to find any previous discussion about this, although I'm surprised by that so I very well may have missed it.

Numpy 2 is coming: numpy/numpy#24300

Are there any plans to begin providing nightly builds of OpenCV Python bindings which are ABI compatible with Numpy 2? Instructions are provided here on how to do that: https://numpy.org/devdocs/dev/depending_on_numpy.html#numpy-2-0-specific-advice

Currently when I pip install opencv-python-rolling it is not ABI compatible:

# create a virtualenv
$ python -m venv testvenv

# install numpy 2.x
$ testvenv/bin/pip install --pre -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy

# install opencv-python-rolling
$ testvenv/bin/pip install opencv-python-rolling

$ testvenv/bin/python
>>> import cv2
RuntimeError: module compiled against ABI version 0x1000009 but this version of numpy is 0x2000000
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/share/dev/src/testvenv/lib/python3.10/site-packages/cv2/__init__.py", line 181, in <module>
    bootstrap()
  File "/share/dev/src/testvenv/lib/python3.10/site-packages/cv2/__init__.py", line 153, in bootstrap
    native_module = importlib.import_module("cv2")
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: numpy.core.multiarray failed to import
@asmorkalov asmorkalov self-assigned this Jan 6, 2024
@dkbarn
Copy link
Author

dkbarn commented Apr 3, 2024

Note that numpy 2.0.0rc1 is now publicly available: numpy/numpy#24300 (comment)

@nabobalis
Copy link

Is there anything we can do to help with checking support for numpy 2.0?

@asmorkalov
Copy link
Collaborator

2 items in scope:

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

No branches or pull requests

3 participants