Issue with GNOME Builder

Hi folks,

I’m trying to use GNOME Builder to develop a personal app and it cannot run the app because this error:

File "/app/bin/pyopentracks", line 49, in <module>
    from pyopentracks import main
  File "/app/share/pyopentracks/data/pyopentracks/main.py", line 24, in <module>
    gi.require_version('Champlain', '0.12')
  File "/usr/lib/python3.8/site-packages/gi/__init__.py", line 126, in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace Champlain not available
Aplicación terminada

The code is here:

import sys
import gi

gi.require_version("Gtk", "3.0")
gi.require_version('Champlain', '0.12')
gi.require_version('GtkChamplain', '0.12')
gi.require_version('GtkClutter', '1.0')

from .app import Application


def main(app_id, version):
    app = Application(app_id)
    return app.run(sys.argv)`

And from the terminal I can import GtkChamplain with no problems.

Also, I can build/execute my app from out of GNOME Builder.

What’s the issue? I can’t understand what GNOME Builder is doing to build/run the app, my computer has all the packages/software needed.

Thanks!

1 Like

If you’re using the GNOME Flatpak run time to build your application using Builder, then you will need to include Champlain and its dependencies (including Clutter and Clutter-GTK) in your application’s manifest. What you have installed on your system won’t make any difference.

Side note: Clutter and Clutter-GTK are unmaintained and should not be used in any newly written code. Champlain, too, is deprecated. You should use Shumate and GTK4 instead.

Thank you for your response.

This is the manifest, so I guess “libchamplain” is not well added:

{
  "app-id": "es.rgmf.pyopentracks",
  "runtime": "org.gnome.Platform",
  "runtime-version": "3.38",
  "sdk": "org.gnome.Sdk",
  "command": "pyopentracks",
  "finish-args": [
    "--share=network",
    "--share=ipc",
    "--socket=fallback-x11",
    "--socket=wayland",
    "--filesystem=host"
  ],
  "cleanup": [
    "/include",
    "/lib/pkgconfig",
    "/man",
    "/share/doc",
    "/share/gtk-doc",
    "/share/man",
    "/share/pkgconfig",
    "*.la",
    "*.a"
  ],
  "modules": [
    {
      "name": "pyopentracks",
      "builddir": true,
      "buildsystem": "meson",
      "sources": [
        {
          "type": "git",
          "url": "file:///home/roman/workspace/PyOpenTracks",
          "branch": "main"
        }
      ]
    },
    {
      "name": "pip-install",
      "buildsystem": "simple",
      "build-options": {
        "build-args": [
          "--share=network"
        ]
      },
      "build-commands": [
        "pip3 install --prefix=/app matplotlib==3.3.4",
        "pip3 install --prefix=/app python-dateutil>=2.8.1",
        "pip3 install --prefix=/app fitparse>=1.2.0"
      ]
    },
    {
      "name": "libchamplain",
      "builddir": true,
      "buildsystem": "meson",
      "sources": [
        {
          "type": "git",
          "url": "https://gitlab.gnome.org/GNOME/libchamplain.git",
          "branch": "master"
        }
      ]
    }
  ]
}

The order in the manifest is relevant: you need to put dependencies before the thing that depends on them.

In this case, you want libchamplain before your app.

The 3.38 runtime has been deprecated for the past year and change. Please, don’t use it.

You should be using at least the GNOME 42 run time, but you will need to add:

  • cogl
  • clutter
  • clutter-gtk

before libchamplain, as those libraries have been removed from the SDK.

It works like a charm. Thank you for your help and your advice.

I have to migrate the app from Gtk3 to Gtk4. It’s not easy because there are a lot of features to migrate. Anyway, all your advice are useful for me :wink:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.