darton / RPiMS

Raspberry Pi monitoring system offering: live video transmission recording the stream using UV4L, reading door, window, motion, temperature, humidity, pressure sensors, presentation of their values and sending their states to the Zabbix server. It also offers a weather station: wind speed and direction meter, rainfall meter
GNU General Public License v2.0
11 stars 5 forks source link

Incompatibles issues #1

Closed hasanaltin closed 2 years ago

hasanaltin commented 3 years ago

Hello Dariusz, thanks for the nice job. I'm trying to compatible the package for Alpine Linux and getting some errors. I've listed the issues that I faced and couldn't solve so far. I hope to solve these error by your help.

Edit : Debian also shows the same errors.

The first one is below.

[root@appliance ~]# zabbix_get -s 10.10.10.5 -k rpims.dht[2]
Traceback (most recent call last):
  File "/root/scripts/RPiMS/redis-get-data.py", line 22, in <module>
    config = json.loads(redis_db.get('config'))
  File "/usr/lib/python3.9/json/__init__.py", line 339, in loads
    raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not NoneType

The second one is below. I couldn't install the systemd python package for Alpine Linux, you may guess what was the problem which prevented the installation.

[root@RP4 RPiMS]# python3 rpims.py
/root/scripts/RPiMS/rpims.py:419: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if debug is 'yes':
/root/scripts/RPiMS/rpims.py:423: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if debug is 'yes':
/root/scripts/RPiMS/rpims.py:427: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if debug is 'yes':
/root/scripts/RPiMS/rpims.py:427: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if debug is 'yes':

# RPiMS is running #

Another instance of RPiMS is already running. RPiMS will now close. No module named 'systemd'

systemd error's output is given below.

