'"ModuleNotFoundError: No module named 'dbus'" on macOS

I'm getting an error when I'm using the notify2 module.

ModuleNotFoundError: No module named 'dbus'

The error is from the notify2.py file.

When I tried pip install dbus this was the output:

ERROR: Could not find a version that satisfies the requirement dbus (from versions: none)
ERROR: No matching distribution found for dbus

When I tried brew install python-dbus:

==> Searching for similarly named formulae...
Error: No similarly named formulae found.
Error: No available formula or cask with the name "python-dbus".
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.

I couldn't find any answers related to macOS to fix this.



Solution 1:[1]

Try doing pip install dbus-python. It worked for me on fedora 34.

Solution 2:[2]

Not sure about MacOS, but debian-based OS I got issue resolved w:

sudo apt-get update
sudo apt-get -y install libglib2.0-dev libdbus-1-3 libdbus-1-dev

As per this so

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Vedant Matanhelia
Solution 2 Alejo Herny