Python2.7 error in docker "homeassistant/home-assistant:latest"

Hi,

I’m running the docker home-assistant image on my arm odroid xu4 - besides that repo not having a ‘latest’ tag when I looked into it deployment and configuration was pretty straight forward and its working well.

Now - i also tried to deploy an offical docker image on x86 - that one runs into problems that I cannot explain to myself. I read that the error indicated a python 2.7 issue (I shall run python 3.5+) - however as I’m not touching the image I’m not sure how come?

I tried with latest as well as an elder 0.68.0 - same result.

As both servers also run for different purposes I didn’t look inside hass.io deployment, I believe a proper docker image should run with Dockerfile + docker-compose.yml w/o further host machine setup. That is workign on armhf - so I’m assuming I’m overseeing something here.

docker logs iot-home-assistant

Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 151, in _run_module_as_main
    mod_name, loader, code, fname = _get_module_details(mod_name)
  File "/usr/lib/python2.7/runpy.py", line 109, in _get_module_details
    return _get_module_details(pkg_main_name)
  File "/usr/lib/python2.7/runpy.py", line 113, in _get_module_details
    code = loader.get_code(mod_name)
  File "/usr/lib/python2.7/pkgutil.py", line 283, in get_code
    self.code = compile(source, self.filename, 'exec')
  File "/usr/src/app/homeassistant/__main__.py", line 33
    def validate_python() -> None:
                          ^
SyntaxError: invalid syntax

cat docker-compose.yml

  version: '3'
  services:
    homeassistant:
      container_name: iot-home-assistant
      image: homeassistant/home-assistant
      volumes:
        - ./config/config:/config
        - ./config/usr/local/bin:/usr/local/bin
        - /etc/localtime:/etc/localtime:ro
      network_mode: host

This line will map python version from host to the container.
omit that and it should start

1 Like

Easy answer - right to the spot, THANKS.

/usr/local/bin is typically quite empty on the machines, so i tend to put my ‘custom scripts’ here and mapped that so i don’t loose them when the container dies. I see that’s a bad idea now.

Thanks again,
Alex