Reputation: 409
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?
Upvotes: 24
Views: 102898
Reputation: 79
I had the same error because I tried to install dbus on Windows and it's not supported:
Upvotes: 0
Reputation: 89
Try re-installing dbus-python. Also try on another virtual environment.
Upvotes: 0
Reputation: 487
Just do
sudo apt-get install python-dbus
on debian based os(ubuntu in your case) or
brew install dbus
on MacOSX
Upvotes: 1
Reputation: 5104
I encountered same problem while installing notify2
in python3
I was on MacOS 10.12
resolved using
brew install dbus
Upvotes: 5
Reputation: 453
I had the same problem when running an application called zeitgeist-explorer, but solved it by installing python2-dbus because the system was using version 3.5 and the application needed the 2 something version. check this post if you are getting an error like this one fix import error no module named dbus
Upvotes: 2
Reputation: 2619
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.
Upvotes: 34
Reputation: 190
pydbus requires python-gi (or python3-gi in the case of Python 3). And pydbus 0.2 is really outdated, 0.5.1 is the current version.
Upvotes: 1
Reputation: 2122
I'm not sure how you installed the modules but this error most likely occurs because the module is not installed or not installed correctly. I would recommend the following for installing a module.
pip install dbus
or since you have anaconda this will also work
conda install dbus
If you are able to access and download the source code for instance on GitHub you can try the following two methods. Navigate to the source code directory then run the following commands in the terminal:
pip install setup.py
or
python setup.py build
python setup.py install
For more on installing packages from source distributions see this page.
Upvotes: 3