Question

I do most of my work in Windows and have a good python27 set up like I like it. I recently installed virtualBox and got a Ubuntu Machine running on it and am trying to get PyQt4 installed on it. I installed from apt-get and updated everything, however, when I try to import from PyQt4

from PyQt4 import QtCore

I get a runtimeError:

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

I am sure this is a problem that I would have the knowledge base to solve in Windows, but my Linux inexperience is getting the better of me here and I have installed something incorrectly. The error leads me to believe I have a SIP version that is too fancy for my PyQt version...anybody have any experience with this?

Edit: If I try the import again after receiving the error it seems to work. Doing this I obtained the version info.

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

Not sure what all that snapshot business is about.

Was it helpful?

Solution

I just tested an install of sip/pyqt via apt-get and it installed:

  • sip 4.12.4
  • PyQt4 4.8.5

The sip version you are reporting is a development snapshot. I recommend removing all of it, doing a sudo apt-get update and then sudo apt-get install python-sip python-qt4 again.

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

If you have mixed installations, try and remove all of that. With pip you can do pip remove sip. Or you can go into a python shell and find out where it is, then manually remove it:

$ python
>>> import sip
>>> print sip 
# path to sip

OTHER TIPS

If you need to use Qt 4.7, these version work 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 for a build of PyQt4:

    PyQt 4.11
    SIP 4.16
    QT 4.8.x

Using these steps to build PyQt4:

    python configure-ng.py -g
    make
    make install
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top