I would like to make an addon with Python, hassio, mariadb-client etc on my RP4
For my project I must use the python mip module, but that module makes use of a binary and there is only a binary (libCbcSolver.so) shipped with the module for amd64 architecture.
I tried to compile that binary on in a Alpine container on my RP4, but that didn’t succeed because a number of the necessary libraries are not available in the apk-store.
I succeeded in compilation of the library in a debian container.
So i must make an addon based on an debian image (preferable with Python 3.10 already present)
I tried it with this. Docker
ARG BUILD_FROM
FROM ${BUILD_FROM}
# Set shell
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN \
apt-get update -y \
apt-get upgrade -y
RUN \
apt-get install python3 -y \
apt-get install python3-pip -y\
\
pip3 install mip
# Copy data for add-on
COPY run.sh /
RUN chmod a+x /run.sh
CMD [ "/run.sh" ]
---
name: Day Ahead Test
version: "1.0.1"
slug: day-ahead-test
description: Docker used by Home Assistant Community Add-ons for day ahead optimalisations
arch:
- aarch64
- amd64
- armhf
- armv7
- i386
During Install I get the error : “manifest unknown”
I have two questions:
Hi, I would like to thank you very much for your question and your answer. You have helped me a lot on my way to a first (debain) addon
Now that I’ve read more about the topic and looked at the “build.yaml” from for example the https://github.com/hassio-addons/addon-vscode project, I know how to set up the “Dockerfile” and the “build.yaml”.
I will also use “stable” instead of a fixed version. I had hoped that there would simply be “latest”, but “stable” is also okay
(fun fact: I only created an account for this comment )
Hey Matthew,
From version 3.11 and up of Pyhton pip only works well when you set it up in a virtual environment.
This is how I got it working (a pice of my Dockerfile):
#install python en pip
RUN apt-get install python3 -y\
python3-pip -y\
python3-venv -y
WORKDIR /root
ENV VIRTUAL_ENV=/root/venv/day_ahead
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
COPY requirements.txt /tmp/
RUN pip3 install -r /tmp/requirements.txt