core: ADS integration Exec format error on latest docker

The problem

When starting the latest docker on a raspberry pi 4 the ADS integration seems to be broken, sounds like a build problem targeting the wrong architecture.

I’ve had a couple of issues (like MySql 8 suddenly requiring the mysql_native_password plugin instead of the previously already working caching_sha2_password) which I was able to work around but this one is blocking for me as it completely breaks the integration with my Beckhoff which is at the heart of my home control.

Labels provided through this image are:

"io.hass.arch": "armv7",
"io.hass.base.arch": "armv7",
"io.hass.base.image": "homeassistant/armv7-base:3.16",
"io.hass.base.name": "python",
"io.hass.base.version": "2022.06.0",
"io.hass.machine": "raspberrypi4",
"io.hass.type": "core",
"io.hass.version": "2022.7.0.dev20220627",
"org.opencontainers.image.authors": "The Home Assistant Authors",
"org.opencontainers.image.created": "2022-06-27 03:32:54+00:00",
"org.opencontainers.image.description": "Open-source home automation platform running on Python 3",
"org.opencontainers.image.documentation": "https://www.home-assistant.io/docs/",
"org.opencontainers.image.licenses": "Apache License 2.0",
"org.opencontainers.image.source": "https://github.com/home-assistant/core",
"org.opencontainers.image.title": "Home Assistant",
"org.opencontainers.image.url": "https://www.home-assistant.io/",
"org.opencontainers.image.version": "2022.7.0.dev20220627"

Labels of the image that is still working for me:

"io.hass.arch": "armv7",
"io.hass.base.arch": "armv7",
"io.hass.base.image": "homeassistant/armv7-base:3.14",
"io.hass.base.name": "python",
"io.hass.base.version": "2022.02.0",
"io.hass.machine": "raspberrypi4",
"io.hass.type": "core",
"io.hass.version": "2022.6.0.dev20220506",
"org.opencontainers.image.authors": "The Home Assistant Authors",
"org.opencontainers.image.created": "2022-05-06 03:33:40+00:00",
"org.opencontainers.image.description": "Open-source home automation platform running on Python 3",
"org.opencontainers.image.documentation": "https://www.home-assistant.io/docs/",
"org.opencontainers.image.licenses": "Apache License 2.0",
"org.opencontainers.image.source": "https://github.com/home-assistant/core",
"org.opencontainers.image.title": "Home Assistant",
"org.opencontainers.image.url": "https://www.home-assistant.io/",
"org.opencontainers.image.version": "2022.6.0.dev20220506"

What version of Home Assistant Core has the issue?

core-2022.7.0.dev20220627

What was the last working version of Home Assistant Core?

core-2022.6.0.dev20220506

What type of installation are you running?

Home Assistant Container

Integration causing the issue

ADS

Link to integration documentation on our website

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

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

These is just one snippet of the many similar issues reported, figured this stacktrace is sufficient:

ERROR (MainThread) [homeassistant.config] Platform error: light
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/loader.py", line 618, in get_platform
    cache[full_name] = self._import_platform(platform_name)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 635, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
  File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/src/homeassistant/homeassistant/components/ads/__init__.py", line 10, in <module>
    import pyads
  File "/usr/local/lib/python3.10/site-packages/pyads/__init__.py", line 12, in <module>
    from .ads import open_port, close_port, get_local_address, read_state, \
  File "/usr/local/lib/python3.10/site-packages/pyads/ads.py", line 18, in <module>
    from .pyads_ex import (
  File "/usr/local/lib/python3.10/site-packages/pyads/pyads_ex.py", line 82, in <module>
    _adsDLL = ctypes.CDLL(adslib)
  File "/usr/local/lib/python3.10/ctypes/__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: Error loading shared library /usr/local/lib/python3.10/site-packages/pyads/adslib.so: Exec format error

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config.py", line 877, in async_process_component_config
    platform = p_integration.get_platform(domain)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 627, in get_platform
    raise ImportError(
ImportError: Exception importing homeassistant.components.ads.light


### Additional information

_No response_

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 1
  • Comments: 74

Most upvoted comments

Just making an update here to let you know I might have found the reason and solution. See https://github.com/home-assistant/wheels/issues/458#issuecomment-1763185835 and https://github.com/stlehmann/pyads/pull/363

The core ads library version will need to be bumped when the pull request has been merged.

I updates right now to 2022.12.9 and the bug is still there. Only the mentioned workaround above works, but we will see how long.

Maybe somebody with the knowledge about the pylib generation can fix this finally? That would be great!

I’ve not tried the core installation but according to the information it is using the python venv method. You could identify the locations python is using by doing python -m site or python -m site --user-site and go through the listed directories to find the pyads site-package. Once you’ve found this you could copy it (you could use scp or rsync for this if using a terminal and the installation is remote) to your local system and identify the location of the pyads site-package on the new installation and move them there.

Thanks for the hints, but this doesn’t worked for me either.

I got the workaround now working with the Add-on: SSH & Web Terminal.

With this Add-on I could connect to HassOS via SSH and use the “docker” workaround described above.

Thanks a lot guys! hopefully this will be fixed soon!

Pip is indeed installed but in the container there is no ‘make’ so installation of pyads was failing

In the mean time, I’ve installed an older version of homeassistant ( not yellow specific ) and did the quick & dirty trick… after restart it was working again.

I’ll try to find some time to investigate that breadcrumb this evening or the coming days, that might indeed be an interesting path to explore! 👍 (or if someone is already doing so, by all means let it be known so we’re not both spending time 😉)

There hasn’t been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Yes, i managed to kopie the files to a folder on my laptop, using Winscp. copied them back to the python3.10 folder. ADS is working now. Many many thanks to you guys…

@Jeroen45 I have the same issue, can’t log with enough rights, so neither python commands nor python folder is available: anyhow I fixed my setup with the docker commands just like @C0D3-IT was suggesting as originally posted by @jandeschuttere (by the way, thank you very much!)

I am not able to find this location : /usr/local/lib/python3.9/site-packages/pyads Can some one help me, Im running HassIO I do have: /usr/local/lib but no python folder

I got the same issue at first. I needed to use for the ssh connection the SSH & Web Terminal Addon with disabled protection mode. After that I could locate the directory Bildschirmfoto 2022-09-15 um 13 24 24