2

I'm running Ubuntu 13.10 (python-3.3.2+) . I've installed Qt5.2.1 (linux installer) , SIP 4.15.5 & PyQt5 both from source of the official site.

PyQt5 build :

The Qt qmake is located here

jeby6372@mercure:~$ ls /opt/Qt/5.2.1/gcc_64/bin
assistant             qdbus           qml1plugindump    qmlviewer
designer              qdbuscpp2xml    qml2puppet        qtpaths
lconvert              qdbusviewer     qmlbundle         rcc
linguist              qdbusxml2cpp    qmlimportscanner  syncqt.pl
lrelease              qdoc            qmlmin            uic
lupdate               qhelpconverter  qmlplugindump     xmlpatterns
moc                   qhelpgenerator  qmlprofiler       xmlpatternsvalidator
pixeltool             qmake           qmlscene
qcollectiongenerator  qml             qmltestrunner

My python path

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

Qt5 libraries (shorten list for display purpose):

jeby6372@mercure:/opt/Qt/5.2.1/gcc_64/lib$ ls
cmake                              libQt5Positioning.so.5
libicudata.so.51                   libQt5Positioning.so.5.2
libicudata.so.51.1                 libQt5Positioning.so.5.2.1
libqgsttools_p.so                  libQt5PrintSupport.so.5.2.1
libqgsttools_p.so.1                libQt5QmlDevTools.a
libQt5CLucene.so.5.2               libQt5QuickParticles.so.5.2.1
libQt5Concurrent.so.5.2            libQt5QuickTest.la
libQt5Concurrent.so.5.2.1          libQt5QuickTest.prl
libQt5Core.so.5.2.1                libQt5Script.prl
libQt5DBus.la                      libQt5Script.so
....... 
libQt5Multimedia.so                libQt5WebKit.prl
libQt5Nfc.la                       libQt5Widgets.so.5.2.1
libQt5Nfc.prl                      libQt5X11Extras.la
libQt5Nfc.so                       libQt5X11Extras.prl
libQt5Nfc.so.5                     libQt5X11Extras.so
libQt5Nfc.so.5.2                   libQt5X11Extras.so.5
libQt5OpenGLExtensions.a           libQt5X11Extras.so.5.2.1
libQt5OpenGLExtensions.la          libQt5Xml.la
libQt5OpenGL.so                    libQt5XmlPatterns.so.5
libQt5OpenGL.so.5                  libQt5XmlPatterns.so.5.2
libQt5OpenGL.so.5.2.1              libQt5Xml.prl
libQt5Platfor
libQt5PlatformSupport.prl          libQt5Xml.so.5.2
libQt5Positioning.so

I ran the following commands in the source directory extracted from the official PyQt-gpl-5.2.1.tar.gz tarball :

python3 configure.py --qmake /opt/Qt/5.2.1/gcc_64/bin/qmake # My PyQt5 location
sudo make
sudo make install

Issue:

I can only import a restricted set of modules

>>> from PyQt5.QtCore import *
>>> from PyQt5.QtNetwork import *
>>> from PyQt5.QtXmlPatterns import *
>>> from PyQt5.Qt import *
>>> from PyQt5.QtGui import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'PyQt5.QtGui'
>>> from PyQt5.QtWidgets import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'PyQt5.QtWidgets'

I can import QtCore, QtNetwork ... as listed in /usr/local/python3.3/sites-packages/PyQt5 :

jeby6372@mercure:/usr/lib/python3.3/site-packages/PyQt5$ ls
__init__.py  QtCore.so  QtDBus.so  QtNetwork.so  Qt.so  QtXmlPatterns.so  uic

But I can't import QtWidgets, QtGui .. and so on.

It seems that the PyQt5 libraries are not all copied here.

The same problem is described in this post ... but unfortunately with no response from the RiverBanck's team :

Any idea?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Emmanuel BRUNET
  • 1,286
  • 3
  • 19
  • 46
  • 2
    the cause of the problem in the post you linked was that [OpenGL was not installed](http://riverbankcomputing.com/pipermail/pyqt/2013-July/033014.html). Maybe that's also your problem - try installing libgl1-mesa-dev and libgl1-mesa-glx and recompile PyQt5 – mata Mar 24 '14 at 00:29
  • The linked post got three responses, all from the project maintainer. One of those responses asked to see the output of `configure.py` with the `--verbose` flag set. Please do the same here, if his suggestion to install OpenGL doesn't solve your issue. – ekhumoro Mar 24 '14 at 00:37
  • Thank you mata. Your solution works perfectly. I just installed the missing libgl1-mesa-dev package, compiled PyQt5 from the sources and everythong's fine (except another Qt redrawing bug, but this will be logged into a new post). Thanks again. – Emmanuel BRUNET Mar 24 '14 at 11:12
  • ekhumoro you're right. I should have investigate much deeper thru the configure.py --verbose option. The next time I won't forget that. Thanks. – Emmanuel BRUNET Mar 24 '14 at 11:14
  • 1
    Instead of putting "SOLVED" into your title, why don't you just accept your own answer? This is the proper way of marking this question as being solved. – tobias_k Apr 09 '14 at 19:24

1 Answers1

5

Missing package

Install the missing libgl1-mesa-dev dependency as suggested by mata. It's a free implementation of the OpenGL API.

Build

sudo apt-get install libgl1-mesa-dev

Create or clean up your PyQt5 compilation environment and build it according to the regular procedure.

Alternative

If this fix doesn't solve your problem, install the libgl1-mesa-glx package (GLX runtime) and the libgl1-mesa-dri (drawing accelerator) if they are also missing and proceed with Build instructions.

Hope this help.

Emmanuel BRUNET
  • 1,286
  • 3
  • 19
  • 46
  • I am experiencing the same issue on Mac OS 10.9; is there an analogous library/framework I can download to solve this? – iresprite Oct 24 '14 at 03:32