Why SIP and PyQt4 don't get along

I do most of my work on Windows and have good python27 as I like. I recently installed virtualBox and got Ubuntu Machine on it, and I'm trying to install PyQt4 on it. I installed from apt-get and updated everything, however, when I try to import from PyQt4

from PyQt4 import QtCore 

I get runtimeError:

 RuntimeError: the sip module implements API v9.0 to v9.1 but the PyQt4.QtCore module requires API v8.1 

I am sure that this is a problem that I would encounter with the knowledge base on Windows, but my Linux inexperience is getting better than me here, and I installed something incorrectly. The error leads me to think that I have a SIP version that is too fancy for my version of PyQt ... does anyone have experience with this?

Change If I try import again after receiving the error, this will work. Having done this, I got version information.

 cfg.pyqt_version_str Out[9]: '4.9.3' cfg.sip_version_str Out[10]: '4.14.3-snapshot-55188026fe6d' 

Not sure what a business snapshot is.

+4
source share
2 answers

I just tested the sip / pyqt installation via apt-get and installed:

  • sip 4.12.4
  • PyQt4 4.8.5

The version of sip you presented is a snapshot of the development. I recommend uninstalling all this by doing sudo apt-get update again and then sudo apt-get install python-sip python-qt4 .

Otherwise, you can make the latest stable version from the source:

If you have mixed installations, try removing all of this. With pip, you can do pip remove sip . Or you can enter the python shell and find out where it is, and then manually remove it:

 $ python >>> import sip >>> print sip # path to sip 
+4
source

If you need to use Qt 4.7, this version works together (build worked on x86_64 Centos6)

  PyQt 4.10.4 SIP 4.15.5 QT 4.7.4 

If you need Qt 4.8, these versions worked together to build PyQt4:

  PyQt 4.11 SIP 4.16 QT 4.8.x 

Using these steps to create PyQt4:

  python configure-ng.py -g make make install 
0
source

All Articles