diff --git a/.dockerignore b/.dockerignore index 8d64ec916..e0503085d 100644 --- a/.dockerignore +++ b/.dockerignore @@ -11,6 +11,7 @@ !docker/ffprobe_wrapper !requirements.txt !requirements_test.txt +!requirements-3.9.txt !docker/opencv-python-headless-setup.py !docker/jetson-nano/opencv-tuple.patch !rootfs/ diff --git a/.gitignore b/.gitignore index 7fc7c575f..8ceebff62 100644 --- a/.gitignore +++ b/.gitignore @@ -73,6 +73,7 @@ !/requirements_ci.txt !/requirements_test.txt !/requirements.txt +!/requirements-3.9.txt !setup.py !manager.py diff --git a/azure-pipelines/.env b/azure-pipelines/.env index ac1064271..0029cda53 100644 --- a/azure-pipelines/.env +++ b/azure-pipelines/.env @@ -6,7 +6,7 @@ OPENVINO_VERSION="2024.0.0" FFMPEG_VERSION="5.1.2" DLIB_VERSION="19.24.4" SKLEARN_VERSION="1.2.2" -WHEELS_VERSION="1.6" +WHEELS_VERSION="1.7" S6_OVERLAY_VERSION="2.1.0.2" CMAKE_VERSION=3.20.0 MAKEFLAGS="-j 5" diff --git a/docker/Dockerfile b/docker/Dockerfile index 8d2305267..12311adba 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -60,6 +60,7 @@ FROM roflcoopter/${ARCH}-base:${BASE_VERSION} WORKDIR /src COPY --from=wheels /wheels /wheels +COPY --from=wheels /wheels-3.9 /wheels-3.9 ARG S6_OVERLAY_ARCH ARG S6_OVERLAY_VERSION @@ -135,10 +136,8 @@ RUN \ && echo "libedgetpu1-max libedgetpu/accepted-eula select true" | debconf-set-selections \ && apt-get -qq update && apt-get -qq install -y --no-install-recommends \ libedgetpu1-max \ - && python3.9 -m pip install \ - --extra-index-url https://google-coral.github.io/py-repo/ \ - --extra-index-url https://www.piwheels.org/simple \ - pycoral~=2.0 \ + && python3.9 -m pip install install /wheels-3.9/*.whl \ + && rm -r /wheels-3.9 \ \ && chmod +x /tmp/s6-overlay-installer && /tmp/s6-overlay-installer / \ && apt-get autoremove -y \ diff --git a/docker/Dockerfile.wheels b/docker/Dockerfile.wheels index 4d51b2e47..a2f80fac1 100644 --- a/docker/Dockerfile.wheels +++ b/docker/Dockerfile.wheels @@ -20,6 +20,8 @@ RUN \ [ "$ARCH" = "aarch64" ] ; then echo "Crossbuilding!" && cross-build-start; fi RUN apt-get -yqq update && apt-get install -yq --no-install-recommends \ + software-properties-common \ + gnupg \ cmake \ curl \ python3 \ @@ -29,7 +31,15 @@ RUN apt-get -yqq update && apt-get install -yq --no-install-recommends \ python3-wheel \ libgirepository1.0-dev\ libcairo2-dev \ + # Install Python 3.9 if it doesn't exist + && if [ ! -f /usr/local/bin/python3.9 ]; then \ + add-apt-repository ppa:deadsnakes/ppa -y && \ + apt-get update && apt-get install -y --no-install-recommends \ + python3.9 \ + python3.9-distutils ; \ + fi \ && python3 -m pip install --upgrade pip \ + && python3.9 -m pip install --upgrade pip \ && apt-get autoremove -y && apt-get clean -y # Pip does not find our OpenCV built from source so we fake it here @@ -42,17 +52,23 @@ RUN echo "opencv-python-headless==$OPENCV_VERSION" >> /requirements.txt # We need to setup Rust compiler for bcrypt # A tmpfs is needed: https://github.com/rust-lang/cargo/issues/8719 +ADD requirements-3.9.txt requirements-3.9.txt RUN --mount=type=tmpfs,target=/root/.cargo curl https://sh.rustup.rs -sSf | bash -s -- -y \ && . $HOME/.cargo/env \ - && mkdir -p /wheels \ + && mkdir -p /wheels /wheels-3.9 \ && if [ "$ARCH" = "amd64" ] || [ "$ARCH" = "amd64-cuda" ]; then export PLATFORM="x86_64"; \ elif [ "$ARCH" = "armhf" ] || [ "$ARCH" = "rpi3" ]; then export PLATFORM="armv7l"; \ else export PLATFORM="$ARCH"; fi \ \ && python3 -m pip wheel --wheel-dir=/wheels --find-links=/wheels ${EXTRA_PIP_ARGS} /opencv-python-headless -r /requirements.txt \ + && python3.9 -m pip wheel \ + --extra-index-url https://google-coral.github.io/py-repo/ \ + --wheel-dir=/wheels-3.9 \ + ${EXTRA_PIP_ARGS} -r /requirements-3.9.txt \ \ - && ls -al /wheels/ + && ls -al /wheels/ /wheels-3.9/ FROM scratch COPY --from=build /wheels /wheels +COPY --from=build /wheels-3.9 /wheels-3.9 diff --git a/docker/jetson-nano/Dockerfile.wheels b/docker/jetson-nano/Dockerfile.wheels index 7f9afaf2a..b7e409265 100644 --- a/docker/jetson-nano/Dockerfile.wheels +++ b/docker/jetson-nano/Dockerfile.wheels @@ -4,6 +4,7 @@ ARG DLIB_VERSION ARG JETPACK_VERSION FROM roflcoopter/jetson-nano-dlib:${DLIB_VERSION} as dlib FROM roflcoopter/jetson-nano-python:${PYTHON_VERSION} as python +FROM roflcoopter/jetson-nano-python:3.9.19 as python-3.9.19 FROM balenalib/jetson-nano-ubuntu:${UBUNTU_VERSION}-build as qemu FROM nvcr.io/nvidia/l4t-base:r${JETPACK_VERSION} as build @@ -14,6 +15,7 @@ COPY --from=qemu /usr/bin/resin-xbuild /usr/bin/resin-xbuild COPY --from=dlib /wheels /wheels +COPY --from=python-3.9.19 /usr/local /usr/local/ COPY --from=python /usr/local /usr/local/ RUN \ cd /usr/local/bin && \ @@ -58,12 +60,19 @@ RUN sed -i "s/OPENCV_VERSION=/OPENCV_VERSION=\"$OPENCV_VERSION\"/" /opencv-pytho RUN echo "opencv-python-headless==$OPENCV_VERSION" >> /requirements.txt ADD requirements.txt requirements.txt +ADD requirements-3.9.txt requirements-3.9.txt RUN \ mkdir -p /wheels \ \ && python3 -m pip wheel --wheel-dir=/wheels --find-links=/wheels /opencv-python-headless -r /requirements.txt \ + && python3.9 -m pip wheel \ + --extra-index-url https://google-coral.github.io/py-repo/ \ + --wheel-dir=/wheels-3.9 \ + --find-links=/wheels ${EXTRA_PIP_ARGS} /opencv-python-headless -r /requirements-3.9.txt \ \ - && ls -al /wheels/ + && ls -al /wheels/ /wheels-3.9/ FROM scratch + COPY --from=build /wheels /wheels +COPY --from=build /wheels-3.9 /wheels-3.9 diff --git a/requirements-3.9.txt b/requirements-3.9.txt new file mode 100644 index 000000000..b111bade2 --- /dev/null +++ b/requirements-3.9.txt @@ -0,0 +1,2 @@ +numpy==1.26.4 +pycoral~=2.0 diff --git a/viseron/components/edgetpu/__init__.py b/viseron/components/edgetpu/__init__.py index ab348ac67..36bd622ca 100644 --- a/viseron/components/edgetpu/__init__.py +++ b/viseron/components/edgetpu/__init__.py @@ -258,7 +258,7 @@ def __init__(self, vis, config, domain) -> None: self._process_initialization_done = mp.Event() self._process_initialization_error = mp.Event() super().__init__(vis, f"{COMPONENT}.{domain}") - self._process_initialization_done.wait(10) + self._process_initialization_done.wait(30) if ( not self._process_initialization_done.is_set() or self._process_initialization_error.is_set()