Tweaks not launching

I use Manjaro updated yesterday.

Tweaks does not launch from Activities.

The Tweaks launcher is configured in /usr/share/applications/org.gnome.tweaks.desktop, in particular

Exec=gnome-tweaks

gnome-tweaks launches in Terminal.

In order to check what is going on without touching system files, I have created ~/.local/share/applications/mytweaks.desktop, containing

[Desktop Entry]
Name=MyTweaks
Comment=alternate launcher for Gnome Tweaks
Type=Application
Terminal=false
Categories=GNOME;GTK;Utility;
Exec=/usr/bin/gnome-tweaks

and again MyTweaks does not launch in Activities.

If I substitute Exec=/usr/bin/gedit, then gedit launches in Activities, my file is correct.

Hence, the problem is in the launcher environment.

In Terminal, I have noticed that gnome-tweaks does not launch depending on the Python virtual environment.

How to debug the launcher environment: where are the configuration and log files, how to check variables?

Canā€™t reproduce.

ā€¦your local environment. What did you do? :thinking:

Try creating a new user and see if you can reproduce it.

1 Like

root user does not have the problem.

No, I said create a new userā€“and login to the new account in a graphical session.

root has graphical interface too. This suffices to prove that the problem lies in my user.

Sorry, I realized I forgot to say something important: Never login to the GUI as root.

1 Like

I donā€™t care, I am used to such risk. A new user does not have the problem either.

Then how can you expect anyone else to care if you donā€™t?

No one can help if you donā€™t tell us what else youā€™ve done that you should not have done. Doing things like that apparently caused your issue.

Something about this maybe?

Sorry, ā€œI donā€™t careā€ means that I am not afraid of logging as root (because I have backup).

The problem is in my user. Not in ā€˜~/ .configā€™. Not in Gnome extensions.

In Logs, I can see

ModuleNotFoundError: No module named 'giĀ“
import gi
File "/usr/bin/gnome-tweaks"

Also, gnome-tweaks does not work any longer in Terminal and the error message is:

  File "/usr/bin/gnome-tweaks", line 13, in <module>
    import gi
ModuleNotFoundError: No module named 'gi'

So it is a Python environment problem or version problem.

Did someone use sudo pip or similar?

Also ā€¦ this thread at least presents as alike to this one:

Yes conda is involved (and pip as well).

That didnt answer the main question - did you use sudo with one of those python package managers at some point?

Well that, and, the general question around this:

Your virtual environments are where you should do your development thingsā€¦
We are technically not interested in how gnome-tweaks functions there ā€¦ we care more about regular use - ā€˜outside ofā€™ those environments.
(However you abuse your virtual environment is up to you. If you break it make a new one.)

I am quite sure I did not use sudo pip for my Python stuff. My Python environment should not affect the way Gnome launches Tweaks.

My Manjaro is up to date now. If I had used sudo pip to modify the system Python, my modification would have been crushed.

Youā€™re right, it shouldnā€™t. However, it is.

You already have python-gobject installed as a dependency of gnome-tweaks, but since you installed Python packages locally instead of setting up a virtual environment, itā€™s looking for it there.

Did I modify my Python with pip outside a virtual environment? Maybe.

Trying now to modify, I get the neat error message:

alba@mac2011-manjaro% pip install gi
error: externally-managed-environment

Ɨ This environment is externally managed
ā•°ā”€> To install Python packages system-wide, try 'pacman -S
    python-xyz', where xyz is the package you are trying to
    install.

So I doubt I modified, unless the security net was installed very recently.

I try this

alba@mac2011-manjaro% sudo pacman -S python-gobject
warning: python-gobject-3.46.0-1 is up to date -- reinstalling

No improvement.

I donā€™t see how I could break the Python used by Gnome.

By not caring about signing in as root and then running pip install, maybe ?
(or ā€¦ something similar. That only comes to mind because of the things mentioned here.)

I logged as root just to launch Tweaks in Activities. I normally never do this.

Now, if I do

/usr/bin/python -c 'import gi'

I have no error, while I have the gi error in Logs if I launch Tweaks from Activities.

This shows that Gnome does not use the same Python that is availabe to me.

From /usr/bin/gnome-tweaks :

import gi
gi.require_version("Gtk", "3.0")
gi.require_version("Handy", "1")

I/usr/bin/gnome-tweaks works in Terminal (after exiting any custom env). Thus Python is not broken.

Something is broken in my session but it is not Python. It is something that disturbs the way Python is called.

In Logs, maybe related:

ImportError: cannot import name '_gi' from partially initialized module
File "/usr/lib/python3.11/site-packages/gi/__init.py__", line 40
Fule "/usr/lib/lollypop/lollypop-sp", line 19

I have improved something: I could make the MyTweaks launcher work with

Exec=/usr/bin/python /usr/bin/gnome-tweaks

hence it may be just a path-to-Python problem, caused by miniconda, that I had installed with Add/Remove software (AUR).

miniconda3 disturbs Python path, in Terminal and Activities.

This can be avoided in Terminal with conda deactivate and in Activities by uninstalling miniconda3 or less radically by copying
/usr/share/applications/org.gnome.tweaks.desktop to ~/.local/share/applications/mytweaks.desktop and replacing in the new file Exec=gnome-tweaks by Exec=/usr/bin/python /usr/bin/gnome-tweaks.

In Activities, search Tweaks and click the second icon.

I dont use it to know whether its a packaging issue or just miniconda.
Either way not gnomes fault.

Heres the AUR page for that PKGBUILD:
https://aur.archlinux.org/packages/miniconda3

Which doesnt appear to manually move any executables or mess with PATH, so ā€¦ my guess is its up to miniconda.
https://docs.conda.io/projects/miniconda