black
black

Reputation: 1241

systemd fails to install on raspbian python3

I want to install the systemd (github) library.

However, executing

sudo pip3 install systemd

Leads to this error:

Command "/usr/local/bin/python3.6 -u -c "import setuptools, tokenize;file='/tmp/pip-install-c97m6cn0/systemd/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-record-gqnrg4wd/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-c97m6cn0/systemd/

I tried to upgrade the setuptools, but this did not resolve my issue:

sudo pip3 install --upgrade setuptools

Here the full console output:

$ sudo pip3 install systemd Collecting systemd
Using cached https://files.pythonhosted.org/packages/d4/c2/2195b049effd866b5d26926e672be83fc6f3263aa71ea0639e8eab44851e/systemd-0.16.1.tar.gz Building wheels for collected packages: systemd Running setup.py bdist_wheel for systemd ... error Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-build-11re058x/systemd/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" bdist_wheel -d /tmp/tmpg851h3qzpip-wheel- --python-tag cp35:
/usr/lib/python3.5/distutils/dist.py:261: UserWarning: Unknown distribution option: 'build_requires' warnings.warn(msg) running bdist_wheel running build running build_py creating build creating build/lib.linux-armv6l-3.5
creating build/lib.linux-armv6l-3.5/systemd copying systemd/daemon.py -> build/lib.linux-armv6l-3.5/systemd copying systemd/journal.py -> build/lib.linux-armv6l-3.5/systemd copying systemd/init.py -> build/lib.linux-armv6l-3.5/systemd running build_ext building 'systemd._daemon' extension creating build/temp.linux-armv6l-3.5 creating build/temp.linux-armv6l-3.5/systemd arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-RUbMX3/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c systemd/_daemon.c -o build/temp.linux-armv6l-3.5/systemd/_daemon.o
systemd/_daemon.c:539:31: fatal error: systemd/sd-daemon.h: No such file or directory #include ^ compilation terminated. error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

---------------------------------------- Failed building wheel for systemd Running setup.py clean for systemd Failed to build systemd Installing collected packages: systemd Running setup.py install for systemd ... error Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-build-11re058x/systemd/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-lirhgtsu-record/install-record.txt --single-version-externally-managed --compile: /usr/lib/python3.5/distutils/dist.py:261: UserWarning: Unknown distribution option: 'build_requires' warnings.warn(msg) running install running build running build_py creating build creating build/lib.linux-armv6l-3.5 creating build/lib.linux-armv6l-3.5/systemd copying systemd/daemon.py -> build/lib.linux-armv6l-3.5/systemd copying systemd/journal.py -> build/lib.linux-armv6l-3.5/systemd copying systemd/init.py -> build/lib.linux-armv6l-3.5/systemd running build_ext building 'systemd._daemon' extension creating build/temp.linux-armv6l-3.5 creating build/temp.linux-armv6l-3.5/systemd arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-RUbMX3/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c systemd/_daemon.c -o build/temp.linux-armv6l-3.5/systemd/_daemon.o systemd/_daemon.c:539:31: fatal error: systemd/sd-daemon.h: No such file or directory #include ^ compilation terminated. error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

---------------------------------------- Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-11re058x/systemd/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n',

'\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-lirhgtsu-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-11re058x/systemd/

Upvotes: 3

Views: 5205

Answers (2)

Lasith Niroshan
Lasith Niroshan

Reputation: 1083

This command will install systemd in your system.

sudo apt-get install python-systemd

Upvotes: 1

AKX
AKX

Reputation: 169051

The relevant part of the error is

fatal error: systemd/sd-daemon.h: No such file or directory

Install libsystemd-dev using apt first and you should be good to go:

sudo apt install libsystemd-dev

Upvotes: 10

Related Questions