python app not seeing libraries in Gnome Platform

Dan Nicholson dbn at endlessos.org
Mon Jul 19 18:53:23 UTC 2021


On Mon, Jul 19, 2021 at 12:15 PM Scott Mackay <mackay333 at msn.com> wrote:
>
> Hello,
>
> I hope this is the right place to ask.  I volunteer on packaging Gramps as a flatpak for the gramps-project.  It is a python3 app, but the flatpak app is not seeing the Gnome Platform 3.38 libraries that I know are in the platform.  (Gramps has an optional add-on that checks prerequisites.)  Examples of prerequisites that are in Gnome Platform but not seen by Gramps flatpak are librsvg, xdg-utils, language pack, enchant, etc.  I have found the libraries installed in my system through the flathub installed platform at /var/lib/flatpak/runtime/org.gnome.Platform/x86_64/3.38/62763751ad7e5c0dd029a716115a4f9618b7a14a4ec6e7618c1db0105800357f/files/lib/x86_64-linux-gnu/ but it looks to me like that directory will change each time it gets installed depending on the computer and whether it is system or user wide.  Gramps itself is installed in the .yml manifest with the command

At runtime flatpak mounts the runtime to /usr. You can see what it
looks like using flatpak run:

$ flatpak run org.gnome.Platform//3.38
$ flatpak run org.gnome.Sdk//3.38

Either will put you in a shell in the runtime environment.

> - python3 setup.py install --prefix=/app --exec-prefix=/bin
>
> and I suspect that I need to add something to that command to have Gramps see the platform libraries, but I haven't figured it out yet.  Does anyone know how to have python see the Platform libraries?

I don't think you should have to do anything, but I'm rusty on flatpak
builds. I suspect you're using gobject-instrospection via pygobject to
use the libraries. Just to understand how that works, pygobject loads
a typelib file which describes how to interface with the the shared
library. The runtime libraries go in /usr/lib/x86_64-linux-gnu while
libraries bundled with the application go in /app/lib. Similarly, the
typelib files from the runtime go in
/usr/lib/x86_64-linux-gnu/girepository-1.0 while the typelib files
bundled with the app go in /app/lib/girepository-1.0.

As far as I can tell, that should all work out of the box. Here I'm
loading librsvg via python:

$ flatpak run org.gnome.Platform//3.38
[📦 org.gnome.Platform ~]$ python3
Python 3.8.8 (default, Nov 10 2011, 15:00:00)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gi
>>> gi.require_version('Rsvg', '2.0')
>>> from gi.repository import Rsvg

What's the specific error you're hitting?

--
Dan


More information about the Flatpak mailing list