1

Some time ago (months?) the program rqt_plot started crashing on startup (SIGSEGV) on my machine. I finally tracked it down a little deeper and found that the problem occurs while python is trying to import PyQt4.QtDeclarative. Unfortunately I don't remember when this started happening, and my Internet searches have turned up nothing. Any ideas what's going wrong? I suspect an incompatible package update somewhere along the way, but have no idea how to find the root cause.

Here's a simple session transcript:

$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt4 import QtDeclarative
Segmentation fault (core dumped)
$

Here's some system information:

$ uname -a
Linux [HOSTNAME] 3.13.0-63-generic #103-Ubuntu SMP Fri Aug 14 21:42:59 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
$ echo $PYTHONPATH

$ which python
/usr/bin/python
$ ls -l /usr/bin/python
lrwxrwxrwx 1 root root 9 Jan  8  2015 /usr/bin/python -> python2.7

Follow-up:

I found later that I had the same problem (Segmentation fault) when doing import PyQt4.Qt as well.

aldo
  • 2,927
  • 21
  • 36
  • Have you tried reinstalling `python-qt4` using `sudo apt-get install --reinstall python-qt4`? Just curious to see if that makes a difference. – edwinksl Aug 22 '16 at 23:51
  • Yes, try the above `apt-get install python-qt4`, might make a difference – Muntasir Alam Aug 22 '16 at 23:59
  • 1
    @edwinksl My linux-fu is weak; Yours is strong! A simple reinstall was all that was required. If you post an "Answer" in addition to your comment, I'll award you the bounty. It was well worth it! =:-D – aldo Aug 23 '16 at 21:41
  • @aldo Ah, glad to see that a simple solution works. :D – edwinksl Aug 23 '16 at 21:50

1 Answers1

1

It can be difficult to diagnose a segfault when the only error message is

Segmentation fault (core dumped)

In this case, because reinstallation of python-qt4 does not take much time at all, I would recommend you do it by running:

sudo apt-get install --reinstall python-qt4

Edit: It looks like OP encountered another segfault when doing import PyQt4.Qt. This is probably related to python-sip, which is a dependency of python-pyqt4. To get rid of the segfault, reinstall python-sip by running:

sudo apt-get install --reinstall python-sip
edwinksl
  • 7,005
  • 4
  • 30
  • 36
  • I don't know why I didn't think of this first. I tried removing extra, "unused" packages, upgrading the kernel, pulling my hair out... skipped the obvious solution. Anyway, thanks! – aldo Aug 23 '16 at 22:04
  • @aldo That happens to all of us. :) – edwinksl Aug 23 '16 at 22:05
  • Ok, that solved most of my problem, but now `import PyQt4.Qt` gives me the same segfault. Gah! – aldo Aug 23 '16 at 22:26
  • @aldo That is bewildering. The reinstallation would have reinstalled `Qt.so` (along with `QtDeclarative.so`), so I am not sure what is going on at this point. – edwinksl Aug 23 '16 at 22:42
  • @aldo It might be worthwhile reinstalling `python-sip`: `sudo apt-get install --reinstall python-sip`. – edwinksl Aug 23 '16 at 23:33
  • @aldo Ah nice, let me update my answer to reflect that. :D – edwinksl Aug 24 '16 at 00:06