mosquito / cysystemd

systemd wrapper on Cython
Apache License 2.0
101 stars 22 forks source link

Can't install using pip #20

Closed shatteredsword closed 5 years ago

shatteredsword commented 5 years ago

i am running raspbian buster on a raspberry pi 3 model b+
i have python 2.7.16 as well as python 3.7.3 installed side by side
i also have pip and pip3
pip3 installs the package just fine, but pip fails every time
i'm not sure if this is an issue of my environment, or if it's an issue with the package.
anyway, any help would be greatly appreciated.

$ pip install systemd
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting systemd
  Using cached https://files.pythonhosted.org/packages/d4/c2/2195b049effd866b5d26926e672be83fc6f3263aa71ea0639e8eab44851e/systemd-0.16.1.tar.gz
Requirement already satisfied: enum34 in /usr/lib/python2.7/dist-packages (from systemd) (1.1.6)
Requirement already satisfied: dictproxyhack in ./.local/lib/python2.7/site-packages (from systemd) (1.1)
Building wheels for collected packages: systemd
  Running setup.py bdist_wheel for systemd ... error
  Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-D8R1oV/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/pip-wheel-_yx6ne --python-tag cp27:
  /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'build_requires'
    warnings.warn(msg)
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-armv7l-2.7
  creating build/lib.linux-armv7l-2.7/systemd
  copying systemd/__init__.py -> build/lib.linux-armv7l-2.7/systemd
  copying systemd/daemon.py -> build/lib.linux-armv7l-2.7/systemd
  copying systemd/journal.py -> build/lib.linux-armv7l-2.7/systemd
  running build_ext
  building 'systemd._daemon' extension
  creating build/temp.linux-armv7l-2.7
  creating build/temp.linux-armv7l-2.7/systemd
  arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-9NJ3qw/python2.7-2.7.16=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c systemd/_daemon.c -o build/temp.linux-armv7l-2.7/systemd/_daemon.o
  systemd/_daemon.c:539:10: fatal error: systemd/sd-daemon.h: No such file or directory
   #include <systemd/sd-daemon.h>
            ^~~~~~~~~~~~~~~~~~~~~
  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/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-D8R1oV/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-CCRKkP/install-record.txt --single-version-externally-managed --compile --user --prefix=:       
    /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'build_requires'
      warnings.warn(msg)
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-armv7l-2.7
    creating build/lib.linux-armv7l-2.7/systemd
    copying systemd/__init__.py -> build/lib.linux-armv7l-2.7/systemd
    copying systemd/daemon.py -> build/lib.linux-armv7l-2.7/systemd
    copying systemd/journal.py -> build/lib.linux-armv7l-2.7/systemd
    running build_ext
    building 'systemd._daemon' extension
    creating build/temp.linux-armv7l-2.7
    creating build/temp.linux-armv7l-2.7/systemd
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-9NJ3qw/python2.7-2.7.16=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c systemd/_daemon.c -o build/temp.linux-armv7l-2.7/systemd/_daemon.o
    systemd/_daemon.c:539:10: fatal error: systemd/sd-daemon.h: No such file or directory
     #include <systemd/sd-daemon.h>
              ^~~~~~~~~~~~~~~~~~~~~
    compilation terminated.
    error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-D8R1oV/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-CCRKkP/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-install-D8R1oV/systemd/
mosquito commented 5 years ago

see this section for installing libsystemd headers

shatteredsword commented 5 years ago

@mosquito thanks! i did that section, but was getting this error:

$ sudo apt-get install build-essential \
>     libsystemd-journal-dev \
>     libsystemd-daemon-dev \
>     libsystemd-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package libsystemd-journal-dev
E: Unable to locate package libsystemd-daemon-dev

for whatever reason, it didn't even bother trying to install build-essential or libsystemd-dev when it couldn't find the other 2 packages.
after i manually installed build-essential and libsystemd-dev i was able to install it using pip, but was forced to use the --user flag

$ pip install systemd
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support 
for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting systemd
  Using cached https://files.pythonhosted.org/packages/d4/c2/2195b049effd866b5d26926e672be83fc6f3263aa71ea0639e8eab44851e/systemd-0.16.1.tar.gz
Requirement already satisfied: enum34 in /usr/lib/python2.7/dist-packages (from systemd) (1.1.6)
Requirement already satisfied: dictproxyhack in /home/pi/.local/lib/python2.7/site-packages (from systemd) (1.1)
Building wheels for collected packages: systemd
  Building wheel for systemd (setup.py) ... done
  Created wheel for systemd: filename=systemd-0.16.1-cp27-cp27mu-linux_armv7l.whl size=429279 sha256=f7b1960c19e0e904ae8a07fc4eff7f5e38c2cdbc7297452f9bbd4e76fbc9c1b2
  Stored in directory: /home/pi/.cache/pip/wheels/4b/63/fd/24f52453e2290c3971341306ec4a374f1d856c39c8459994a4
Successfully built systemd
Installing collected packages: systemd
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages'
Consider using the `--user` option or check the permissions.

$ pip install --user systemd worked just fine after that