opencv crashes in Linux when used with webbrowser lib
Chưa có ai nhận issue này.
Đá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
- 38/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- opencv, python
- Lĩnh vực
- build-system, desktop
Hướng nghiên cứu
Bắt đầu với bản tái hiện tối thiểu trong test.py và chạy nó trong môi trường ảo Python 3.13 sau khi cài đặt opencv-python. So sánh hành vi với opencv-python-headless và các cách khắc phục QT_QPA_PLATFORM được liệt kê; được xem là hoàn tất khi hành vi được ghi nhận của gói đã được giải quyết hoặc crash và cấu hình được hỗ trợ đã được xử lý rõ ràng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
minmal example
tested on ubuntu 2024.04lts with python3.13
save this file as test.py
import cv2
# other code where i need cv2 ommited
server_name="https://localhost:8080"
if __name__ == "__main__":
import webbrowser
if server_name.startswith("http"):
url = server_name
else:
url = "http://" + server_name
webbrowser.open(url , new = 0, autoraise = True)
now run it in a venv with only opencv installed
$python3.13 -m venv .envlin
$ . .envlin/bin/activate
(.envlin)$ pip install opencv_python
Collecting opencv_python
Downloading opencv_python-4.13.0.92-cp37-abi3-manylinux_2_28_x86_64.whl.metadata (19 kB)
Collecting numpy>=2 (from opencv_python)
Downloading numpy-2.4.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.metadata (6.6 kB)
Downloading opencv_python-4.13.0.92-cp37-abi3-manylinux_2_28_x86_64.whl (72.9 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 72.9/72.9 MB 7.3 MB/s 0:00:10
Downloading numpy-2.4.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (16.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 16.6/16.6 MB 7.0 MB/s 0:00:02
Installing collected packages: numpy, opencv_python
Successfully installed numpy-2.4.4 opencv_python-4.13.0.92
$ python test.py
QObject::moveToThread: Current thread (0x57e4655873d0) is not the object's thread (0x57e4655abf40).
Cannot move to target thread (0x57e4655873d0)
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/cv2test/.envlin/lib/python3.13/site-packages/cv2/qt/plugins" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: xcb, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx.
Aborted (core dumped)
workarounds
some workarounds i have found:
- people worked around by setting the variable
export QT_QPA_PLATFORM=offscreen( https://github.com/Evezerest/PPOCRLabel/issues/61 ) to one of he values in the error message. some work and "fix" it some dont.. but it should not be a guessing game.. should also not be the standard behavior to crash. I had hoped a virtual environment gives one the possibility to isolate the env. - deinstalling opencv-python and installing
opencv-python-headlessif you only need calculations also work. but the issue is that any library listing opencv-python as dependency will install it (this is specially true in "living" projects like comfyui). maybe one could install a place holser "none" lib
similar issues
this problem seems to exist since at least 2017: https://github.com/opencv/opencv-python/issues/46
@skvark any chance of a fix in the meanwhile?
- 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
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của opencv/opencv-python
-
[DOC] README fileCó thể làm lại được @jadhavroshani713-sys đã nhận 75 ngày trước và không có pull request nào đang mở. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
opencv/opencv-python#1217 · 3 bình luận ·
-
Dependency specification missing for python3.14Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
opencv/opencv-python#1165 · 2 bình luận · 1 reaction ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
opencv/opencv-python#1276 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
opencv/opencv-python#1273 · 1 bình luận ·
-
FFMPEG v8.1.1 vulnerabilitiesĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
opencv/opencv-python#1272 · 2 bình luận ·
Tất cả issue của opencv/opencv-python
Issue tương tự
-
area:space-accuracy good first issue track:data
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Sara-Managed-Projects/space-radar#904 ·
Maintainer thường phản hồi trong vòng 1 ngày