-
Notifications
You must be signed in to change notification settings - Fork 249
Description
Hey folks,
This was baffling me for ages, but I had a flash of inspiration which led me to understand what was going on so I thought I'd share what I have found.
At some point recently the backintime GUI stopped working for me. I initially thought this might have been due to my recent upgrade to Ubuntu 22.04 LTS but none of the solutions I found helped my particular issue.
When I run /usr/bin/backintime-qt
I got the following error:
Traceback (most recent call last):
File "/usr/share/backintime/qt/app.py", line 35, in <module>
import qttools
File "/usr/share/backintime/qt/qttools.py", line 21, in <module>
from PyQt5.QtGui import (QFont, QColor, QKeySequence)
ModuleNotFoundError: No module named 'PyQt5'
My initial thought was that I was somehow missing the PyQt5
package so I checked using pip3 freeze | grep PyQt5
and it confirmed that I had PyQt5
installed:
pip3 freeze | grep PyQt5
PyQt5==5.15.6
PyQt5-sip==12.9.1
I then looked at the contents of /usr/bin/backintime-qt
and noticed that it has the #!/bin/sh
shebang line. Furthermore when it calls out to python (python3 -Es ${APP_PATH}/app.py "$@"
) it doesn't specify the path to the python binary.
I think what was happening in my case was that my pyenv configuration was being initialised in the process in which backintime-qt
was being run. When it initialised pyenv inserts various "shims" in to the PATH
environment variable, with the intention of providing access to a specific Python runtime. The backintime-qt
script seems to be expecting to use the system python runtime.
To test this I replaced the line which calls out to python with the following, which ensures that it calls my system python runtime:
/usr/bin/python3 -Es ${APP_PATH}/app.py "$@"
Lo and behold this resolves the issue and the backintime GUI now works for me again.
I'm not sure what a "proper" fix might look like here, as I'm aware that hard coding the path to the python runtime might not be portable across all Linux distros. I did wonder if there was a way to ensure the backintime-qt
script was run in a "non-interactive" way, in the hope this might avoid pyenv
and other similar tools from polluting backintime's environment, but I didn't have any luck when testing this.
Anyway, thought this was worth sharing and hope this helps someone.
P.S. BackInTime is a fabulous tool, much better than Ubuntu's default backup tool. Thanks for the time and effort spent on it! 🙌