1

I receive a segmentation fault when importing PYQt4 with python (3.5.2) using ubuntu 16.04. For instance, the following code produce a segmentation fault:

import PyQt4.QtCore

I imagine that there are mismatches whith some modules installations... Here is the backtrace:

Program received signal SIGSEGV, Segmentation fault.
0x000000000055c220 in PyType_IsSubtype ()
(gdb) backtrace
#0  0x000000000055c220 in PyType_IsSubtype ()
#1  0x00007ffff4969221 in vp_convertor () from /usr/local/lib/python3.5/dist-packages/sip.so
#2  0x00007ffff4969ab5 in sip_api_convert_to_void_ptr () from /usr/local/lib/python3.5/dist-packages/sip.so
#3  0x00007ffff5f41b7d in ?? () from /usr/lib/python3/dist-packages/PyQt4/QtCore.cpython-35m-x86_64-linux-gnu.so
#4  0x00007ffff5e1eb54 in PyInit_QtCore () from /usr/lib/python3/dist-packages/PyQt4/QtCore.cpython-35m-x86_64-linux-gnu.so
#5  0x000000000060605e in _PyImport_LoadDynamicModuleWithSpec ()
#6  0x0000000000606618 in ?? ()
#7  0x00000000004e9c56 in PyCFunction_Call ()
#8  0x000000000052ad74 in PyEval_EvalFrameEx ()
#9  0x000000000052d2e3 in ?? ()
#10 0x0000000000529332 in PyEval_EvalFrameEx ()
#11 0x0000000000528814 in PyEval_EvalFrameEx ()
#12 0x0000000000528814 in PyEval_EvalFrameEx ()
#13 0x0000000000528814 in PyEval_EvalFrameEx ()
#14 0x0000000000528814 in PyEval_EvalFrameEx ()
#15 0x000000000052e12b in PyEval_EvalCodeEx ()
#16 0x00000000004ebcc3 in ?? ()
#17 0x00000000005b7167 in PyObject_Call ()
#18 0x00000000005b7f8a in _PyObject_CallMethodIdObjArgs ()
#19 0x000000000051ba98 in PyImport_ImportModuleLevelObject ()
#20 0x00000000005c7688 in ?? ()
#21 0x00000000004e9bc7 in PyCFunction_Call ()
#22 0x00000000005b7167 in PyObject_Call ()
#23 0x0000000000523800 in PyEval_CallObjectWithKeywords ()
#24 0x0000000000526fbc in PyEval_EvalFrameEx ()
#25 0x000000000052d2e3 in ?? ()
#26 0x000000000052dfdf in PyEval_EvalCode ()
#27 0x00000000005fd2c2 in ?? ()
#28 0x00000000005ff76a in PyRun_FileExFlags ()
#29 0x00000000005ff95c in PyRun_SimpleFileExFlags ()
#30 0x000000000063e7d6 in Py_Main ()
#31 0x00000000004cfe41 in main ()

Do you have any idea on how to solve the issue?

  • SIP version is 4.19.3
  • PyQt5 version is 5.9 might it be the problem?

thanks in advance!

  • A backtrace is completely useless unless you have debug builds of python, pyqt and qt (and even then, it probably wouldn't be relevant). You need to describe what platform you are on and exactly what you installed (i.e. the precise versions), as well as how and where you installed them. – ekhumoro Oct 05 '17 at 14:09
  • Thanks for the comment, I have updated few informations. In general I am using pip install or apt-get. – Alexandre Mertens Oct 05 '17 at 14:39
  • So you installed PyQt**5**, but you're trying to import PyQt**4**? Why? – ekhumoro Oct 05 '17 at 14:46
  • I also have python3-pyqt4: version (4.11.4+dfsg-1build4). The reason is that I am using a library that is using PyQt4. – Alexandre Mertens Oct 05 '17 at 15:03
  • If you're on ubuntu, only install the official packages. If you install from other sources, you'll probably break something. – ekhumoro Oct 05 '17 at 15:06

1 Answers1

0

I also ran into this issue today. My Python 3 and pip were from the package manager. But I then installed newer pip by get-pip.py.

From the stacktrace I got from gdb, it seems that maybe there is an alternative SIP library (I am using Python 3.6 though):

/usr/local/lib/python3.6/dist-packages/sip.so and
/usr/lib/python3/dist-packages/sip.cpython-36m-x86_64-linux-gnu.so.

I tested by the following code you had provided. If I deleted that .so in /usr/local/lib, it didn't complain. Instead, the segmentation fault was gone.

Andy Pan
  • 70
  • 2
  • 7