pyQt4 import error after updating it to 18.04 LTS

I am not able to import pyqt4 after upgrading my Ubuntu from 16.04 to 18.04.

I tried re-installing pyqt4 and python. I also updated source.list but nothing worked for me. It was working all good before this update. This is the error:

Traceback (most recent call last): File "main.py", line 1, in <module> from PyQt4 import QtGui # Import the PyQt4 module we'll need
ImportError: /usr/lib/python2.7/dist-packages/PyQt4/QtGui.x86_64-linux-gnu.so: undefined symbol: _ZN15QSessionManager16staticMetaObjectE

What can I do about this?

1

1 Answer

It seems that you should install one package python-qt4:

sudo apt-get install python-qt4

After installation you will be able to import PyQt4:

$ python
Python 2.7.15rc1 (default, Apr 15 2018, 21:51:34)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt4 import QtGui
>>> 
1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like