Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How solve ImportError: No module named 'dbus'?

I have installed anaconda4 on my ubuntu and I have these modules on my Python:

dbus-python (1.2.4)

gi (1.2)

pydbus (0.2)

QtAwesome (0.3.2)
qtconsole (4.2.0)
QtPy (1.0)

sip (4.18)

I tried installing dbus-python (1.2.4) and pydbus (0.2), however, neither of them works!

After testing a simple program in python 3.5.1, an error appeared:

import dbus
system_bus = dbus.SystemBus()

ImportError: No module named 'dbus'

When I use pydbus in Python 2.7.11 and 3.5.1:

from pydbus import SystemBus

bus = SystemBus()
systemd = bus.get(".systemd1")

for unit in systemd.ListUnits():
    print(unit)

I get this error:

ImportError: No module named repository

The only thing that works is this example with PyQT4 which I don't have any tutorial for.

What is the problem? Is it my installation or something else?

like image 430
B nM Avatar asked May 30 '16 08:05

B nM


3 Answers

I don't know about installing dbus in anaconda but you can install it using apt-get in ubuntu .

sudo apt-get install python-dbus

I tried with pip earlier but that didn't work for me.

like image 39
Amit Chahar Avatar answered Nov 07 '22 04:11

Amit Chahar


Try this for Python 3.6 32 bit version

pip install dbus-python
like image 123
Arun K Avatar answered Nov 07 '22 06:11

Arun K


I encountered same problem while installing notify2 in python3 I was on MacOS 10.12 resolved using

brew install dbus
like image 4
azhar22k Avatar answered Nov 07 '22 04:11

azhar22k