opencv crashes in Linux when used with webbrowser lib
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 38/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- opencv, python
- Ambito
- build-system, desktop
Direzione di ricerca
Inizia con la riproduzione minima in test.py ed eseguila nell'ambiente virtuale Python 3.13 dopo aver installato opencv-python. Confronta il comportamento con opencv-python-headless e con le soluzioni alternative QT_QPA_PLATFORM elencate; il lavoro è terminato quando il comportamento documentato del pacchetto è stato risolto oppure quando il crash e la configurazione supportata sono stati affrontati chiaramente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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?
- Lingua principale
- Python
- Stelle
- 5.4k
- Fork
- 1k
- Merge medio
- 22h 17m
- PR unite (30g)
- 3
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di opencv/opencv-python
-
[DOC] README fileAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
opencv/opencv-python#1217 · 3 commenti ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
opencv/opencv-python#1165 · 2 commenti · 1 reazione ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
opencv/opencv-python#1273 · 1 commento ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
opencv/opencv-python#1272 · 1 commento ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 70/100
opencv/opencv-python#1268 · 1 commento ·
Tutte le issue di opencv/opencv-python
Issue simili
-
New InternshipApertanew_internship
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 70/100
-
[BUG] Reports tab: "Unban" button tooltip shows raw `{{ip}}` placeholder instead of the IP addressApertabug javascript ui
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
bunkerity/bunkerweb#4001 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
PedestrianDynamics/pyFDS-Evac#476 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
google/differential-privacy#516 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
adobe-fonts/source-serif#153 ·