Hi, curious if someone could point me in the right direction. I can’t track down the reason I’m seeing a module not found error in my Python script.
The project builds and deploys successfully, but once installed the container errors out with ModuleNotFoundError: No module named 'daiquiri'
and reboots continuously.
I’ve used this exact setup in the past, save for the actual python code. Also, as a test, I’ve sent up an empty python script without the requirements installed, ssh’d into the container and manually installed the daiquiri script and ran the script no problem. It seems to be something in the Dockerfile not properly doing the pip install requirements step, but I can’t pinpoint it.
Here’s my setup:
HOST OS VERSION: balenaOS 2.80.5+rev1, production
SUPERVISOR VERSION: 12.8.7
Dockerfile.template
FROM balenalib/%%BALENA_MACHINE_NAME%%-debian-python:3-build as build
RUN mkdir /install
WORKDIR /install
COPY requirements.txt /requirements.txt
ENV PATH=/root/.local/bin:$PATH
RUN pip3 install --user -r /requirements.txt
FROM balenalib/%%BALENA_MACHINE_NAME%%-debian-python:3-run
COPY --from=build /root/.local /root/.local
ENV PATH=/root/.local/bin:$PATH
RUN install_packages jq iw
WORKDIR /workdir
COPY . .
ENV UDEV=1
CMD ["/bin/sh","./start.sh"]
requirements.txt
pyserial
daiquiri
python-json-logger
schedule
start.sh
#!/bin/bash
set -e
python3 main.py
main.py
from subprocess import Popen, PIPE, STDOUT
import time
import sys
import functools
import logging
import daiquiri
import schedule
rest of python script....