I used --net=host
.
Try to run /usr/local/bin/python /usr/local/lib/python3.6/site-packages/speedtest.py --server 5669
from inside your docker container.
Not giving the --simple
argument should give you more information about what’s the error. (see here for more information).
To connect to the docker, use this:
docker exec -it CONTAINER-NAME bash
While you’re at it, try to run /usr/local/bin/python --version
from inside the container to see if the python command is associated with Python 3.6 (or 3.6.1)
The speed test python library that HA uses is only compatible with python 2.6-3.5 so that is why it is complaining. Not sure how to fix but I’ve asked in the dev chat.
I use Python 3.6.1 and the library work fine. My speed is still refreshed like expected.
I know the package index page show a compatibility up to Python 3.5 but I assume it’s only because they didn’t test it with Python 3.6.
# /usr/local/bin/python /usr/local/lib/python3.6/site-packages/speedtest.py --server 5669
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/speedtest.py", line 19, in <module>
import re
File "/usr/local/lib/python3.6/re.py", line 142, in <module>
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
# /usr/local/bin/python --version
Python 3.6.1
Doesn’t work for me.
I get exactly the same result as keatontaylor when running the commands inside the Docker Container
Receiving similar errors since the upgrade to .45 with speedtest no longer functioning, running docker on syno nas.
You could try with a new container and with python 3.5 to see if that solve the problem.
anyone have luck getting this fixed wit update .46?
Nope, it’s still broken.
So after some googling it looks like the issue is an incompatibility with the enum34 library and python 3.6. Here is what I did to fix my issue, however it may break other things so please use at your own risk! So I connected to my docker container using toullloup’s instructions:
docker exec -it CONTAINER-NAME bash
After connecting, run
pip freeze
see that enum34==1.1.6 or similar is in the dependencies list
pip uninstall enum34
restart the docker container. This fixed my issue, however removing dependencies like this can have unintended consequences, so be careful. I will try to spend some more time this week looking into this to see if I can suggest a long term fix for the docker image for future releases, but don’t know enough about how HA works under the hood for that yet. Hope this helps!
I never had problem running SpeedTest in my container (Python 3.6.1), I also see that I don’t have enum34 installed, I only have:
enum-compat==0.0.2
pip freeze
result:
aiohttp==2.0.7
appdirs==1.4.3
astral==1.4
async-timeout==1.2.1
chardet==3.0.2
enum-compat==0.0.2
homeassistant==0.45.0
Jinja2==2.9.6
MarkupSafe==1.0
multidict==2.1.5
mysqlclient==1.3.10
netdisco==1.0.0rc3
netifaces==0.10.4
packaging==16.8
pyparsing==2.2.0
pytz==2017.2
PyYAML==3.12
requests==2.14.2
six==1.10.0
typing==3.6.1
voluptuous==0.10.5
yarl==0.10.2
zeroconf==0.19.0
removing enum34 worked for me. Haven’t seen anything acting up with that dependency removed yet.
I haven’t had any issues yet as well. It’s strange that @touliloup did not have the dependency, I don’t know enough about how docker works to understand that, but it would seem that the dependency is not necessary and is just left over from previous versions.
I’ve created my own Docker container, I don’t like the main docker container. It just install too much dependencies and unnecessary script/fix (for me).
My Docker container simply proceed to a standard installation of home-assistant.
Here is the Dockerfile I use:
FROM python:3.6
MAINTAINER Touli Loup <[email protected]>
VOLUME /config
RUN python3 --version
RUN echo "deb http://ftp.debian.org/debian jessie-backports main" >> /etc/apt/sources.list
RUN apt-get update && apt-get upgrade -y && apt-get install -y net-tools nmap git && apt-get install -y certbot -t jessie-backports
RUN pip3 install --upgrade mysqlclient
RUN pip3 install netdisco==1.0.0rc3
RUN pip3 install --upgrade homeassistant
COPY ./docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
docker-entrypoint.sh:
#!/bin/bash
certbot certonly --standalone -q --agree-tos --preferred-challenges http-01 --email [email protected] -d blablabla.duckdns.org
hass --config /config
build command:
docker build --no-cache -t hass/hass:latest .
run command:
docker run -d --name="home-assistant" \
--restart=unless-stopped \
-v $(pwd)/config:/config \
-v /etc/localtime:/etc/localtime:ro \
--net=host \
--log-opt max-size=10m \
hass/hass
Ah that makes sense. It definitely seems that the enum34 dependency should be removed then.
Yes, I guess it’s a transitive dependency as there is no direct reference to it in the github repo.
And why does the github docker always install every dependencies? The missing one will be installed by hass on startup, no?
I understand the point if it’s only a development container, it allow to detect dependencies conflict faster, but it’s not appropriate for production usage.
It’s really a lot of dependencies, 275!!
https://raw.githubusercontent.com/home-assistant/home-assistant/dev/requirements_all.txt
Agreed, seems like overkill to install all dependencies, especially ones that are not compatible with the python version that is being used!
I’m having this issue on a 2 week old installation of hass.io, now updated to 0.55.2
2017-10-18 18:00:11 ERROR (SyncWorker_7) [homeassistant.components.sensor.speedtest] Error executing speedtest: Command '['/usr/bin/python3', '/usr/lib/python3.6/site-packages/speedtest.py', '--simple', '--server', '2229']' returned non-zero exit status 1.
Connect into the container and run the container to see what exit code is return and see what the speedtest script complain about.