[root@RP4 RPiMS]# pip install systemd
Collecting systemd
  Using cached systemd-0.16.1.tar.gz (173 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: systemd
  Building wheel for systemd (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-609f_olx/systemd_1c62f33e593046258040f0de7f15e1c0/setup.py'"'"'; __file__='"'"'/tmp/pip-install-609f_olx/systemd_1c62f33e593046258040f0de7f15e1c0/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-m6l84jr0
       cwd: /tmp/pip-install-609f_olx/systemd_1c62f33e593046258040f0de7f15e1c0/
  Complete output (29 lines):
  [1/3] Cythonizing systemd/_daemon.pyx
  /usr/lib/python3.9/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /tmp/pip-install-609f_olx/systemd_1c62f33e593046258040f0de7f15e1c0/systemd/_daemon.pyx
    tree = Parsing.p_module(s, pxd, full_module_name)
  [2/3] Cythonizing systemd/_journal.pyx
  /usr/lib/python3.9/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /tmp/pip-install-609f_olx/systemd_1c62f33e593046258040f0de7f15e1c0/systemd/_journal.pyx
    tree = Parsing.p_module(s, pxd, full_module_name)
  [3/3] Cythonizing systemd/reader.pyx
  /usr/lib/python3.9/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /tmp/pip-install-609f_olx/systemd_1c62f33e593046258040f0de7f15e1c0/systemd/reader.pyx
    tree = Parsing.p_module(s, pxd, full_module_name)
  /usr/lib/python3.9/distutils/dist.py:274: UserWarning: Unknown distribution option: 'build_requires'
    warnings.warn(msg)
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-armv7l-3.9
  creating build/lib.linux-armv7l-3.9/systemd
  copying systemd/journal.py -> build/lib.linux-armv7l-3.9/systemd
  copying systemd/__init__.py -> build/lib.linux-armv7l-3.9/systemd
  copying systemd/daemon.py -> build/lib.linux-armv7l-3.9/systemd
  running build_ext
  building 'systemd._daemon' extension
  creating build/temp.linux-armv7l-3.9
  creating build/temp.linux-armv7l-3.9/systemd
  gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fomit-frame-pointer -g -fno-semantic-interposition -fomit-frame-pointer -g -fno-semantic-interposition -fomit-frame-pointer -g -fno-semantic-interposition -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/python3.9 -c systemd/_daemon.c -o build/temp.linux-armv7l-3.9/systemd/_daemon.o
  gcc -shared -Wl,--as-needed,-O1,--sort-common -fno-semantic-interposition -Wl,--as-needed,-O1,--sort-common -fno-semantic-interposition build/temp.linux-armv7l-3.9/systemd/_daemon.o -L/usr/lib -lsystemd -o build/lib.linux-armv7l-3.9/systemd/_daemon.cpython-39-arm-linux-musleabihf.so
  /usr/lib/gcc/armv7-alpine-linux-musleabihf/10.3.1/../../../../armv7-alpine-linux-musleabihf/bin/ld: cannot find -lsystemd
  collect2: error: ld returned 1 exit status
  error: command '/usr/bin/gcc' failed with exit code 1
  ----------------------------------------
  ERROR: 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
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-609f_olx/systemd_1c62f33e593046258040f0de7f15e1c0/setup.py'"'"'; __file__='"'"'/tmp/pip-install-609f_olx/systemd_1c62f33e593046258040f0de7f15e1c0/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-5qozo0ru/install-record.txt --single-version-externally-managed --compile --install-headers /usr/include/python3.9/systemd
         cwd: /tmp/pip-install-609f_olx/systemd_1c62f33e593046258040f0de7f15e1c0/
    Complete output (31 lines):
    [1/3] Cythonizing systemd/_daemon.pyx
    /usr/lib/python3.9/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /tmp/pip-install-609f_olx/systemd_1c62f33e593046258040f0de7f15e1c0/systemd/_daemon.pyx
      tree = Parsing.p_module(s, pxd, full_module_name)
    [2/3] Cythonizing systemd/_journal.pyx
    /usr/lib/python3.9/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /tmp/pip-install-609f_olx/systemd_1c62f33e593046258040f0de7f15e1c0/systemd/_journal.pyx
      tree = Parsing.p_module(s, pxd, full_module_name)
    [3/3] Cythonizing systemd/reader.pyx
    /usr/lib/python3.9/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /tmp/pip-install-609f_olx/systemd_1c62f33e593046258040f0de7f15e1c0/systemd/reader.pyx
      tree = Parsing.p_module(s, pxd, full_module_name)
    /usr/lib/python3.9/distutils/dist.py:274: UserWarning: Unknown distribution option: 'build_requires'
      warnings.warn(msg)
    running install
    /usr/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
      warnings.warn(
    running build
    running build_py
    creating build
    creating build/lib.linux-armv7l-3.9
    creating build/lib.linux-armv7l-3.9/systemd
    copying systemd/journal.py -> build/lib.linux-armv7l-3.9/systemd
    copying systemd/__init__.py -> build/lib.linux-armv7l-3.9/systemd
    copying systemd/daemon.py -> build/lib.linux-armv7l-3.9/systemd
    running build_ext
    building 'systemd._daemon' extension
    creating build/temp.linux-armv7l-3.9
    creating build/temp.linux-armv7l-3.9/systemd
    gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fomit-frame-pointer -g -fno-semantic-interposition -fomit-frame-pointer -g -fno-semantic-interposition -fomit-frame-pointer -g -fno-semantic-interposition -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/python3.9 -c systemd/_daemon.c -o build/temp.linux-armv7l-3.9/systemd/_daemon.o
    gcc -shared -Wl,--as-needed,-O1,--sort-common -fno-semantic-interposition -Wl,--as-needed,-O1,--sort-common -fno-semantic-interposition build/temp.linux-armv7l-3.9/systemd/_daemon.o -L/usr/lib -lsystemd -o build/lib.linux-armv7l-3.9/systemd/_daemon.cpython-39-arm-linux-musleabihf.so
    /usr/lib/gcc/armv7-alpine-linux-musleabihf/10.3.1/../../../../armv7-alpine-linux-musleabihf/bin/ld: cannot find -lsystemd
    collect2: error: ld returned 1 exit status
    error: command '/usr/bin/gcc' failed with exit code 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-609f_olx/systemd_1c62f33e593046258040f0de7f15e1c0/setup.py'"'"'; __file__='"'"'/tmp/pip-install-609f_olx/systemd_1c62f33e593046258040f0de7f15e1c0/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-5qozo0ru/install-record.txt --single-version-externally-managed --compile --install-headers /usr/include/python3.9/systemd Check the logs for full command output.
[root@RP4 RPiMS]#
[root@RP4 RPiMS]#

Thanks in advance.

darton commented 2 years ago

Hello Hasanaltin ! Thank you. RPiMS is developed and tested on RasbianOS, not tested on other distributions. The first error occurs because RPiMS was not properly started and therefore there is no config data in the redis database. The second error (RPiMS not running) is because you don't have the python3 pip systemd package installed. Unfortunately, I don't know the Alpine Linux distribution.