Build python-qt4 from source on Debian testing

Learn how to build python-qt4 from source on Debian testing.

Build python-qt4 from source on Debian testing

As QtWebKit Python bindings were removed from Debian Testing/Stretch QGIS is unable to start with Python support and consequently with Python plugins.

Yes, there aren't many Debian Testing users in the GIS world, but there's a specific case for some with newer hardware.

If you have an Intel Skylake GPU in use like I do and you're using Linux then you probably already know preliminary support in the kernel has been only added since kernel version 4.3 with 4.4 supporting it fully.

Thus, you cannot use Debian Jessie or Ubuntu Trusty. Several months ago when I bought my current laptop the only viable option was Debian Testing and until this issue appeared it has served me without flaws. Now that Ubuntu Xenial (16.04), which is based on Debian Stretch, is in the open you can also work with it but it probably suffers from the same caveat.

The only solution is to build python-qt4 with WebKit support.

The steps are:

  • sudo apt-get install bison cmake dh-python doxygen flex gdal-bin git graphviz grass-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libopenscenegraph-dev libosgearth-dev libpq-dev libproj-dev libqca2-dev libqca2-plugin-ossl libqjson-dev libqscintilla2-dev libqt4-dev libqt4-opengl-dev libqt4-sql-sqlite libqwt-dev libspatialindex-dev libspatialite-dev libsqlite3-dev lighttpd locales pkg-config poppler-utils python-all python-all-dev python-future python-gdal python-mock python-nose2 python-psycopg2 python-pyspatialite python-sip python-sip-dev python-yaml qt4-dev-tools qt4-doc-html spawn-fcgi txt2tags xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb cmake-curses-gui libqtwebkit-dev

Note: From the normal qgis dependencies (see INSTALL document) I removed the pyqt4-dev-tools pyqt4.qsci-dev python-qscintilla2 python-qt4 python-qt4-dev python-qt4-sql packages and I added the libqtwebkit-dev but you don't need to remove anything from the dependencies as they will simply be overwritten.

  • Download PyQt
  • Extract the archive and cd to the directory with tar -xvf PyQt-x11-gpl-4.11.4.tar.gz && cd PyQt-x11-gpl-4.11.4
  • Configure with the option to also build the QSCIntilla api with python configure-ng.py --qmake=/usr/bin/qmake-qt4 --qsci-api
  • make && sudo make install
  • Download QScintilla
  • Extract the archive with tar -xvf QScintilla_gpl-2.9.3.tar.gz
  • Cd to the Qt4Qt5 subdirectory with cd QScintilla_gpl-2.9.3/Qt4Qt5/
  • qmake-qt4 qscintilla.pro
  • make && sudo make install
  • the Python bindings for QScintilla are in the QScintilla_gpl-2.9.3/Python directory so cd ../Python should get you there
  • python configure.py --qmake=/usr/bin/qmake-qt4
  • make && sudo make install should do the trick

Congratulations, you have built python-qt4 with QtWebKit support + QScintilla with python bindings.

You can now build QGIS from source as you basically you have build from source what comes in the pyqt4-dev-tools pyqt4.qsci-dev python-qscintilla2 python-qt4 python-qt4-dev python-qt4-sql packages. All this with QtWebKit support, of course.


Share Tweet Send
0 Comments
Loading...
You've successfully subscribed to
Great! Next, complete checkout for full access to
Welcome back! You've successfully signed in
Success! Your account is fully activated, you now have access to all content.