flozz / nautilus-terminal

A terminal embedded in Nautilus, the GNOME's file browser
GNU General Public License v3.0
323 stars 24 forks source link

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

Closed Glitchii closed 1 year ago

Glitchii commented 1 year ago

Bug description

Got this issue after reinstalling to Ubuntu 23.04. I sure I'm just too early and this will be fixed in the future since Ubuntu 23.04 is quite new. I'm using Gnome 44. This seems like a GTK issue. I guess it expected GTK 3.0 but I'm running 4.0?

What happened

Ran nautilus -q after installing nautilus-terminal with command pip install nautilus-terminal --break-system-packages. Received this error:

** Message: 16:58:21.060: Connecting to org.freedesktop.Tracker3.Miner.Files
/home/john/.local/lib/python3.11/site-packages/nautilus_terminal/crowbar.py:1: PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_version('Gtk', '4.0') before import to ensure that the right version gets loaded.
  from gi.repository import Gtk
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/gi/importer.py", line 142, in load_module
    introspection_module = get_introspection_module(namespace)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/gi/module.py", line 263, in get_introspection_module
    module = IntrospectionModule(namespace, version)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/gi/module.py", line 110, in __init__
    repository.require(namespace, version)
gi.RepositoryError: Requiring namespace 'Gtk' version '3.0', but '4.0' is already loaded

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/john/.local/share/nautilus-python/extensions/nautilus_terminal_extension.py", line 22, in <module>
    from nautilus_terminal.crowbar import Crowbar  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/john/.local/lib/python3.11/site-packages/nautilus_terminal/crowbar.py", line 5, in <module>
    from .nautilus_terminal import create_or_update_natilus_terminal
  File "/home/john/.local/lib/python3.11/site-packages/nautilus_terminal/nautilus_terminal.py", line 14, in <module>
    from gi.repository import GLib, Gio, Gtk, Gdk, Vte, Pango  # noqa: E402
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/gi/importer.py", line 144, in load_module
    raise ImportError(e)
ImportError: Requiring namespace 'Gtk' version '3.0', but '4.0' is already loaded

What was expected

nautilus to exit with no error, so that opening it back shows the terminal, which never happened.

Step to reproduce

→ Install Ubuntu 23.04, or upgrade with do-dist-upgrade, or I guess use GTK version 4.0 and above → Install nautilus as normal. The issue should happen after running nautilus -q after the previous steps

System information

NAUTILUS TERMINAL
=================
Version: 4.1.0
System-wide extension: Absent
Current user extension: Installed
Installation path: /home/me/.local/lib/python3.11/site-packages/nautilus_terminal

OPERATING SYSTEM
================
OS: Linux
Platform: Linux-6.2.0-20-generic-x86_64-with-glibc2.37
Version: #20-Ubuntu SMP PREEMPT_DYNAMIC Thu Apr  6 07:48:48 UTC 2023
Distribution issue: Ubuntu 23.04 \n \l

PYTHON
======
Python version: 3.11.2

SYSTEM DEPENDENCIES
===================
Nautilus Python: Absent
GLib schemas compiler: Installed
flozz commented 1 year ago

Hello,

As stated at the top of the README and in this issue, Nautilus Terminal is not working anymore since Nautilus 43 (when it switched to GTK 4). There will be no update since required APIs were removed from Nautilus.

You can also read this thread on the GNOME's forums:

flozz commented 1 year ago

I close this issue as there is no activity