home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.63k stars 29.93k forks source link

LIRC Integration Fails to Load after Failing to Self-Install its Dependencies #71177

Closed kaijk closed 2 years ago

kaijk commented 2 years ago

The problem

I'm attempting to blast IR commands from HA to my IR controlled devices, largely replicating the irsend example shown in the lirc integration page's documentation. irsend is the LIRC component that issues IR commands.

Including lirc: in configuration.yaml causes HA to attempt to install python-lirc==1.2.3.

Note the following from the lirc integration manifest: "requirements": ["python-lirc==1.2.3"]

Python-lirc installation fails and the LIRC integration cannot be loaded.

Please see logs below.

Note: I have lirc 0.10.1 installed in my RasPi Debian Buster environment. It works fine, but irsend is not available to the HA container due to missing lirc libraries that, perhaps, python-lirc used to install. So, HA cannot use a shell_command to directly or indirectly run irsend.

As a test, I docker exec'd into the HA container, symbolically linked irsend and ran it. A number of lirc libraries then report as missing. binding those libraries from the host to the container in my docker-compose file didn't help.

THANKS!

What version of Home Assistant Core has the issue?

2022.4.7

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

lirc

Link to integration documentation on our website

https://www.home-assistant.io/integrations/lirc/

Diagnostics information

No response

Example YAML snippet

configuration.yaml

lirc:

Anything in the logs that might be useful for us?

Testing configuration at /config
INFO:homeassistant.util.package:Attempting install of python-lirc==1.2.3
ERROR:homeassistant.util.package:Unable to install package python-lirc==1.2.3: error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [8 lines of output]
      running bdist_wheel
      running build
      running build_ext
      creating build
      creating build/temp.linux-armv7l-3.9
      creating build/temp.linux-armv7l-3.9/lirc
      gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fno-semantic-interposition -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/lirc/ -I/usr/local/include/python3.9 -c lirc/lirc.c -o build/temp.linux-armv7l-3.9/lirc/lirc.o
      error: command 'gcc' failed: No such file or directory
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for python-lirc
  error: subprocess-exited-with-error

  × Running setup.py install for python-lirc did not run successfully.
  │ exit code: 1
  ╰─> [10 lines of output]
      running install
      /usr/local/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_ext
      creating build
      creating build/temp.linux-armv7l-3.9
      creating build/temp.linux-armv7l-3.9/lirc
      gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fno-semantic-interposition -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/lirc/ -I/usr/local/include/python3.9 -c lirc/lirc.c -o build/temp.linux-armv7l-3.9/lirc/lirc.o
      error: command 'gcc' failed: No such file or directory
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> python-lirc

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
WARNING: You are using pip version 22.0.3; however, version 22.0.4 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.

Additional information

No response

probot-home-assistant[bot] commented 2 years ago

lirc documentation lirc source (message by IssueLinks)

kaijk commented 2 years ago

I looked at this a bit more.

  1. I created missing directory /usr/include/lirc/ within the HA container, although maybe this directory would be created by gcc.
  2. gcc itself is missing from HA's alpine OS. I added it with apk add gcc
  3. The python-lirc==1.2.3 installation process then gets a bit further, but fails when it cannot find <limits.h> to #include
  4. I then installed linux-headers (apk add linux-headers) and limits.h is now found at /usr/include/linux. However, that library is still not found during the build
  5. I then installed alpine-sdk by apk add alpine-sdk. This cleared the <limits.h> not found error.

However, now the build fails trying to #include "lirc/lirc_client.h" which is not found.

I don't know how to proceed from there, but I hope this is helpful.

Here's the relevant bit of the log:

  │ exit code: 1
  ╰─> [12 lines of output]
      running bdist_wheel
      running build
      running build_ext
      creating build
      creating build/temp.linux-armv7l-3.9
      creating build/temp.linux-armv7l-3.9/lirc
      gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fno-semantic-interposition -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/lirc/ -I/usr/local/include/python3.9 -c lirc/lirc.c -o build/temp.linux-armv7l-3.9/lirc/lirc.o
      lirc/lirc.c:276:10: fatal error: lirc/lirc_client.h: No such file or directory
        276 | #include "lirc/lirc_client.h"
            |          ^~~~~~~~~~~~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for python-lirc
  error: subprocess-exited-with-error

  × Running setup.py install for python-lirc did not run successfully.
  │ exit code: 1
  ╰─> [14 lines of output]
      running install
      /usr/local/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_ext
      creating build
      creating build/temp.linux-armv7l-3.9
      creating build/temp.linux-armv7l-3.9/lirc
      gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fno-semantic-interposition -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/lirc/ -I/usr/local/include/python3.9 -c lirc/lirc.c -o build/temp.linux-armv7l-3.9/lirc/lirc.o
      lirc/lirc.c:276:10: fatal error: lirc/lirc_client.h: No such file or directory
        276 | #include "lirc/lirc_client.h"
            |          ^~~~~~~~~~~~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> python-lirc