Python thing, gi.require_version('GtK', '3.0')

Hi!

I need help to fix that.

Did a test, because error messages of python in my syslog:

Run:
python3.7 /usr/lib/python3/dist-packages/sessioninstaller/core.py

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/sessioninstaller/core.py", line 47, in
gi.require_version('GtK', '3.0')
File "/usr/lib/python3/dist-packages/gi/init.py", line 129, in require_version
raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace GtK not available

I added to:

/usr/lib/python3/dist-packages/sessioninstaller/core.py

these lines:

import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk

but did not help.

OS is Ubuntu Mate 19.04 v2

Hello there!

I want to start by pointing out that the version 19.04 of Ubuntu is not supported anymore:

https://itsfoss.com/ubuntu-19-04-end-of-life/

Well, it seems that you are missing some dependencies with GTK3. Could you build a bit more context about what you are trying to do exactly? What is the application you are trying to run?

Thank you! :slight_smile:

Yes, I know, it's not supported anymore.

I asked because I had this in my syslog yesterday.

File "/usr/bin/session-installer", line 23, in
Jun 1 16:43:50 user org.freedesktop.PackageKit[5238]: from sessioninstaller.core import main
Jun 1 16:43:50 user org.freedesktop.PackageKit[5238]: File "/usr/lib/python3/dist-packages/sessioninstaller/core.py", line 47, in
Jun 1 16:43:50 user org.freedesktop.PackageKit[5238]: gi.require_version('GtK', '3.0')
Jun 1 16:43:50 user org.freedesktop.PackageKit[5238]: File "/usr/lib/python3/dist-packages/gi/init.py", line 129, in require_version
Jun 1 16:43:50 user org.freedesktop.PackageKit[5238]: raise ValueError('Namespace %s not available' % namespace)
Jun 1 16:43:50 user org.freedesktop.PackageKit[5238]: ValueError: Namespace GtK not available

Are python3-gi and gir1.2-gtk-3.0 installed?

Yes.

I re-installed it and edited the file: "/usr/lib/python3/dist-packages/sessioninstaller/core.py"

That seems to be working with:

import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk

Output now from syslog:

Jun 2 15:01:07 user dbus-daemon[1077]: [system] Activating via systemd: service name='org.freedesktop.PackageKit' unit='packagekit.service' requested by ':1.49' (uid=0 pid=5002 comm="/usr/bin/gdbus call --system --dest org.freedeskto" label="unconfined")
Jun 2 15:01:07 user systemd[1]: Starting PackageKit Daemon...
Jun 2 15:01:07 user PackageKit: daemon start
Jun 2 15:01:07 user dbus-daemon[1077]: [system] Successfully activated service 'org.freedesktop.PackageKit'
Jun 2 15:01:07 user systemd[1]: Started PackageKit Daemon.