Template snapcraft.yaml for pyqt

Apparently a repository I made at the start of my tests, 2 years ago, using snapcraft.yaml and pyqt, with qt5 and python3, is what people find when searching for information on the topic.

Is there something wrong on the way I am snapping this hello-world repo?

2 Likes

I believe the desktop-qt5 remote part should be used.

Do I need to do anything other than:

...
parts:
  pyqthelloworld:
    after: [desktop-qt5]
...

That should be enough, and you might be able to drop some stage-packages that is already depended by the remote part, refer the output of snapcraft define desktop-qt5 for more info.

Thanks! The hello world repo saved me a lot of time.

1 Like

The hello world app doesn’t seem to work when using Wayland (but does for X11):

$ pyqthelloworld 
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
qt.qpa.plugin: Could not load the Qt platform plugin "wayland-egl" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl.

Aborted

This seems related to this issue: https://forum.qt.io/topic/109060/qt-qpa-plugin-could-not-load-the-qt-platform-plugin-wayland-egl-in-even-though-it-was-found/3

My app seems to also have this problem: https://github.com/argosopentech/argos-translate

Specify DISABLE_WAYLAND: 1 in the apps.*.environment stanza.

Currently enabling Wayland has a major theming issue that should be avoided.

1 Like

That issue generally happens when you have missing dependencies, could you please run the below command and see if any line says “not found”, if that is the case, you’d have to add more stage-packages to fulfill those deps.

ldd /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqwayland-egl.so

Note: this above command needs to be run after snap run --shell <your_name_name>, its quite likely the path would be $SNAP/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqwayland-egl.so

@Lin-Buo-Ren thanks adding DISABLE_WAYLAND: 1 fixed the issue.

Should this be updated in the hello world application/desktop helpers repo so that they work with Wayland by default or is it best to wait for wider Snapcraft Wayland support? I could make a pull request.

I noticed that in the Argos Translate snap the system cursor theme and size is not followed. I see KeePassXC, a Qt (though not PyQt) app, has some additions plugs for theming. Is that the correct/preferred solution for this?