8
votes

Feedback

I'm working on a PyQt5 installation (based on Qt5.2.1 / Sip 4.15.5 API 11 ???) with the standard Python3 (3.3.2+) interpreter that is PyQt5 compliant (>= 3.3.2) as It's not possible to compile Python3.3-5 on Ubuntu 12.04 and then impossible to install PyQt5 (python 3.3.2 or later).

Plateform:

jeby6372@mercure:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 13.10
Release:    13.10
Codename:   saucy
jeby6372@mercure:~$ uname -a
Linux mercure 3.11.0-13-generic #20-Ubuntu SMP Wed Oct 23 07:38:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

Everything seemed to work fine during the installation, the PyQt5 import works but when I try a module import thru the python3 interpreter, this error is raised:

>>> import PyQt5
>>> from PyQt5.QtCore import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: the sip module implements API v10.0 to v10.1 but the PyQt5.QtCore module requires API v11.0

Installation steps :

  • Qt5.2.1 installed with the standard X64 linux installer
  • SIP 4.15.5 installation from sources
  • PyQt5 from sources compiled as mentioned in the RiverBank procedure, targeting the qmake program in the compile.py options :

    python3 configure.py --qmake /opt/Qt/5.2.1/gcc_64/bin/qmake --sip /usr/bin/sip

Package Locations :

  • Qt-5.2.1 root directory : /opt/Qt/5.2.1/gcc_64
  • PyQt5 root directory : /usr/lib/python3.3/site-packages

Sip Version

jeby6372@mercure:~$ which sip
/usr/bin/sip
jeby6372@mercure:~$ sip -V
4.15.5
jeby6372@mercure:~$ 

My python environment variable is :

jeby6372@mercure:~$ echo $PYTHONPATH
/usr/lib/python3.3/site-packages

The $PATH varaible :

jeby6372@mercure:~$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/Qt/5.2.1/gcc_64/bin

$LD_LIBRARY_PATH is empty (don't think it's important but I prefer to mention it... )

The content of the site-pacakges dir is :

jeby6372@mercure:~$ ls /usr/lib/python3.3/site-packages
PyQt5

__init__.py  QtCore.so  QtDBus.so  QtNetwork.so  Qt.so  QtXmlPatterns.so  uic

but in a previous installation it was different. Don't know why ! :

jeby6372@mercure:~$ ls /usr/lib/python3.3/site-packages/PyQt5
__init__.py               QtDesigner.so           QtNetwork.so       QtQuick.so       QtSvg.so        QtXmlPatterns.so
_QOpenGLFunctions_2_0.so  QtGui.so                QtOpenGL.so        QtSensors.so     QtTest.so       uic
QtBluetooth.so            QtHelp.so               QtPositioning.so   QtSerialPort.so  QtWebKit.so
QtCore.so                 QtMultimedia.so         QtPrintSupport.so  Qt.so            QtWidgets.so
QtDBus.so                 QtMultimediaWidgets.so  QtQml.so           QtSql.so         QtX11Extras.so

I can't figure out where the problem is, The more I work on this product the less I understand. I'm doing this installation on Ubuntu 13.10 because PyQt5 doesn't work on Ubuntu 12.04 due to Python 3.3-5 compilation errors .. Still with no answer yet. ...

please help.

Thanks in advance.

2
This means the python sip module installed is too old, or maybe a previously installed module is found. What does import sip; print(sip, sip.SIP_VERSION_STR) say?mata
In fact yes. I did a lot of changes but after removing the python3-sip package, I can import QtCore, QtNetworkEmmanuel BRUNET
Thanks for your reply mata. My problem is the same as mentioned here : [riverbankcomputing.com/pipermail/pyqt/2013-July/033011.html] . But with no answerEmmanuel BRUNET
the output of your command is (now ?) <module 'sip' from '/usr/lib/python3/dist-packages/sip.so'> 4.15.5Emmanuel BRUNET
Are you sure all modules (QtGui, QtWidgets ...) were compiled and installed when you built Qt? pyqt can only be build the bindings against the libraries which are installed...mata

2 Answers

13
votes

Your problem comes from a clash of the distribution-supplied sip and the sip you probably compiled from sources.

As sugested by user mata, call import sip; print(sip, sip.SIP_VERSION_STR) from within a python3 interpreter console and compare the output to the one you get from calling sip -V from a normal (bash) console. The versions probably differ.

I overcame that error by identifying all installed sip-related packages in my system. (For Debian-like systems: dpkg -l | grep sip), removed them and all their configuration files (again, for Debian: apt-get purge python3-sip python3-sip-dev ...) and re-installed the custom version (by running make install again).

I by the way also did the same for all PyQt5 packages. According to your incomplete site-packages listing, you also might have installed some older PyQt5 distro package. The current one has many more modules. (QtSql for instance)

(All mentioned command should probably be executed as root.)

0
votes

I'm posting here because cannot comment yet. For whomever has this problem in Windows, for me the sip version shown by import sip print(sip, sip.SIP_VERSION_STR) was lower than the version shown in the sip file names. I fixed it by uninstalling and reinstalling sip (pip uninstall sip).