[PyQt] qmlscene plugin PyCapsule_Import sip error in virtualenv

Nenad Ognjanovic bgr.gyk at gmail.com
Tue Aug 12 16:02:51 BST 2014


Hello,
I'm getting an error when I attempt to run the Charts qmlscene plugin
example on the latest PyQt and sip snapshots installed inside a virtualenv
(Python 3.4).

Running:
    QML2_IMPORT_PATH="." qmlscene -I . app.qml
gives the following error:
    ImportError: PyCapsule_Import could not import module "sip"
    Traceback (most recent call last):
    File ".../Charts/chartsplugin.py", line 41, in <module>
        from PyQt5.QtQml import qmlRegisterType, QQmlExtensionPlugin
    ImportError: ...virtualenv/lib/python3.4/site-packages/PyQt5/QtQml.so:
    undefined symbol: PyBool_Type
    .../app.qml:42 module "Charts" is not installed

Just running:
    qmlscene -I . app.qml
gives the following:
    ImportError: PyCapsule_Import could not import module "sip"
    .../app.qml:42 module "Charts" is not installed

I suspect this PyCapsule_Import part tries to operate outside of virtualenv,
maybe using wrong interpreter or looking up something in wrong place.
Any ideas/hints?

P.S.: The qmlscene plugin was installed successfully, I've managed to get
the output of configure.py to say
    "Re-writing .../chapter6-plugins/Charts/qmldir/..."
by linking /usr/lib/x86_64-linux-gnu to virtualenv/lib/x86_64-linux-gnu
(initially I was getting "The qmlscene plugin was disabled because the Python
library couldn't be found.").
The sip and PyQt configure steps were done using the following arguments,
correspondingly:
    python configure.py --debug -e virtualenv/include
    python configure.py --debug --sip-incdir virtualenv/include


More information about the PyQt mailing list