0

I am using virtual env to run my program, but it show this error every time I run my code:

 UserWarning: The Python dbus package is not installed.
Try installing it with your distribution's package manager, it is usually called python-dbus or python3-dbus, but you might have to try dbus-python instead, e.g. when using pip.
  warnings.warn(msg)

I tried to install dbus package but it shows that its already installed on my system, so I tried running the code again, but, no luck - it shows the same error, that dbus isn't installed!

2
  • Welcome to Stack Overflow. Please take the time to explain clearly how you're getting this error and with what code. If you're using a virtual env, how are you running this? How was the dbus package installed? Which dbus package did you install? What python version are you using?
    – ewokx
    Commented Jul 5 at 3:14
  • 1
    The error tell you, in your current env this package isn’t installed.
    – Hermann12
    Commented Jul 5 at 5:47

1 Answer 1

0

Using apt will install into dist-packages while using pip with a venv will install in to site-packages.

If you create your venv with the --system-site-packages then that will pick up the apt package from dist-packages.

If you do pip install dbus-python when a "normal" venv is active that should work also.

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.