• I think my GTK is broken?


    Hey guys!

    I’m currently using Antergoson a 64 bit machine with the gnome desktop environment

    I believe my GTK is all messed up or something. When I run gnome-tweak-tool in the terminal this is what I get…

    [[email protected] ~]$ gnome-tweak-tool 
    Traceback (most recent call last):
      File "/usr/bin/gnome-tweak-tool", line 24, in <module>
        gi.require_version("Gtk", "3.0")
    AttributeError: 'module' object has no attribute 'require_version'
    

    And when I also run redshift-gtk in the terminal, this is what I get

    [[email protected] ~]$ redshift-gtk
    Traceback (most recent call last):
      File "/usr/bin/redshift-gtk", line 26, in <module>
        from redshift_gtk.statusicon import run
      File "/usr/lib/python3.5/site-packages/redshift_gtk/statusicon.py", line 32, in <module>
        import gi
      File "/home/daniel/.local/lib/python3.5/site-packages/gi/__init__.py", line 39
        print url
                ^
    SyntaxError: Missing parentheses in call to 'print'
    

    It works if I run redshift by itself, so I think that means that the GTK thing is messed up

    These used to work before a few days ago.

    I’ve reinstalled gi with pip using python2 and python3 and the error still continues.

    Any ideas on what to do?

  • Hi,

    Problem with redshift is that is python2 and, by default, Antergos (and Arch) uses python3.

    It’s true that gnome-tweak-tool should work, and it seems it loads an old gi.
    You can try to reinstall:
    sudo pacman -S gobject-introspection gtk3 python-gobject

    Cheers!

  • @karasu Well, I have python2 and python3 installed

    [[email protected] ~]$ python2 --version
    Python 2.7.12
    [[email protected] ~]$ python --version
    Python 3.5.2
    [[email protected] ~]$ python3 --version
    Python 3.5.2
    

    and I did reinstall those and I get the same issue =/

    [[email protected] ~]$ gnome-tweak-tool 
    Traceback (most recent call last):
      File "/usr/bin/gnome-tweak-tool", line 24, in <module>
        gi.require_version("Gtk", "3.0")
    AttributeError: 'module' object has no attribute 'require_version'
    
  • @dgameman1

    You have to run it with python2 , I’m sure you’re running it just with “python”, and that in Antergos is python3

    Don’t know about the other error…

  • @karasu Right, but I previously was able to just open it up by clicking the icon in the applications drawer in Gnome.

    And this is what I see now :p

    [[email protected] ~]$ python2 gnome-tweak-tool 
    python2: can't open file 'gnome-tweak-tool': [Errno 2] No such file or directory
    [[email protected] ~]$ python3 gnome-tweak-tool 
    python3: can't open file 'gnome-tweak-tool': [Errno 2] No such file or directory
    [[email protected] ~]$ python2 redshift-gtk
    python2: can't open file 'redshift-gtk': [Errno 2] No such file or directory
    [[email protected] ~]$ python3 redshift-gtk
    python3: can't open file 'redshift-gtk': [Errno 2] No such file or directory
    [[email protected] ~]$
    
  • @dgameman1
    I’m not in my computer, so I can’t test this.

    But try this:

    python2 /usr/bin/redshift-gtk
    
  • @karasu I see.

    [[email protected] ~]$ python2 /usr/bin/redshift-gtk
    Traceback (most recent call last):
      File "/usr/bin/redshift-gtk", line 26, in <module>
        from redshift_gtk.statusicon import run
      File "/usr/lib/python3.5/site-packages/redshift_gtk/statusicon.py", line 33, in <module>
        gi.require_version('Gtk', '3.0')
    AttributeError: 'module' object has no attribute 'require_version'
    

    So from my understanding the module gi is all fucked. I tried reinstalling it with pip and it successfully reinstalled but I still couldn’t get it to work.

    Also thanks for helping me :) It’s much appreciated

  • What does this give you?
    python -c "import gi; print(gi.__spec__)"

    should be origin='/usr/lib/python3.5/site-packages/gi/__init__.py'

    If origin is ok, then try this one:
    pacman -Qo /usr/lib/python3.5/site-packages/gi/__init__.py

    Cheers!

  • @karasu No go :(

    [[email protected] ~]$ python -c "import gi; print(gi.__spec__)"
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/home/daniel/.local/lib/python3.5/site-packages/gi/__init__.py", line 39
        print url
                ^
    SyntaxError: Missing parentheses in call to 'print'
    [[email protected] ~]$
    
  • Please, run this:
    ls /usr/bin/python* -la

  • @karasu

    [[email protected] ~]$ ls /usr/bin/python* -la
    lrwxrwxrwx 1 root root     7 Nov  7 02:48 /usr/bin/python -> python3
    lrwxrwxrwx 1 root root     9 Nov  7 03:03 /usr/bin/python2 -> python2.7
    -rwxr-xr-x 1 root root  6304 Nov  7 03:03 /usr/bin/python2.7
    -rwxr-xr-x 1 root root  1681 Nov  7 03:03 /usr/bin/python2.7-config
    lrwxrwxrwx 1 root root    16 Nov  7 03:03 /usr/bin/python2-config -> python2.7-config
    lrwxrwxrwx 1 root root     9 Nov  7 02:48 /usr/bin/python3 -> python3.5
    -rwxr-xr-x 2 root root 10392 Nov  7 02:48 /usr/bin/python3.5
    lrwxrwxrwx 1 root root    17 Nov  7 02:48 /usr/bin/python3.5-config -> python3.5m-config
    -rwxr-xr-x 2 root root 10392 Nov  7 02:48 /usr/bin/python3.5m
    -rwxr-xr-x 1 root root  3129 Nov  7 02:48 /usr/bin/python3.5m-config
    lrwxrwxrwx 1 root root    16 Nov  7 02:48 /usr/bin/python3-config -> python3.5-config
    lrwxrwxrwx 1 root root    14 Nov  7 02:48 /usr/bin/python-config -> python3-config
    [[email protected] ~]$
    
  • Oh, didn’t see this:
    /home/daniel/.local/lib/python3.5
    How come you have python installed in your local folder?

  • @karasu said in I think my GTK is broken?:

    /home/daniel/.local/lib/python3.5

    Um I have no idea tbh. I thought you said Antergos comes with python3.5?
    Doesn’t that mean it was already installed there? Lol i have no idea.

    And sorry about the delay, I can only post once every 300 seconds :panda_face:

  • Yes, but it should be in /usr/lib and not /home/daniel/.local/lib

    Did you use pip or easy_install ?

    Maybe you installed something that came with its own version of Python.

    Run this please:

    python
    import sys
    print ('\n'.join(sys.path))
    exit()
    
  • @karasu I mean I have used pip before

    [[email protected] ~]$ python
    Python 3.5.2 (default, Nov  7 2016, 11:31:36) 
    [GCC 6.2.1 20160830] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import sys
    >>> print ('\n'.join(sys.path))
    
    /usr/lib/python35.zip
    /usr/lib/python3.5
    /usr/lib/python3.5/plat-linux
    /usr/lib/python3.5/lib-dynload
    /home/daniel/.local/lib/python3.5/site-packages
    /usr/lib/python3.5/site-packages
    /usr/lib/python3.5/site-packages/gtk-2.0
    >>> exit()
    [[email protected] ~]$
    
  • Yep, that’s the problem. You have /home/daniel/.local/lib… in the python path BEFORE /usr/lib/python3.5/site-packages

    Do you have PYTHONPATH set?
    env | grep PYTHON

  • @karasu
    Fak

    So you think me using Pip did that?

    [[email protected] ~]$ env | grep PYTHON
    [[email protected] ~]$
    
  • So you think me using Pip did that?

    Don’t know for sure, but if you used it without sudo, it installs packages in your .local folder. What I do not understand is why you have that bad order in your path (and I don’t know what should be the “good” way to fix it).

  • Just, for a test, rename your lib folder inside that .local one:
    mv /home/daniel/.local/lib /home/daniel/.local/lib2

    And try running your python apps…

  • @karasu Oh

    Yeah I read somewhere that I should use it with --user.

    Guess that’s the problem then? :/

    And holy shit, doing that worked. So you suggest I run pip as sudo from now on?

python23 gtk8 python8 Posts 21Views 2171
Log in to reply