Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.4k views
in Technique[技术] by (71.8m points)

ubuntu - PyQt5 - SIP API 10 level error. API 11 required

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...