Hi.
I’m trying to develop an addon starting from my python script. It requires just python and paho-mqtt.
The script works fine on my linux machine, since a week, so i started to move the script into an addon for let it run directly on hass.
I follow the template and make a Dockerfile, run.sh etc.
The installation fail with this error:
1/13 : ARG BUILD_FROM
Step 2/13 : FROM $BUILD_FROM
—> 33c8dcdbe590
Step 3/13 : ENV LANG C.UTF-8
—> Using cache
—> b9b943a75171
Step 4/13 : SHELL [“/bin/bash”, “-o”, “pipefail”, “-c”]
—> Using cache
—> 65973fae1858
Step 5/13 : RUN apk add --no-cache python3 py3-pip && pip3 install paho-mqtt COPY run.sh /
—> Running in c7ffbb59e5f0
fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/main/aarch64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/community/aarch64/APKINDEX.tar.gz
(1/21) Installing libbz2 (1.0.8-r1)
(2/21) Installing expat (2.4.9-r0)
(3/21) Installing libffi (3.4.2-r1)
(4/21) Installing gdbm (1.23-r0)
(5/21) Installing libgcc (11.2.1_git20220219-r2)
(6/21) Installing libstdc++ (11.2.1_git20220219-r2)
(7/21) Installing mpdecimal (2.5.1-r1)
(8/21) Installing sqlite-libs (3.38.5-r0)
(9/21) Installing python3 (3.10.5-r0)
(10/21) Installing py3-contextlib2 (21.6.0-r2)
(11/21) Installing py3-tomli (2.0.1-r1)
(12/21) Installing py3-pep517 (0.12.0-r2)
(13/21) Installing py3-six (1.16.0-r1)
(14/21) Installing py3-retrying (1.3.3-r3)
(15/21) Installing py3-appdirs (1.4.4-r3)
(16/21) Installing py3-more-itertools (8.13.0-r0)
(17/21) Installing py3-ordered-set (4.0.2-r3)
(18/21) Installing py3-parsing (2.4.7-r3)
(19/21) Installing py3-packaging (21.3-r0)
(20/21) Installing py3-setuptools (59.4.0-r0)
(21/21) Installing py3-pip (22.1.1-r0)
Executing busybox-1.35.0-r17.trigger
OK: 91 MiB in 61 packages
ERROR: Directory ‘/’ is not installable. Neither ‘setup.py’ nor ‘pyproject.toml’ found.
Removing intermediate container c7ffbb59e5f0`
So the problem, if i inderstood, is from the Dockerfile:
> ARG BUILD_FROM
> FROM $BUILD_FROM
>
> ENV LANG C.UTF-8
>
> SHELL ["/bin/bash", "-o", "pipefail", "-c"]
>
> # Install requirements for add-on
> RUN \
> apk add --no-cache \
> python3 \
> py3-pip \
> \
> && pip3 install paho-mqtt \
>
> # Copy data for add-on
> COPY run.sh /
> COPY pws_server.py /
> RUN chmod a+x /run.sh
>
> CMD [ "/run.sh" ]
Someone can help me?
HasQT
(Has)
September 23, 2022, 5:05pm
2
Copy rootfs is what you want. It will copy the rootfs files from your repo.
Mine is down below… Although mine isn’t necessarily great…
Hi @HasQT thanks for your support. I tried adding COPY root / and also to add and remove mine COPY commands, same error:
> RUN apk add --no-cache python3 py3-pip && pip3 install paho-mqtt COPY rootfs /
> [WARNING]: Empty continuation lines will become errors in a future release.
>
> Step 1/12 : ARG BUILD_FROM
> Step 2/12 : FROM $BUILD_FROM
> ---> 33c8dcdbe590
> Step 3/12 : ENV LANG C.UTF-8
> ---> Using cache
> ---> b9b943a75171
> Step 4/12 : SHELL ["/bin/bash", "-o", "pipefail", "-c"]
> ---> Using cache
> ---> 65973fae1858
> Step 5/12 : RUN apk add --no-cache python3 py3-pip && pip3 install paho-mqtt COPY rootfs /
> ---> Running in 660b593ac41f
> fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/main/aarch64/APKINDEX.tar.gz
> fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/community/aarch64/APKINDEX.tar.gz
> (1/21) Installing libbz2 (1.0.8-r1)
> (2/21) Installing expat (2.4.9-r0)
> (3/21) Installing libffi (3.4.2-r1)
> (4/21) Installing gdbm (1.23-r0)
> (5/21) Installing libgcc (11.2.1_git20220219-r2)
> (6/21) Installing libstdc++ (11.2.1_git20220219-r2)
> (7/21) Installing mpdecimal (2.5.1-r1)
> (8/21) Installing sqlite-libs (3.38.5-r0)
> (9/21) Installing python3 (3.10.5-r0)
> (10/21) Installing py3-contextlib2 (21.6.0-r2)
> (11/21) Installing py3-tomli (2.0.1-r1)
> (12/21) Installing py3-pep517 (0.12.0-r2)
> (13/21) Installing py3-six (1.16.0-r1)
> (14/21) Installing py3-retrying (1.3.3-r3)
> (15/21) Installing py3-appdirs (1.4.4-r3)
> (16/21) Installing py3-more-itertools (8.13.0-r0)
> (17/21) Installing py3-ordered-set (4.0.2-r3)
> (18/21) Installing py3-parsing (2.4.7-r3)
> (19/21) Installing py3-packaging (21.3-r0)
> (20/21) Installing py3-setuptools (59.4.0-r0)
> (21/21) Installing py3-pip (22.1.1-r0)
> Executing busybox-1.35.0-r17.trigger
> OK: 91 MiB in 61 packages
> ERROR: Directory '/' is not installable. Neither 'setup.py' nor 'pyproject.toml' found.
>
> Removing intermediate container 660b593ac41f
I guess it would probably help if you shared more of your addon. Is there a repo somewhere? Or at the very least what’s in your build.yaml
so its clear how $BUILD_FROM
is being set.
Also if you aren’t using it there’s an alpine addon base image that comes with python and pip already installed here . If you use that as your base all you have to do is install paho-mqtt via pip.
2 Likes
HasQT
(Has)
September 23, 2022, 11:33pm
5
&& pip3 install paho-mqtt \
should be
&& pip3 install paho-mqtt
you don’t need the \ as it is the last command
Yep, this let the addon to install. Thanks, now i try to make it works and make the configuration interactive.
2 Likes