endlessm / eos-photos

Endless photo application
Other
4 stars 3 forks source link

ImportError: Requiring namespace 'Gtk' version '4.0', but '3.0' is already loaded #330

Closed bbhtt closed 1 year ago

bbhtt commented 2 years ago

Trying to use the GNOME 43 runtime results in:

Traceback (most recent call last):
  File "/app/bin/eos-photos", line 12, in <module>
    from src.endless_photos import EndlessPhotos
  File "/app/share/eos-photos/src/endless_photos.py", line 9, in <module>
    from .photos_view import PhotosView
  File "/app/share/eos-photos/src/photos_view.py", line 11, in <module>
    from .share.facebook_auth_dialog import FacebookAuthDialog
  File "/app/share/eos-photos/src/share/facebook_auth_dialog.py", line 2, in <module>
    from gi.repository import Gtk, WebKit2
  File "/usr/lib/python3.10/site-packages/gi/importer.py", line 144, in load_module
    raise ImportError(e)
ImportError: Requiring namespace 'Gtk' version '4.0', but '3.0' is already loaded
wjt commented 2 years ago

Try 9aacc1d ?

bbhtt commented 2 years ago

I tried that locally, it didn't work. I'll start a build with it to test.

bbhtt commented 2 years ago

Yea same issue with 113671:

flatpak run com.endlessm.photos
/app/share/eos-photos/src/endless_photos.py:6: PyGIWarning: GtkClutter was imported without specifying a version first. Use gi.require_version('GtkClutter', '1.0') before import to ensure that the right version gets loaded.
  from gi.repository import Gtk, Gdk, GLib, GtkClutter, GObject, Gio, Endless
/app/share/eos-photos/src/endless_photos.py:6: PyGIWarning: Endless was imported without specifying a version first. Use gi.require_version('Endless', '0') before import to ensure that the right version gets loaded.
  from gi.repository import Gtk, Gdk, GLib, GtkClutter, GObject, Gio, Endless
/app/share/eos-photos/src/widgets/composite_button.py:40: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  set_value = (my_flag is not 0)
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/gi/importer.py", line 142, in load_module
    introspection_module = get_introspection_module(namespace)
  File "/usr/lib/python3.10/site-packages/gi/module.py", line 257, in get_introspection_module
    module = IntrospectionModule(namespace, version)
  File "/usr/lib/python3.10/site-packages/gi/module.py", line 109, in __init__
    repository.require(namespace, version)
gi.RepositoryError: Requiring namespace 'Gtk' version '4.0', but '3.0' is already loaded

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/bin/eos-photos", line 12, in <module>
    from src.endless_photos import EndlessPhotos
  File "/app/share/eos-photos/src/endless_photos.py", line 9, in <module>
    from .photos_view import PhotosView
  File "/app/share/eos-photos/src/photos_view.py", line 13, in <module>
    from .share.facebook_auth_dialog import FacebookAuthDialog
  File "/app/share/eos-photos/src/share/facebook_auth_dialog.py", line 4, in <module>
    from gi.repository import Gtk, WebKit2
  File "/usr/lib/python3.10/site-packages/gi/importer.py", line 144, in load_module
    raise ImportError(e)
ImportError: Requiring namespace 'Gtk' version '4.0', but '3.0' is already loaded
bbhtt commented 1 year ago

This patch and the suggestion by @dbnicholson to specify the Gdk version seems to have worked.

https://github.com/flathub/com.endlessm.photos/pull/9/commits/6667733c21368221c9b404e481d181c5b02f78ec (ignore the whitespace trimmings at line endings)