jars121
Posts: 78
Joined: Tue Jun 25, 2013 8:35 pm

Process for installing PyQt5 on Raspbian Lite

Thu Jul 20, 2017 10:20 pm

G'day,

I understand that PyQt5 can be installed from apt-get, but I believe this version of PyQt5 use a pre-compiled Qt which is built around the X Server/Window. I need to build PyQt5 with a Frame Buffer/EGLFS-based Qt, so believe I will need to build Qt manually, and then build PyQt5 manually based on that Qt installation?

Is my logic here correct? If so, is the process for doing so as follows:
  • 1. Cross-compile Qt with EGLFS option (using x64 Ubuntu in my case), burning the modified Raspbian (Lite in my case) image to SD card.
  • 2. With the modified Raspbian (Lite) image running on the RPi2/3, build PyQt5 from source. The PyQt5 build should recognise and use the manually built and cross-compiled Qt?
  • 3. Now when I run a PyQt5-based .py file on the RPi2/3, the graphics will display directly on the Frame Buffer without the need for an X Server/Window?
Any clarifications here would be greatly appreciated!

Thanks :)

User avatar
topguy
Posts: 3691
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Process for installing PyQt5 on Raspbian Lite

Fri Jul 21, 2017 10:59 am

It sounds reasonable to me.

Personally I would probably choose to build Qt5 also locally but that is just that I dislike setting up crosscompiler environments.
The PyQt5 build should recognise and use the manually built and cross-compiled Qt?
Depends a little on where you choose to install Qt5 on the Pi of course, but adding an extra "include" path and "library" path to the build is usually not a big hurdle.

jars121
Posts: 78
Joined: Tue Jun 25, 2013 8:35 pm

Re: Process for installing PyQt5 on Raspbian Lite

Sun Jul 23, 2017 2:30 am

I think you're right. I've been trying to get a successful cross-compile established on my Ubuntu platform, but am thinking I'll try and compile directly on the Pi instead. I understand the build will take a considerable amount of time on the Pi, but I'm happy to leave it running overnight.

As to modifying the PyQt5 build I'm not exactly sure what's required there. At a high level I understand how I could modify/include an 'include' statement to point to the local Qt installation, but I'm not sure how to get about this in practise. Having said that, my background research to date has been focused on the Qt5 build, so there may well be documentation/instructions available.

jars121
Posts: 78
Joined: Tue Jun 25, 2013 8:35 pm

Re: Process for installing PyQt5 on Raspbian Lite

Mon Jul 24, 2017 2:49 am

I spent most of yesterday trying to compile Qt5 directly on my RPi2. Unfortunately I was receiving errors with all the tutorials/step-by-steps I tried. I've posted on the Qt forum, as I've read a number of people on there have compiled Qt5 successfully on the RPi, so hopefully I have a response there.

If anyone can link to a tried and tested tutorial for compiling on the RPi, I (and others I'm sure) would really appreciate it!

jars121
Posts: 78
Joined: Tue Jun 25, 2013 8:35 pm

Re: Process for installing PyQt5 on Raspbian Lite

Sun Aug 06, 2017 9:34 pm

For anyone reading this in the future, I've successfully installed PyQt5 on my RPi2 running Raspbian Lite, using a custom build of Qt 5.9 (with Python 3.6, SIP, etc.). I followed basically all the steps listed in the various tutorials online. Be aware however, that if you plan on using eglfs, you must use the -device and -device-option flags in the Qt ./configure process, even when building natively on the RPi itself (it can be a little confusing as the -device-option flag states 'CROSS_COMPILE').

Return to “Graphics programming”

Who is online

Users browsing this forum: No registered users and 3 guests