cannot import name 'journal' from 'systemd'
jtmoon79 opened this issue · 1 comments
jtmoon79 commented
tl;dr cannot import name 'journal' from 'systemd' occurs on Debian 11 Linux
Problem
I installed python-systemd using pip
$ python3 -m pip install python-systemd
I emulated the README and attempted to import journal. It failed.
$ python3 -m ptpython
>>> import systemd
>>> systemd.get_version()
'0.0.9'
>>> from systemd import journal
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'journal' from 'systemd' (/usr/local/lib/python3.9/dist-packages/systemd/__init__.py)
Run as user root.
Other Context
- Linux 5.15.93 on aarch64
- Python 3.9.2
libsytemdversion 247.3-7.$ dpkg -l | grep systemd ii libsystemd0:armhf 247.3-7+rpi1+deb11u1 armhf systemd utility library ii systemd 247.3-7+rpi1+deb11u1 armhf system and service manager ....
Programs like journalctl work fine so it seems the libsystemd is functioning for other programs.
mrc0mmand commented
tl;dr
cannot import name 'journal' from 'systemd'occurs on Debian 11 LinuxProblem
I installed
python-systemdusingpip$ python3 -m pip install python-systemd
On PyPi this package is (unfortunately) known as systemd-python as README states:
The project is also available on pypi as systemd-python: