Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Getting error "A module that was compiled using NumPy 1.x cannot be run in NumPy 2.0.1 as it may crash" in 4.12.0.88

Đang mở
#1,149 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

@Mohith679 đang làm issue này rồi.

Từ ngày 5/1/2026.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
numpy, python

Hướng nghiên cứu

Bắt đầu với reproduction opencv-install-failure-repro được liên kết và chạy uv run main.py bằng NumPy 2.x cùng phiên bản package 4.12.0.88. Truy vết lỗi import cv2 và cấu hình wheel hoặc build được tạo ra. Được xem là hoàn thành khi reproduction đã báo cáo import cv2 thành công với NumPy 2.x mà không cần downgrade xuống NumPy 1.x.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

I am trying to install the latest version (4.12.0.88) with numpy 2.x but I get the following error saying the module is not compiled with 1.x.
If I understand correctly, 4.12.0.88 supports numpy 2.x. Can someone give my advice on how I can fix this issue without downgrading numpy to 1.x?

Reproduction code

$ uv run main.py

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.1 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 "/home/pi/developer/opencv-install-failure-repro/main.py", line 1, in <module>
    import cv2
  File "/home/pi/developer/opencv-install-failure-repro/.venv/lib/python3.11/site-packages/cv2/__init__.py", line 181, in <module>
    bootstrap()
  File "/home/pi/developer/opencv-install-failure-repro/.venv/lib/python3.11/site-packages/cv2/__init__.py", line 153, in bootstrap
    native_module = importlib.import_module("cv2")
  File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
AttributeError: _ARRAY_API not found
Traceback (most recent call last):
  File "/home/pi/developer/opencv-install-failure-repro/main.py", line 1, in <module>
    import cv2
  File "/home/pi/developer/opencv-install-failure-repro/.venv/lib/python3.11/site-packages/cv2/__init__.py", line 181, in <module>
    bootstrap()
  File "/home/pi/developer/opencv-install-failure-repro/.venv/lib/python3.11/site-packages/cv2/__init__.py", line 153, in bootstrap
    native_module = importlib.import_module("cv2")
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ImportError: numpy.core.multiarray failed to import
Ngôn ngữ chính
Python
Star
5.4k
Fork
1k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của opencv/opencv-python

Tất cả issue của opencv/opencv-python

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.