ModuleNotFoundError: No module named '_dbus_bindings' debian 11 bullseye python 3.9.2

Question:

I’m upgrading my arm based system from debian 10 to debian 11, but python is giving me a headache.

I’m running a bluetooth server on it, with the bluedot api, but this requires the dbus-python api. This was a hassle to install on its own but now the module not found error has shifted from dbus to _dbus_bindings. And now I’m just lost.

ive installed all the dependencies for dbus, but it still doesn’t work.

full error:

  File "/etc/test.py", line 3, in <module>
    import dbus
  File "<frozen zipimport>", line 259, in load_module
  File "/usr/local/lib/python3.9/dist-packages/dbus_python-1.2.18-py3.9-linux-aarch64.egg/dbus/__init__.py", line 73, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "/usr/local/lib/python3.9/dist-packages/dbus_python-1.2.18-py3.9-linux-aarch64.egg/dbus/types.py", line 8, in <module>
     # iterator.  Don't check the type!  Use hasattr to check for both
  ModuleNotFoundError: No module named '_dbus_bindings'

I don’t know if the problem is the new debian, or the switch from python 3.7.3 to 3.9.2 that came with it.

Asked By: owndampu

||

Answers:

it seems that installing an older version worked:

pip3 install dbus-python==1.2.16
instead of 1.2.18, tried this because this is also the version that is installed on my ubuntu desktop.

waiting to try it out on the actual hardware instead of in chroot.

result is a success. I’ve seen more people struggling with this but haven’t seen this answer yet, so I’ll keep it up.

Answered By: owndampu

I had the same issue when I created a python package and I solved it by installing the latest version:
dbus-python==1.3.2

Answered By: bkbilly
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.