Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ixnewton opened this issue Feb 10, 2018 · 11 comments
Closed

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

ixnewton opened this issue Feb 10, 2018 · 11 comments

Comments

@ixnewton
Copy link

ixnewton commented Feb 10, 2018

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.

@kupiqu
Copy link

kupiqu commented Feb 12, 2018

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

@ixnewton
Copy link
Author

ixnewton commented Feb 12, 2018

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?

@ianwillie
Copy link

ianwillie commented Mar 4, 2018

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.

@kupiqu
Copy link

kupiqu commented Apr 6, 2018

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.

@ghost
Copy link

ghost commented Jun 28, 2018

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.

@kupiqu
Copy link

kupiqu commented Jun 28, 2018

checking it out, thanks for sharing

@kupiqu
Copy link

kupiqu commented Jun 29, 2018

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
Copy link

kupiqu commented Jun 29, 2018

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.

@webmasterMeyers
Copy link

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.

@aryoda
Copy link
Contributor

aryoda commented Aug 24, 2022

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!

@emtiu
Copy link
Member

emtiu commented Oct 8, 2022

Closing as duplicate of #1233.

@emtiu emtiu closed this as completed Oct 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants