backintime icon indicating copy to clipboard operation
backintime copied to clipboard

Still no solution to - ImportError: No module named 'dbus'

Open ixnewton opened this issue 7 years ago • 9 comments

Since KDE plasma 5 (now 5.42) and Qt5 (now 5.9.4) dropped KDE4 support some time last year Backintime fails to start. It would be really useful to continue using Backintime.

$ backintime Traceback (most recent call last): File "/usr/share/backintime/common/backintime.py", line 24, in <module> import config File "/usr/share/backintime/common/config.py", line 31, in <module> import tools File "/usr/share/backintime/common/tools.py", line 45, in <module> import dbus ImportError: No module named 'dbus'

or

$ backintime-qt 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 47, in <module> import snapshots File "/usr/share/backintime/common/snapshots.py", line 32, in <module> import config File "/usr/share/backintime/common/config.py", line 31, in <module> import tools File "/usr/share/backintime/common/tools.py", line 45, in <module> import dbus ImportError: No module named 'dbus'

It looks like there should be a module /usr/share/backintime/common/dbus.py which is missing?

Installing from Sabayon repo or compiling from Github source gives the same result. Because both 2.7.14 and Python 3.5.4 are installed the configure switch --python3 was used when compiling.

ixnewton avatar Feb 10 '18 16:02 ixnewton

May you be missing python3-dbus, perhaps?

Anyways, I have it, but I cannot launch BiT either:

backintime

Back In Time
Version: 1.2.0~alpha0

Back In Time comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; type `backintime --license' for details.

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 175, in activate_name_owner
    return self.get_name_owner(bus_name)
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 361, in get_name_owner
    's', (bus_name,), **keywords)
  File "/usr/lib/python3/dist-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NameHasNoOwner: Could not get owner of name 'net.launchpad.backintime.serviceHelper': no such name

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/share/backintime/common/backintime.py", line 1165, in <module>
    startApp()
  File "/usr/share/backintime/common/backintime.py", line 521, in startApp
    return getConfig(args, False)
  File "/usr/share/backintime/common/backintime.py", line 669, in getConfig
    cfg = config.Config(config_path = args.config, data_path = args.share_path)
  File "/usr/share/backintime/common/config.py", line 279, in __init__
    self.setupUdev = tools.SetupUdev()
  File "/usr/share/backintime/common/tools.py", line 1699, in __init__
    conn = bus.get_object(SetupUdev.CONNECTION, SetupUdev.OBJECT)
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 241, in get_object
    follow_name_owner_changes=follow_name_owner_changes)
  File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 248, in __init__
    self._named_service = conn.activate_name_owner(bus_name)
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 180, in activate_name_owner
    self.start_service_by_name(bus_name)
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 278, in start_service_by_name
    'su', (bus_name, flags)))
  File "/usr/lib/python3/dist-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.Spawn.ChildExited: Launch helper exited with unknown return code 1

Note that I don't have any python3 installed in /usr/local, or anything.

I think the issue is because python3-dbus.mainloop.pyqt5 (5.9.2) package is not delivering any so file anymore:

dpkg -L python3-dbus.mainloop.pyqt5
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/python3-dbus.mainloop.pyqt5
/usr/share/doc/python3-dbus.mainloop.pyqt5/changelog.gz
/usr/share/doc/python3-dbus.mainloop.pyqt5/changelog.Debian.gz
/usr/share/doc/python3-dbus.mainloop.pyqt5/copyright

Any help is more than welcome

kupiqu avatar Feb 12 '18 01:02 kupiqu

In my distribution (Sabayon/Gentoo) the package Dbus Python 1.2.4 is installed which has runtime dependencies:

dev-lang/python:3.5[threads(+)] >=dev-lang/python-2.7.5-r2:2.7[threads(+) >=dev-lang/python-exec-2:2[python_targets_python2_7,python_targets_python3_5,-python_single_target_python2_7,-python_single_target_python3_4,-python_single_target_python3_5,-python_single_target_python3_6] >=dev-libs/dbus-glib-0.100:0 >=sys-apps/dbus-1.6:0

Both python 2.7.5 and python 3.5 are installed including pyqt5 5.9.2

in python3.5 the file exists /usr/lib64/python3.5/site-packages/dbus/_dbus.py

Trying to sym-link as dbus.py in /usr/share/backintime/common/ does not help

The version BiT 1.2.0~alpha0 does not seem to be a branch on Git. Where can I get this source code to try?

ixnewton avatar Feb 12 '18 22:02 ixnewton

I have same problem with backintime (BiT) v1.2.0-alpha17 which produces the error that others have found above. When I enter "systemctl status dbus.service" this error is reported: ImportError: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.9' not found (required by /usr/local/lib/python3.5/dist-packages/PyQt5/QtCore.so) A similar error occurs with Qt5.10 installed. This suddenly occurred yesterday after upgrading the python editor spyder to 3.2.7 with the "sudo -H pip3 install --upgrade spyder". I wonder if including the "--upgrade" option caused this? I solved my total inability to backup using any of my 20 or so BiT profiles by uninstalling backintike-qt v1.2.0~alpha17 in synaptics. Then I installed backintime v1.0.40 which uses kde and runs with backintime-kde4. You can download this from here: https://launchpad.net/backintime/+download?memo=10&start=10 This version was the last using kde and not reliant on Qt. You will have to unzip the downloaded folder then read README for instructions on how to compile and install it with details of any dependencies. After that change any launchers using backintime-qt to backintime-kde4 or just run these from the command line. They will find your backintime config files. This worked for both root and user BiT setups. Using a .deb installation file would be much easier but I could not find one for v1.0.40. This version was current in November, 2014 but I was using it then with no problems. You may find a few facilities added later missing but it does the backup on my local machine to an external USB disk just fine for me. An alternative method which works but is far more complex is as follows: Install linux, I used Linuxmint18.3, on it own partition and then boot to it and install the latest version of backintime. From there I was able to run BiT with --config to pick up my usual configuration file. This will rely on making sure that all partitions have exactly the same /media/ as on the original setup. This is not a trivial setup but it works for me. Avoid making any changes to python, other than to satisfy dependencies. I guess that you could easily do the same running a new linux installation in VirtualBox.

Months later: I think I have now discovered the source of my problem and can run Backintime v1.1.24 in LinuxMint18.3 (uses Ubuntu 16.04 repositories) distribution deb file with no problems. Below I describe how I fixed my python setup to allow BIT to run correctly. Originally, I installed Spyder (a python graphical user interface and editor) using python3 pip. This upgraded various files in my python3 ubuntu setup such that the dependencies needed to run the latest version of BIT were not satisfied. When I uninstalled all the python3 files which were installed using pip, including Syper3, the latest version of BIT 1.1.24 started running with no problems.

I then installed Anaconda python3 within which I can run Spyder. Anaconda installs itself quite separately from Ubuntu distribution files in my home directory. This allows me to have different python versions running which in no way interact with the Ubuntu setup. If I use pip without understanding how to manage it separately from the Ubuntu distribution files it is likely to install files within the system directories which will potentially break the Ubuntu setup. This is what appears to have happened to muck up the dbus setup and stop BIT from working.

ianwillie avatar Mar 04 '18 13:03 ianwillie

If I manually execute /usr/bin/python3 -Es /usr/share/backintime/qt/serviceHelper.py:

Traceback (most recent call last):
  File "/usr/share/backintime/qt/serviceHelper.py", line 74, in <module>
    import dbus.mainloop.pyqt5
ImportError: No module named 'dbus.mainloop.pyqt5'

Ubuntu has made python3-dbus.mainloop.pyqt5 a dummy package without any so library, which makes backintime to fail. No idea how to work around this.

kupiqu avatar Apr 06 '18 20:04 kupiqu

Just as a hint what might help in a similar way others too, when the above error message occurs: In my case kupiqu's command showed a line import dbus.mainloop.qt. My distribution has a package named 'python3-dbus.mainloop.qt' (which is a dependency of backintime-qt4), the files of it are going to /usr/lib/python3/dist-packages/dbus/mainloop. As soon as I copied them in my 3.5 tree (sudo cp -arv /usr/lib/python3/dist-packages/dbus/mainloop /usr/local/lib/python3.5/dist-packages/dbus/) backintime worked again.

ghost avatar Jun 28 '18 08:06 ghost

checking it out, thanks for sharing

kupiqu avatar Jun 28 '18 10:06 kupiqu

Not working here:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 175, in activate_name_owner
    return self.get_name_owner(bus_name)
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 361, in get_name_owner
    's', (bus_name,), **keywords)
  File "/usr/lib/python3/dist-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NameHasNoOwner: Could not get owner of name 'net.launchpad.backintime.serviceHelper': no such name

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/share/backintime/qt/app.py", line 1592, in <module>
    cfg = backintime.startApp('backintime-qt')
  File "/usr/share/backintime/common/backintime.py", line 521, in startApp
    return getConfig(args, False)
  File "/usr/share/backintime/common/backintime.py", line 669, in getConfig
    cfg = config.Config(config_path = args.config, data_path = args.share_path)
  File "/usr/share/backintime/common/config.py", line 279, in __init__
    self.setupUdev = tools.SetupUdev()
  File "/usr/share/backintime/common/tools.py", line 1699, in __init__
    conn = bus.get_object(SetupUdev.CONNECTION, SetupUdev.OBJECT)
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 241, in get_object
    follow_name_owner_changes=follow_name_owner_changes)
  File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 248, in __init__
    self._named_service = conn.activate_name_owner(bus_name)
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 180, in activate_name_owner
    self.start_service_by_name(bus_name)
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 278, in start_service_by_name
    'su', (bus_name, flags)))
  File "/usr/lib/python3/dist-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.Spawn.ChildExited: Launch helper exited with unknown return code 1

@Jaleks, what distribution (and distro version) are you using?

kupiqu avatar Jun 29 '18 04:06 kupiqu

Ok, I fixed my problem in KDE neon User Edition (based on Ubuntu 16.04) by:

  • getting python3-dbus.mainloop.pyqt5 from bionic repo (xenial package doesn't work, see below)
  • editing the dependencies so it doesn't conflict python3.5
  • installing the modified package
  • manually linking /usr/lib/python3/dist-packages/dbus/mainloop/pyqt5.cpython-35m-x86_64-linux-gnu.so to /usr/lib/python3/dist-packages/dbus/mainloop/pyqt5.cpython-36m-x86_64-linux-gnu.so

it seems all the problem was that pyqt5.cpython-35m-x86_64-linux-gnu.so was missing in my system. A KDE neon packaging bug, I guess.

kupiqu avatar Jun 29 '18 06:06 kupiqu

I realise this is closed, but I have been having this same issue for awhile in Ubuntu 20.04 LTS

I had to run pip install dbus-python and pip install pyqt5 now BIT GUI opens fine.

webmasterMeyers avatar Aug 18 '21 15:08 webmasterMeyers

I realise this is closed, but I have been having this same issue for awhile in Ubuntu 20.04 LTS I had to run pip install dbus-python and pip install pyqt5 now BIT GUI opens fine.

Despite being a closed issue: IMHO the documentation of the dependencies must be updated. I will open a new issue referencing this. @webmasterMeyers Thanks for your input!

aryoda avatar Aug 24 '22 16:08 aryoda

Closing as duplicate of #1233.

emtiu avatar Oct 08 '22 22:10 emtiu