Closed
Description
Expected behaviour
Shows an image, like the version 4.5.3.56
Actual behaviour
Crashed with segfault
Steps to reproduce
- Create
testimshow.py
import cv2
img = cv2.imread('myimage.png')
cv2.imshow('title', img)
cv2.waitKey(0)
- Create an image
myimage.png
in the same folder pip install opencv-python
python testimshow.py
Segmentation fault (core dumped)
System info (Ubuntu 21.04) uname -a
Linux os-ThinkPad-T14s 5.11.0-38-generic #42-Ubuntu SMP Fri Sep 24 14:03:54 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Full log
(venv) os@17:39:55> pip install --force-reinstall opencv-python
Collecting opencv-python
Using cached opencv_python-4.5.4.58-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (60.3 MB)
Collecting numpy>=1.19.3
Using cached numpy-1.21.3-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (15.7 MB)
Installing collected packages: numpy, opencv-python
Attempting uninstall: numpy
Found existing installation: numpy 1.21.3
Uninstalling numpy-1.21.3:
Successfully uninstalled numpy-1.21.3
Attempting uninstall: opencv-python
Found existing installation: opencv-python 4.5.3.56
Uninstalling opencv-python-4.5.3.56:
Successfully uninstalled opencv-python-4.5.3.56
Successfully installed numpy-1.21.3 opencv-python-4.5.4.58
(venv) os@17:40:03> python testimshow.py
Segmentation fault (core dumped)
Some extra info from gdb
(venv) os@17:40:05> gdb --args python testimshow.py
GNU gdb (Ubuntu 10.1-2ubuntu2) 10.1.90.20210411-git
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from python...
(No debugging symbols found in python)
(gdb) r
Starting program: /home/os/Downloads/foo/venv/bin/python testimshow.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff3c96640 (LWP 15359)]
[New Thread 0x7ffff1495640 (LWP 15360)]
[New Thread 0x7fffeec94640 (LWP 15361)]
[New Thread 0x7fffec493640 (LWP 15362)]
[New Thread 0x7fffe9c92640 (LWP 15363)]
[New Thread 0x7fffe9491640 (LWP 15364)]
[New Thread 0x7fffe4c90640 (LWP 15365)]
[New Thread 0x7fffe248f640 (LWP 15366)]
[New Thread 0x7fffdfc8e640 (LWP 15367)]
[New Thread 0x7fffdd48d640 (LWP 15368)]
[New Thread 0x7fffdac8c640 (LWP 15369)]
[New Thread 0x7fffd848b640 (LWP 15370)]
[New Thread 0x7fffd5c8a640 (LWP 15371)]
[New Thread 0x7fffd3489640 (LWP 15372)]
[New Thread 0x7fffd0c88640 (LWP 15373)]
Thread 1 "python" received signal SIGSEGV, Segmentation fault.
0x00007fffbed45e05 in _xcb_in_expect_reply ()
from /home/os/Downloads/foo/venv/lib/python3.9/site-packages/cv2/qt/plugins/platforms/../../../../opencv_python.libs/libxcb-65da195c.so.1.1.0
(gdb) bt
#0 0x00007fffbed45e05 in _xcb_in_expect_reply ()
from /home/os/Downloads/foo/venv/lib/python3.9/site-packages/cv2/qt/plugins/platforms/../../../../opencv_python.libs/libxcb-65da195c.so.1.1.0
#1 0x00007fffbed44e94 in xcb_send_request_with_fds64 ()
from /home/os/Downloads/foo/venv/lib/python3.9/site-packages/cv2/qt/plugins/platforms/../../../../opencv_python.libs/libxcb-65da195c.so.1.1.0
#2 0x00007fffbed44f69 in xcb_send_request ()
from /home/os/Downloads/foo/venv/lib/python3.9/site-packages/cv2/qt/plugins/platforms/../../../../opencv_python.libs/libxcb-65da195c.so.1.1.0
#3 0x00007fffbed4af3f in xcb_intern_atom ()
from /home/os/Downloads/foo/venv/lib/python3.9/site-packages/cv2/qt/plugins/platforms/../../../../opencv_python.libs/libxcb-65da195c.so.1.1.0
#4 0x00007fffc0b42ce4 in ?? ()
from /home/os/Downloads/foo/venv/lib/python3.9/site-packages/cv2/qt/plugins/platforms/../../../../opencv_python.libs/libQt5XcbQpa-ca221f44.so.5.15.0
#5 0x00007fffc0b36ad3 in QtOpenCVPython::QXcbBasicConnection::QXcbBasicConnection(char const*) ()
from /home/os/Downloads/foo/venv/lib/python3.9/site-packages/cv2/qt/plugins/platforms/../../../../opencv_python.libs/libQt5XcbQpa-ca221f44.so.5.15.0
#6 0x00007fffc0b14f22 in QtOpenCVPython::QXcbConnection::QXcbConnection(QtOpenCVPython::QXcbNativeInterface*, bool, unsigned int, char const*) ()
from /home/os/Downloads/foo/venv/lib/python3.9/site-packages/cv2/qt/plugins/platforms/../../../../opencv_python.libs/libQt5XcbQpa-ca221f44.so.5.15.0
--Type <RET> for more, q to quit, c to continue without paging--c
#7 0x00007fffc0b17b47 in QtOpenCVPython::QXcbIntegration::QXcbIntegration(QtOpenCVPython::QStringList const&, int&, char**) () from /home/os/Downloads/foo/venv/lib/python3.9/site-packages/cv2/qt/plugins/platforms/../../../../opencv_python.libs/libQt5XcbQpa-ca221f44.so.5.15.0
#8 0x00007fffcd09543f in ?? () from /home/os/Downloads/foo/venv/lib/python3.9/site-packages/cv2/qt/plugins/platforms/libqxcb.so
#9 0x00007fffc55c0a6c in QtOpenCVPython::QGuiApplicationPrivate::createPlatformIntegration() () from /home/os/Downloads/foo/venv/lib/python3.9/site-packages/cv2/../opencv_python.libs/libQt5Gui-ba0a2070.so.5.15.0
#10 0x00007fffc55c2010 in QtOpenCVPython::QGuiApplicationPrivate::createEventDispatcher() () from /home/os/Downloads/foo/venv/lib/python3.9/site-packages/cv2/../opencv_python.libs/libQt5Gui-ba0a2070.so.5.15.0
#11 0x00007fffc4fcd2f6 in QtOpenCVPython::QCoreApplicationPrivate::init() () from /home/os/Downloads/foo/venv/lib/python3.9/site-packages/cv2/../opencv_python.libs/libQt5Core-39545cc7.so.5.15.0
#12 0x00007fffc55c4a3b in QtOpenCVPython::QGuiApplicationPrivate::init() () from /home/os/Downloads/foo/venv/lib/python3.9/site-packages/cv2/../opencv_python.libs/libQt5Gui-ba0a2070.so.5.15.0
#13 0x00007fffc5f13979 in QtOpenCVPython::QApplicationPrivate::init() () from /home/os/Downloads/foo/venv/lib/python3.9/site-packages/cv2/../opencv_python.libs/libQt5Widgets-e69d94fb.so.5.15.0
#14 0x00007fffc95e5f38 in ?? () from /home/os/Downloads/foo/venv/lib/python3.9/site-packages/cv2/cv2.cpython-39-x86_64-linux-gnu.so
#15 0x00007fffc95f1e3d in ?? () from /home/os/Downloads/foo/venv/lib/python3.9/site-packages/cv2/cv2.cpython-39-x86_64-linux-gnu.so
#16 0x00007fffc95e033c in ?? () from /home/os/Downloads/foo/venv/lib/python3.9/site-packages/cv2/cv2.cpython-39-x86_64-linux-gnu.so
#17 0x00007fffc88530a3 in ?? () from /home/os/Downloads/foo/venv/lib/python3.9/site-packages/cv2/cv2.cpython-39-x86_64-linux-gnu.so
#18 0x000000000054350c in ?? ()
#19 0x0000000000521d6b in _PyObject_MakeTpCall ()
#20 0x000000000051b9f8 in _PyEval_EvalFrameDefault ()
#21 0x0000000000514a75 in ?? ()
#22 0x000000000051480b in _PyEval_EvalCodeWithName ()
#23 0x00000000005fb257 in PyEval_EvalCode ()
#24 0x00000000006205fb in ?? ()
#25 0x000000000061b724 in ?? ()
#26 0x000000000061fb2d in ?? ()
#27 0x000000000061f63a in PyRun_SimpleFileExFlags ()
#28 0x0000000000613527 in Py_RunMain ()
#29 0x00000000005ef7fd in Py_BytesMain ()
#30 0x00007ffff7c19565 in __libc_start_main (main=0x5ef7c0, argc=2, argv=0x7fffffffdf18, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdf08) at ../csu/libc-start.c:332
#31 0x00000000005ef6fe in _start ()
Previous version, which worked fine
(venv) os@17:38:52> pip install --force-reinstall opencv-python==4.5.3.56
Collecting opencv-python==4.5.3.56
Using cached opencv_python-4.5.3.56-cp39-cp39-manylinux2014_x86_64.whl (49.9 MB)
Collecting numpy>=1.19.3
Using cached numpy-1.21.3-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (15.7 MB)
Installing collected packages: numpy, opencv-python
Attempting uninstall: numpy
Found existing installation: numpy 1.21.3
Uninstalling numpy-1.21.3:
Successfully uninstalled numpy-1.21.3
Attempting uninstall: opencv-python
Found existing installation: opencv-python 4.5.3.56
Uninstalling opencv-python-4.5.3.56:
Successfully uninstalled opencv-python-4.5.3.56
Successfully installed numpy-1.21.3 opencv-python-4.5.3.56
(venv) os@17:39:31> pip install --force-reinstall opencv-python==4.5.3.56
Collecting opencv-python==4.5.3.56
Using cached opencv_python-4.5.3.56-cp39-cp39-manylinux2014_x86_64.whl (49.9 MB)
Collecting numpy>=1.19.3
Using cached numpy-1.21.3-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (15.7 MB)
Installing collected packages: numpy, opencv-python
Attempting uninstall: numpy
Found existing installation: numpy 1.21.3
Uninstalling numpy-1.21.3:
Successfully uninstalled numpy-1.21.3
Attempting uninstall: opencv-python
Found existing installation: opencv-python 4.5.3.56
Uninstalling opencv-python-4.5.3.56:
Successfully uninstalled opencv-python-4.5.3.56
Successfully installed numpy-1.21.3 opencv-python-4.5.3.56
(venv) os@17:39:47> python testimshow.py
(displayed the image)
EDIT: I also tried installing in a clean virtualenv, as well as turning my computer off and then on again