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

ImportError: numpy.core.multiarray --- Numpy 2.0.0 #995

Closed
4 tasks done
JuliusBairaktaris opened this issue Jun 4, 2024 · 1 comment
Closed
4 tasks done

ImportError: numpy.core.multiarray --- Numpy 2.0.0 #995

JuliusBairaktaris opened this issue Jun 4, 2024 · 1 comment

Comments

@JuliusBairaktaris
Copy link

Expected behaviour

I am currently using NumPy 2.0.0rc2 in conjunction with the recently released OpenCV 4.10.0.82 and have encountered the following error:

Actual behaviour

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.0rc2 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

Traceback (most recent call last):  File "heuristic.py", line 4, in <module>
    import cv2
  File "AppData\Local\Programs\Python\Python312\Lib\site-packages\cv2\__init__.py", line 181, in <module>
    bootstrap()
  File "AppData\Local\Programs\Python\Python312\Lib\site-packages\cv2\__init__.py", line 153, in bootstrap
    native_module = importlib.import_module("cv2")
  File "AppData\Local\Programs\Python\Python312\Lib\importlib\__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
AttributeError: _ARRAY_API not found
Traceback (most recent call last):
  File "heuristic.py", line 4, in <module>
    import cv2
  File "AppData\Local\Programs\Python\Python312\Lib\site-packages\cv2\__init__.py", line 181, in <module>
    bootstrap()
  File "AppData\Local\Programs\Python\Python312\Lib\site-packages\cv2\__init__.py", line 153, in bootstrap
    native_module = importlib.import_module("cv2")
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "AppData\Local\Programs\Python\Python312\Lib\importlib\__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ImportError: numpy.core.multiarray failed to import

Steps to reproduce

  • Windows 11
  • Python 3.12.3
  • opencv-python==4.10.0.82
  • numpy==2.0.0rc2
Issue submission checklist
  • This is not a generic OpenCV usage question (looking for help for coding, other usage questions, homework etc.)
  • I have read the README of this repository and understand that this repository provides only an automated build toolchain for OpenCV Python packages (there is no actual OpenCV code here)
  • The issue is related to the build scripts in this repository, to the pre-built binaries or is a feature request (such as "please enable this additional dependency")
  • I'm using the latest version of opencv-python

Kind regards,

Julius Bairaktaris

@opencv-alalek
Copy link

There is already issue about numpy2 support: #943

@opencv-alalek opencv-alalek closed this as not planned Won't fix, can't repro, duplicate, stale Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants