alandmoore / admbrowser

A Web browser for kiosks and digital signage, based on Python, PyQt, and Blink
35 stars 22 forks source link

Can't run on Raspberry Pi #16

Closed smartm0use closed 1 year ago

smartm0use commented 4 years ago

ADMBrowser can't run on latest version of Raspbian (Buster).

After I have installed PyQt5 with sudo apt-get install python3-pyqt5 when I try to run python3 admbrowser.py I get the following error:

Traceback (most recent call last):
  File "admbrowser.py", line 1, in <module>
    from admbrowser import main
  File "/home/pi/admbrowser/admbrowser/__init__.py", line 1, in <module>
    from .browser import *
  File "/home/pi/admbrowser/admbrowser/browser.py", line 21, in <module>
    from PyQt5 import QtWebEngineWidgets as qtwe
ImportError: cannot import name 'QtWebEngineWidgets' from 'PyQt5' (/usr/lib/python3/dist-packages/PyQt5/__init__.py)

Do you know a workaround to make it working on Raspberry Pi?

alandmoore commented 4 years ago

You need to also install the package python3-pyqt5.qtwebengine. Unfortunately, raspbian does not ship this package for some reason. I believe there was some problem packaging this.

You might be able to pip install them from the repository at piwheels.org. I have not had a chance to try this. If you can get it working, please contribute a description of the process to the README.

smartm0use commented 4 years ago

You need to also install the package python3-pyqt5.qtwebengine. Unfortunately, raspbian does not ship this package for some reason. I believe there was some problem packaging this.

Yes, you are right, according to this answer it hasn't been released yet for Raspbian.

You might be able to pip install them from the repository at piwheels.org. I have not had a chance to try this.

Even doing pip install PyQtWebEngine doesn't work:

Could not find a version that satisfies the requirement PyQtWebEngine
(from versions: )
No matching distribution found for PyQtWebEngine

If you can get it working, please contribute a description of the process to the README.

In the next days I will try something like this or this. I will keep you updated. Thank you.

PS: is PyQt5 v.5.5 or higher mandatory or could I (try to) install PyQt5 v5.12.x or higher? Latest version seems to be PyQt5 5.13.2 (released almost a month ago).

alandmoore commented 4 years ago

@smartm0use I don't recall why 5.5 was required, it probably has to do with method calls on QWebEngine components that didn't exist prior. 5.12 or 5.13 should work fine, since they are later releases.

As for the main bug, I have attempted to get ADMBrowser running on a Pi using the arm64 build of Ubuntu, but I ran into problems running any kind of pyqt application (it would segfault as soon as I created a QApplication instance.

My next attempt will be with Ubuntu Mate's armhf build. There was a suggestion on a forum that you could install Debian's armhf packages on Raspbian, and I believe they have a build of QWebEngine.

Apparently the reason qtwebengine is not supported on Raspbian is due to some armv7 dependencies which would limit it to Pi 3 units or later. Raspbian excludes packages that won't run on older Pi models.

alandmoore commented 4 years ago

So the good news is that I was able to get admbrowser running on Ubuntu-Mate 18.04 using the armhf image available on ubuntu-mate.org. You need to pip install dataclasses since UM18.04 ships with Python 3.6.x.

The bad news is that it segfaults at the drop of a hat (or more to the point, whenever I click any hyperlinks). So it's pretty much useless unless you just want to use it for digital signage or some other situation where navigation doesn't occur.

Perhaps it might work better on a Pi 4, I don't really know. I would certainly be interested in a configuration that worked solidly on any model of Pi so I could retire my WCGBrowser builds that I currently run in production.

alandmoore commented 4 years ago

Adding to the list of distros that won't work, I tried FedBerry today (armv7 / armhfp port of Fedora 27). It ships qtwebengine, but trying to show a QWebEngineView widget results in a SEGV_MAPERR.

I'm beginning to think nobody ships a usable implementation of QWebengine on the Pi.

smartm0use commented 4 years ago

In the next days I will try something like this or this. I will keep you updated.

The second one didn't work. With the first procedure, I have done all the compilation but now I have the library in this path: usr/local/qt5pi and ADMBrowser can't find it. How to make Python to look there?

alandmoore commented 4 years ago

I would imagine you'd have to compile PyQt5 with some kind of flag pointing to your qt5pi, but I can't say for sure.

alandmoore commented 4 years ago

I have managed to get ADMBrowser to work successfully and reasonably stably on OpenSuse Leap 15.1 for the raspberry pi, which you can download here: http://download.opensuse.org/ports/aarch64/distribution/leap/15.1/appliances/

It is quite slow, but maybe with some config tweaking that can be address (RAM split adjustment, maybe?).

This gives me hope that other ARM64 distros may work OK once support for the platform becomes more widespread.

I will continue to investigate as time allows, and update the README when I have some firm answers.

alandmoore commented 4 years ago

Another semi-success, i upgraded Ubuntu MATE (armhf) to 20.04 (focal) beta. The browser launches and does not segfault, but is agonizingly slow on a 3B+ (more so than openSuse, I think). I'm going to try to acquire a Pi 4 with 4GB to see if it works acceptably.

smartm0use commented 4 years ago

I would imagine you'd have to compile PyQt5 with some kind of flag pointing to your qt5pi, but I can't say for sure.

About Raspbian, since I have spent a couple of days for cross-compiling, do you know a way to tell Python to look at that folder for PyQT5, without compiling again? (I'm on Raspberry Pi Zero)

Thank you for your tests with different distros, I think in my case (Pi Zero) your results would be worse due the single-core CPU and 512MB of RAM...

alandmoore commented 4 years ago

About Raspbian, since I have spent a couple of days for cross-compiling, do you know a way to tell Python to look at that folder for PyQT5, without compiling again?

Sorry, I really don't know.

(I'm on Raspberry Pi Zero)

I have serious doubts that QtWebEngine would ever be usable on a Pi Zero.

stroobandt commented 1 year ago

About a year ago, there was an interesting discussion about the availability of QTWebEngine over at the Raspberry Pi forum.

From the looks of it, it might be that one can get luckier with the 64-bit version of Raspberry Pi OS. Only Raspberry Pi 3 and higher can run 64-bit operating systems.

Shortly, I will try out 64-bit Ubuntu Server 22.04.1 LTS on a Raspberry Pi 3B and report back here. Ubuntu is based on Debian Testing and therefore "fresher."

alandmoore commented 1 year ago

Hey all, I'm going to close this issue. Compatibility with a particular platform is a problem for Qt and Python, not really for this project. Hopefully the RPi community will work out its issues with QtWebEngine.