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


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]
Comment=alternate launcher for 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

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:

Which doesnt appear to manually move any executables or mess with PATH, so … my guess is its up to miniconda.