From d808ac0aab49f5e71dbb6af06dc3a53ea71c9450 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Wed, 20 Nov 2024 11:37:16 -0700 Subject: [PATCH 01/16] Change base image --- docker/main/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/main/Dockerfile b/docker/main/Dockerfile index 9d2f442f08..02c304823b 100644 --- a/docker/main/Dockerfile +++ b/docker/main/Dockerfile @@ -3,12 +3,12 @@ # https://askubuntu.com/questions/972516/debian-frontend-environment-variable ARG DEBIAN_FRONTEND=noninteractive -ARG BASE_IMAGE=debian:11 -ARG SLIM_BASE=debian:11-slim +ARG BASE_IMAGE=debian:12 +ARG SLIM_BASE=debian:12-slim FROM ${BASE_IMAGE} AS base -FROM --platform=${BUILDPLATFORM} debian:11 AS base_host +FROM --platform=${BUILDPLATFORM} debian:12 AS base_host FROM ${SLIM_BASE} AS slim-base From 459aa410da00f156fbad8ff147c4144663d01ae3 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Wed, 20 Nov 2024 11:42:34 -0700 Subject: [PATCH 02/16] Update python --- docker/main/Dockerfile | 8 ++++---- docker/main/install_deps.sh | 12 ++++-------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/docker/main/Dockerfile b/docker/main/Dockerfile index 02c304823b..9d9e8e0933 100644 --- a/docker/main/Dockerfile +++ b/docker/main/Dockerfile @@ -149,8 +149,8 @@ RUN apt-get -qq update \ tee /etc/apt/sources.list.d/debian-bullseye-nonfree.list \ && apt-get -qq update \ && apt-get -qq install -y \ - python3.9 \ - python3.9-dev \ + python3.10 \ + python3.10-dev \ # opencv dependencies build-essential cmake git pkg-config libgtk-3-dev \ libavcodec-dev libavformat-dev libswscale-dev libv4l-dev \ @@ -164,8 +164,8 @@ RUN apt-get -qq update \ gcc gfortran libopenblas-dev liblapack-dev && \ rm -rf /var/lib/apt/lists/* -# Ensure python3 defaults to python3.9 -RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 +# Ensure python3 defaults to python3.10 +RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 RUN wget -q https://bootstrap.pypa.io/get-pip.py -O get-pip.py \ && python3 get-pip.py "pip" diff --git a/docker/main/install_deps.sh b/docker/main/install_deps.sh index af349fd84d..adb175c50c 100755 --- a/docker/main/install_deps.sh +++ b/docker/main/install_deps.sh @@ -11,7 +11,7 @@ apt-get -qq install --no-install-recommends -y \ lbzip2 \ procps vainfo \ unzip locales tzdata libxml2 xz-utils \ - python3.9 \ + python3.10 \ python3-pip \ curl \ lsof \ @@ -20,8 +20,8 @@ apt-get -qq install --no-install-recommends -y \ libgl1 \ libglib2.0-0 -# ensure python3 defaults to python3.9 -update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 +# ensure python3 defaults to python3.10 +update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 mkdir -p -m 600 /root/.gnupg @@ -67,9 +67,7 @@ fi # arch specific packages if [[ "${TARGETARCH}" == "amd64" ]]; then - # use debian bookworm for amd / intel-i965 driver packages - echo 'deb https://deb.debian.org/debian bookworm main contrib non-free' >/etc/apt/sources.list.d/debian-bookworm.list - apt-get -qq update + # install amd / intel-i965 driver packages apt-get -qq install --no-install-recommends --no-install-suggests -y \ i965-va-driver intel-gpu-tools onevpl-tools \ libva-drm2 \ @@ -82,8 +80,6 @@ if [[ "${TARGETARCH}" == "amd64" ]]; then # intel packages use zst compression so we need to update dpkg apt-get install -y dpkg - rm -f /etc/apt/sources.list.d/debian-bookworm.list - # use intel apt intel packages wget -qO - https://repositories.intel.com/gpu/intel-graphics.key | gpg --yes --dearmor --output /usr/share/keyrings/intel-graphics.gpg echo "deb [arch=amd64 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/gpu/ubuntu jammy client" | tee /etc/apt/sources.list.d/intel-gpu-jammy.list From dcb4d4421a25de39f20c395ce3c33b3b38f56848 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Wed, 20 Nov 2024 11:55:49 -0700 Subject: [PATCH 03/16] Update coral library --- docker/main/install_deps.sh | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/docker/main/install_deps.sh b/docker/main/install_deps.sh index adb175c50c..4b3f8742c0 100755 --- a/docker/main/install_deps.sh +++ b/docker/main/install_deps.sh @@ -37,9 +37,23 @@ if grep -q "Debian" /etc/issue; then fi # coral drivers -apt-get -qq update -apt-get -qq install --no-install-recommends --no-install-suggests -y \ - libedgetpu1-max python3-tflite-runtime python3-pycoral +mkdir /tmp/ + +# install coral runtime +wget -q -O /tmp/libedgetpu1-max.deb "https://github.com/feranick/libedgetpu/releases/download/16.0TF2.17.0-1/libedgetpu1-max_16.0tf2.17.0-1.bookworm_${TARGETARCH}.deb" +dpkg -i /tmp/libedgetpu1-max.deb +rm /tmp/libedgetpu1-max.deb + +# install python3 & tflite runtime +if [[ "${TARGETARCH}" == "amd64" ]]; then + wget -qO /deps/wheels/tflite_runtime-2.17.0-cp310-cp310-linux_x86_64.whl https://github.com/feranick/TFlite-builds/releases/download/v2.17.0/tflite_runtime-2.17.0-cp310-cp310-linux_x86_64.whl + wget -qO /deps/wheels/pycoral-2.0.2-cp310-cp310-linux_x86_64.whl https://github.com/feranick/pycoral/releases/download/2.0.2TF2.17.0/pycoral-2.0.2-cp310-cp310-linux_x86_64.whl +fi + +if [[ "${TARGETARCH}" == "arm64" ]]; then + wget -qO /deps/wheels/tflite_runtime-2.17.0-cp310-cp310-linux_aarch64.whl https://github.com/feranick/TFlite-builds/releases/download/v2.17.0/tflite_runtime-2.17.0-cp310-cp310-linux_aarch64.whl + wget -qO /deps/wheels/pycoral-2.0.2-cp310-cp310-linux_aarch64.whl https://github.com/feranick/pycoral/releases/download/2.0.2TF2.17.0/pycoral-2.0.2-cp310-cp310-linux_aarch64.whl +fi # btbn-ffmpeg -> amd64 if [[ "${TARGETARCH}" == "amd64" ]]; then From acf61ab1bd5635fe8147e7047587e1630cbf4c32 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Wed, 20 Nov 2024 12:47:04 -0700 Subject: [PATCH 04/16] Fix source file --- docker/main/build_nginx.sh | 3 +-- docker/main/build_sqlite_vec.sh | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/docker/main/build_nginx.sh b/docker/main/build_nginx.sh index e97f6bbe0c..505b19071e 100755 --- a/docker/main/build_nginx.sh +++ b/docker/main/build_nginx.sh @@ -8,8 +8,7 @@ SECURE_TOKEN_MODULE_VERSION="1.5" SET_MISC_MODULE_VERSION="v0.33" NGX_DEVEL_KIT_VERSION="v0.3.3" -cp /etc/apt/sources.list /etc/apt/sources.list.d/sources-src.list -sed -i 's|deb http|deb-src http|g' /etc/apt/sources.list.d/sources-src.list +sed -i '/^Types:/s/deb/& deb-src/' /etc/apt/sources.list.d/debian.sources apt-get update apt-get -yqq build-dep nginx diff --git a/docker/main/build_sqlite_vec.sh b/docker/main/build_sqlite_vec.sh index 3dc28bcbf7..4893a0db19 100755 --- a/docker/main/build_sqlite_vec.sh +++ b/docker/main/build_sqlite_vec.sh @@ -4,8 +4,7 @@ set -euxo pipefail SQLITE_VEC_VERSION="0.1.3" -cp /etc/apt/sources.list /etc/apt/sources.list.d/sources-src.list -sed -i 's|deb http|deb-src http|g' /etc/apt/sources.list.d/sources-src.list +sed -i '/^Types:/s/deb/& deb-src/' /etc/apt/sources.list.d/debian.sources apt-get update apt-get -yqq build-dep sqlite3 gettext git From b0872b7aee27eedf9240f93f5e19b450ebf0e0b4 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Wed, 20 Nov 2024 13:24:25 -0700 Subject: [PATCH 05/16] Install correct apt packages --- docker/main/Dockerfile | 16 ++++++---------- docker/main/install_deps.sh | 13 +++++-------- docker/rpi/install_deps.sh | 2 +- 3 files changed, 12 insertions(+), 19 deletions(-) diff --git a/docker/main/Dockerfile b/docker/main/Dockerfile index 9d9e8e0933..99f660c5ed 100644 --- a/docker/main/Dockerfile +++ b/docker/main/Dockerfile @@ -143,20 +143,19 @@ RUN apt-get -qq update \ gnupg \ wget \ # the key fingerprint can be obtained from https://ftp-master.debian.org/keys.html - && wget -qO- "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xA4285295FC7B1A81600062A9605C66F00D6C9793" | \ - gpg --dearmor > /usr/share/keyrings/debian-archive-bullseye-stable.gpg \ - && echo "deb [signed-by=/usr/share/keyrings/debian-archive-bullseye-stable.gpg] http://deb.debian.org/debian bullseye main contrib non-free" | \ - tee /etc/apt/sources.list.d/debian-bullseye-nonfree.list \ + && wget -qO- "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x4D64FEC119C2029067D6E791F8D2585B8783D481" | \ + gpg --dearmor > /usr/share/keyrings/debian-archive-bookworm-stable.gpg \ + && sed -i 's|/usr/share/keyrings/debian-archive-keyring.gpg|/usr/share/keyrings/debian-archive-bookworm-stable.gpg|g' /etc/apt/sources.list.d/debian.sources \ && apt-get -qq update \ && apt-get -qq install -y \ - python3.10 \ - python3.10-dev \ + python3 \ + python3-dev \ # opencv dependencies build-essential cmake git pkg-config libgtk-3-dev \ libavcodec-dev libavformat-dev libswscale-dev libv4l-dev \ libxvidcore-dev libx264-dev libjpeg-dev libpng-dev libtiff-dev \ gfortran openexr libatlas-base-dev libssl-dev\ - libtbb2 libtbb-dev libdc1394-22-dev libopenexr-dev \ + libtbbmalloc2 libtbb-dev libdc1394-dev libopenexr-dev \ libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev \ # sqlite3 dependencies tclsh \ @@ -164,9 +163,6 @@ RUN apt-get -qq update \ gcc gfortran libopenblas-dev liblapack-dev && \ rm -rf /var/lib/apt/lists/* -# Ensure python3 defaults to python3.10 -RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 - RUN wget -q https://bootstrap.pypa.io/get-pip.py -O get-pip.py \ && python3 get-pip.py "pip" diff --git a/docker/main/install_deps.sh b/docker/main/install_deps.sh index 4b3f8742c0..ff8e1003e7 100755 --- a/docker/main/install_deps.sh +++ b/docker/main/install_deps.sh @@ -11,7 +11,7 @@ apt-get -qq install --no-install-recommends -y \ lbzip2 \ procps vainfo \ unzip locales tzdata libxml2 xz-utils \ - python3.10 \ + python3 \ python3-pip \ curl \ lsof \ @@ -20,9 +20,6 @@ apt-get -qq install --no-install-recommends -y \ libgl1 \ libglib2.0-0 -# ensure python3 defaults to python3.10 -update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 - mkdir -p -m 600 /root/.gnupg # add coral repo @@ -46,13 +43,13 @@ rm /tmp/libedgetpu1-max.deb # install python3 & tflite runtime if [[ "${TARGETARCH}" == "amd64" ]]; then - wget -qO /deps/wheels/tflite_runtime-2.17.0-cp310-cp310-linux_x86_64.whl https://github.com/feranick/TFlite-builds/releases/download/v2.17.0/tflite_runtime-2.17.0-cp310-cp310-linux_x86_64.whl - wget -qO /deps/wheels/pycoral-2.0.2-cp310-cp310-linux_x86_64.whl https://github.com/feranick/pycoral/releases/download/2.0.2TF2.17.0/pycoral-2.0.2-cp310-cp310-linux_x86_64.whl + wget -qO /deps/wheels/tflite_runtime-2.17.0-cp311-cp311-linux_x86_64.whl https://github.com/feranick/TFlite-builds/releases/download/v2.17.0/tflite_runtime-2.17.0-cp311-cp311-linux_x86_64.whl + wget -qO /deps/wheels/pycoral-2.0.2-cp311-cp311-linux_x86_64.whl https://github.com/feranick/pycoral/releases/download/2.0.2TF2.17.0/pycoral-2.0.2-cp311-cp311-linux_x86_64.whl fi if [[ "${TARGETARCH}" == "arm64" ]]; then - wget -qO /deps/wheels/tflite_runtime-2.17.0-cp310-cp310-linux_aarch64.whl https://github.com/feranick/TFlite-builds/releases/download/v2.17.0/tflite_runtime-2.17.0-cp310-cp310-linux_aarch64.whl - wget -qO /deps/wheels/pycoral-2.0.2-cp310-cp310-linux_aarch64.whl https://github.com/feranick/pycoral/releases/download/2.0.2TF2.17.0/pycoral-2.0.2-cp310-cp310-linux_aarch64.whl + wget -qO /deps/wheels/tflite_runtime-2.17.0-cp311-cp311-linux_aarch64.whl https://github.com/feranick/TFlite-builds/releases/download/v2.17.0/tflite_runtime-2.17.0-cp311-cp311-linux_aarch64.whl + wget -qO /deps/wheels/pycoral-2.0.2-cp311-cp311-linux_aarch64.whl https://github.com/feranick/pycoral/releases/download/2.0.2TF2.17.0/pycoral-2.0.2-cp311-cp311-linux_aarch64.whl fi # btbn-ffmpeg -> amd64 diff --git a/docker/rpi/install_deps.sh b/docker/rpi/install_deps.sh index 9716623cae..76da198fc0 100755 --- a/docker/rpi/install_deps.sh +++ b/docker/rpi/install_deps.sh @@ -24,7 +24,7 @@ sed -i -e's/ main/ main contrib non-free/g' /etc/apt/sources.list if [[ "${TARGETARCH}" == "arm64" ]]; then # add raspberry pi repo gpg --no-default-keyring --keyring /usr/share/keyrings/raspbian.gpg --keyserver keyserver.ubuntu.com --recv-keys 82B129927FA3303E - echo "deb [signed-by=/usr/share/keyrings/raspbian.gpg] https://archive.raspberrypi.org/debian/ bullseye main" | tee /etc/apt/sources.list.d/raspi.list + echo "deb [signed-by=/usr/share/keyrings/raspbian.gpg] https://archive.raspberrypi.org/debian/ bookworm main" | tee /etc/apt/sources.list.d/raspi.list apt-get -qq update apt-get -qq install --no-install-recommends --no-install-suggests -y ffmpeg fi From 68d3722bbb7580f46213cdf630c122ca22356ce7 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Wed, 20 Nov 2024 13:28:08 -0700 Subject: [PATCH 06/16] Cleanup --- docker/main/Dockerfile | 6 ------ docker/main/install_deps.sh | 14 -------------- 2 files changed, 20 deletions(-) diff --git a/docker/main/Dockerfile b/docker/main/Dockerfile index 99f660c5ed..829da38aeb 100644 --- a/docker/main/Dockerfile +++ b/docker/main/Dockerfile @@ -140,12 +140,6 @@ ARG TARGETARCH RUN apt-get -qq update \ && apt-get -qq install -y \ apt-transport-https \ - gnupg \ - wget \ - # the key fingerprint can be obtained from https://ftp-master.debian.org/keys.html - && wget -qO- "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x4D64FEC119C2029067D6E791F8D2585B8783D481" | \ - gpg --dearmor > /usr/share/keyrings/debian-archive-bookworm-stable.gpg \ - && sed -i 's|/usr/share/keyrings/debian-archive-keyring.gpg|/usr/share/keyrings/debian-archive-bookworm-stable.gpg|g' /etc/apt/sources.list.d/debian.sources \ && apt-get -qq update \ && apt-get -qq install -y \ python3 \ diff --git a/docker/main/install_deps.sh b/docker/main/install_deps.sh index ff8e1003e7..49453cb726 100755 --- a/docker/main/install_deps.sh +++ b/docker/main/install_deps.sh @@ -22,20 +22,6 @@ apt-get -qq install --no-install-recommends -y \ mkdir -p -m 600 /root/.gnupg -# add coral repo -curl -fsSLo - https://packages.cloud.google.com/apt/doc/apt-key.gpg | \ - gpg --dearmor -o /etc/apt/trusted.gpg.d/google-cloud-packages-archive-keyring.gpg -echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" | tee /etc/apt/sources.list.d/coral-edgetpu.list -echo "libedgetpu1-max libedgetpu/accepted-eula select true" | debconf-set-selections - -# enable non-free repo in Debian -if grep -q "Debian" /etc/issue; then - sed -i -e's/ main/ main contrib non-free/g' /etc/apt/sources.list -fi - -# coral drivers -mkdir /tmp/ - # install coral runtime wget -q -O /tmp/libedgetpu1-max.deb "https://github.com/feranick/libedgetpu/releases/download/16.0TF2.17.0-1/libedgetpu1-max_16.0tf2.17.0-1.bookworm_${TARGETARCH}.deb" dpkg -i /tmp/libedgetpu1-max.deb From 5e027b4fd27d31ed0adf886ebdd5f7739a508270 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Thu, 21 Nov 2024 09:07:22 -0700 Subject: [PATCH 07/16] Fix installation of coral deps --- docker/main/install_deps.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/docker/main/install_deps.sh b/docker/main/install_deps.sh index 49453cb726..1dfe62ec98 100755 --- a/docker/main/install_deps.sh +++ b/docker/main/install_deps.sh @@ -18,24 +18,26 @@ apt-get -qq install --no-install-recommends -y \ jq \ nethogs \ libgl1 \ - libglib2.0-0 + libglib2.0-0 \ + libusb-1.0.0 mkdir -p -m 600 /root/.gnupg # install coral runtime wget -q -O /tmp/libedgetpu1-max.deb "https://github.com/feranick/libedgetpu/releases/download/16.0TF2.17.0-1/libedgetpu1-max_16.0tf2.17.0-1.bookworm_${TARGETARCH}.deb" -dpkg -i /tmp/libedgetpu1-max.deb +unset DEBIAN_FRONTEND +yes | dpkg -i /tmp/libedgetpu1-max.deb && export DEBIAN_FRONTEND=noninteractive rm /tmp/libedgetpu1-max.deb # install python3 & tflite runtime if [[ "${TARGETARCH}" == "amd64" ]]; then - wget -qO /deps/wheels/tflite_runtime-2.17.0-cp311-cp311-linux_x86_64.whl https://github.com/feranick/TFlite-builds/releases/download/v2.17.0/tflite_runtime-2.17.0-cp311-cp311-linux_x86_64.whl - wget -qO /deps/wheels/pycoral-2.0.2-cp311-cp311-linux_x86_64.whl https://github.com/feranick/pycoral/releases/download/2.0.2TF2.17.0/pycoral-2.0.2-cp311-cp311-linux_x86_64.whl + pip3 install --break-system-packages https://github.com/feranick/TFlite-builds/releases/download/v2.17.0/tflite_runtime-2.17.0-cp311-cp311-linux_x86_64.whl + pip3 install --break-system-packages https://github.com/feranick/pycoral/releases/download/2.0.2TF2.17.0/pycoral-2.0.2-cp311-cp311-linux_x86_64.whl fi if [[ "${TARGETARCH}" == "arm64" ]]; then - wget -qO /deps/wheels/tflite_runtime-2.17.0-cp311-cp311-linux_aarch64.whl https://github.com/feranick/TFlite-builds/releases/download/v2.17.0/tflite_runtime-2.17.0-cp311-cp311-linux_aarch64.whl - wget -qO /deps/wheels/pycoral-2.0.2-cp311-cp311-linux_aarch64.whl https://github.com/feranick/pycoral/releases/download/2.0.2TF2.17.0/pycoral-2.0.2-cp311-cp311-linux_aarch64.whl + pip3 install --break-system-packages https://github.com/feranick/TFlite-builds/releases/download/v2.17.0/tflite_runtime-2.17.0-cp311-cp311-linux_aarch64.whl + pip3 install --break-system-packages https://github.com/feranick/pycoral/releases/download/2.0.2TF2.17.0/pycoral-2.0.2-cp311-cp311-linux_aarch64.whl fi # btbn-ffmpeg -> amd64 From a5042915c29c998ba2f6a9973afc11a0602f535c Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Thu, 21 Nov 2024 09:12:06 -0700 Subject: [PATCH 08/16] fix python installations --- docker/main/Dockerfile | 14 +++++++------- docker/main/build_ov_model.py | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docker/main/Dockerfile b/docker/main/Dockerfile index 829da38aeb..3f9c4ddf67 100644 --- a/docker/main/Dockerfile +++ b/docker/main/Dockerfile @@ -66,8 +66,8 @@ COPY docker/main/requirements-ov.txt /requirements-ov.txt RUN apt-get -qq update \ && apt-get -qq install -y wget python3 python3-dev python3-distutils gcc pkg-config libhdf5-dev \ && wget -q https://bootstrap.pypa.io/get-pip.py -O get-pip.py \ - && python3 get-pip.py "pip" \ - && pip install -r /requirements-ov.txt + && python3 get-pip.py "pip" --break-system-packages \ + && pip install --break-system-packages -r /requirements-ov.txt # Get OpenVino Model RUN --mount=type=bind,source=docker/main/build_ov_model.py,target=/build_ov_model.py \ @@ -139,7 +139,7 @@ ARG TARGETARCH # Use a separate container to build wheels to prevent build dependencies in final image RUN apt-get -qq update \ && apt-get -qq install -y \ - apt-transport-https \ + apt-transport-https wget \ && apt-get -qq update \ && apt-get -qq install -y \ python3 \ @@ -158,10 +158,10 @@ RUN apt-get -qq update \ rm -rf /var/lib/apt/lists/* RUN wget -q https://bootstrap.pypa.io/get-pip.py -O get-pip.py \ - && python3 get-pip.py "pip" + && python3 get-pip.py "pip" --break-system-packages COPY docker/main/requirements.txt /requirements.txt -RUN pip3 install -r /requirements.txt +RUN pip3 install -r /requirements.txt --break-system-packages # Build pysqlite3 from source COPY docker/main/build_pysqlite3.sh /build_pysqlite3.sh @@ -212,8 +212,8 @@ RUN --mount=type=bind,source=docker/main/install_deps.sh,target=/deps/install_de /deps/install_deps.sh RUN --mount=type=bind,from=wheels,source=/wheels,target=/deps/wheels \ - python3 -m pip install --upgrade pip && \ - pip3 install -U /deps/wheels/*.whl + python3 -m pip install --upgrade pip --break-system-packages && \ + pip3 install -U /deps/wheels/*.whl --break-system-packages COPY --from=deps-rootfs / / diff --git a/docker/main/build_ov_model.py b/docker/main/build_ov_model.py index 9e110ad9f9..2888d87a85 100644 --- a/docker/main/build_ov_model.py +++ b/docker/main/build_ov_model.py @@ -4,7 +4,7 @@ ov_model = mo.convert_model( "/models/ssdlite_mobilenet_v2_coco_2018_05_09/frozen_inference_graph.pb", compress_to_fp16=True, - transformations_config="/usr/local/lib/python3.9/dist-packages/openvino/tools/mo/front/tf/ssd_v2_support.json", + transformations_config="/usr/local/lib/python3.11/dist-packages/openvino/tools/mo/front/tf/ssd_v2_support.json", tensorflow_object_detection_api_pipeline_config="/models/ssdlite_mobilenet_v2_coco_2018_05_09/pipeline.config", reverse_input_channels=True, ) From 316ceb25448cfdbfe70a87c0c0ee40a72c9b6e2e Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Thu, 21 Nov 2024 09:16:18 -0700 Subject: [PATCH 09/16] Fix devcontainer build --- docker/main/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/main/Dockerfile b/docker/main/Dockerfile index 3f9c4ddf67..34c7f331df 100644 --- a/docker/main/Dockerfile +++ b/docker/main/Dockerfile @@ -260,7 +260,7 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* RUN --mount=type=bind,source=./docker/main/requirements-dev.txt,target=/workspace/frigate/requirements-dev.txt \ - pip3 install -r requirements-dev.txt + pip3 install -r requirements-dev.txt --break-system-packages HEALTHCHECK NONE From 1b24441cdd37035338c04e02ee6b437601113d00 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Mon, 16 Dec 2024 05:39:18 -0700 Subject: [PATCH 10/16] Get tensorrt build working --- docker/main/install_deps.sh | 4 ---- docker/tensorrt/Dockerfile.amd64 | 11 ++++++----- .../rootfs/etc/ld.so.conf.d/cuda_tensorrt.conf | 12 +++++++----- docker/tensorrt/requirements-amd64.txt | 4 ++-- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/docker/main/install_deps.sh b/docker/main/install_deps.sh index 1dfe62ec98..f8f68398f3 100755 --- a/docker/main/install_deps.sh +++ b/docker/main/install_deps.sh @@ -72,10 +72,6 @@ if [[ "${TARGETARCH}" == "amd64" ]]; then libva-drm2 \ mesa-va-drivers radeontop - # something about this dependency requires it to be installed in a separate call rather than in the line above - apt-get -qq install --no-install-recommends --no-install-suggests -y \ - i965-va-driver-shaders - # intel packages use zst compression so we need to update dpkg apt-get install -y dpkg diff --git a/docker/tensorrt/Dockerfile.amd64 b/docker/tensorrt/Dockerfile.amd64 index 3dcb426589..f90912a527 100644 --- a/docker/tensorrt/Dockerfile.amd64 +++ b/docker/tensorrt/Dockerfile.amd64 @@ -7,6 +7,7 @@ ARG DEBIAN_FRONTEND=noninteractive FROM wheels as trt-wheels ARG DEBIAN_FRONTEND ARG TARGETARCH +RUN python3 -m pip config set global.break-system-packages true # Add TensorRT wheels to another folder COPY docker/tensorrt/requirements-amd64.txt /requirements-tensorrt.txt @@ -20,20 +21,20 @@ ARG COMPUTE_LEVEL RUN apt-get update \ && apt-get install -y git build-essential -RUN wget https://developer.download.nvidia.com/compute/cuda/repos/debian11/x86_64/cuda-keyring_1.1-1_all.deb \ +RUN wget https://developer.download.nvidia.com/compute/cuda/repos/debian12/x86_64/cuda-keyring_1.1-1_all.deb \ && dpkg -i cuda-keyring_1.1-1_all.deb \ && apt-get update \ && apt-get -y install cuda-toolkit \ && rm -rf /var/lib/apt/lists/* FROM tensorrt-base AS frigate-tensorrt -ENV TRT_VER=8.5.3 +ENV TRT_VER=8.6.1 +RUN python3 -m pip config set global.break-system-packages true RUN --mount=type=bind,from=trt-wheels,source=/trt-wheels,target=/deps/trt-wheels \ - pip3 install -U /deps/trt-wheels/*.whl && \ + pip3 install -U /deps/trt-wheels/*.whl --break-system-packages && \ ldconfig COPY --from=cudnn-deps /usr/local/cuda-12.6 /usr/local/cuda -ENV LD_LIBRARY_PATH=/usr/local/lib/python3.9/dist-packages/tensorrt:/usr/local/cuda/lib64:/usr/local/lib/python3.9/dist-packages/nvidia/cufft/lib WORKDIR /opt/frigate/ COPY --from=rootfs / / @@ -46,4 +47,4 @@ COPY --from=cudnn-deps /usr/local/cuda-12.6 /usr/local/cuda COPY docker/tensorrt/detector/rootfs/ / COPY --from=trt-deps /usr/local/lib/libyolo_layer.so /usr/local/lib/libyolo_layer.so RUN --mount=type=bind,from=trt-wheels,source=/trt-wheels,target=/deps/trt-wheels \ - pip3 install -U /deps/trt-wheels/*.whl + pip3 install -U /deps/trt-wheels/*.whl --break-system-packages diff --git a/docker/tensorrt/detector/rootfs/etc/ld.so.conf.d/cuda_tensorrt.conf b/docker/tensorrt/detector/rootfs/etc/ld.so.conf.d/cuda_tensorrt.conf index fe16ed9c51..561b7bcd48 100644 --- a/docker/tensorrt/detector/rootfs/etc/ld.so.conf.d/cuda_tensorrt.conf +++ b/docker/tensorrt/detector/rootfs/etc/ld.so.conf.d/cuda_tensorrt.conf @@ -1,6 +1,8 @@ /usr/local/lib -/usr/local/lib/python3.9/dist-packages/nvidia/cudnn/lib -/usr/local/lib/python3.9/dist-packages/nvidia/cuda_runtime/lib -/usr/local/lib/python3.9/dist-packages/nvidia/cublas/lib -/usr/local/lib/python3.9/dist-packages/nvidia/cuda_nvrtc/lib -/usr/local/lib/python3.9/dist-packages/tensorrt \ No newline at end of file +/usr/local/cuda/lib64 +/usr/local/lib/python3.11/dist-packages/nvidia/cudnn/lib +/usr/local/lib/python3.11/dist-packages/nvidia/cuda_runtime/lib +/usr/local/lib/python3.11/dist-packages/nvidia/cublas/lib +/usr/local/lib/python3.11/dist-packages/nvidia/cuda_nvrtc/lib +/usr/local/lib/python3.11/dist-packages/tensorrt +/usr/local/lib/python3.11/dist-packages/nvidia/cufft/lib \ No newline at end of file diff --git a/docker/tensorrt/requirements-amd64.txt b/docker/tensorrt/requirements-amd64.txt index df276a613e..9b1ee6a0e5 100644 --- a/docker/tensorrt/requirements-amd64.txt +++ b/docker/tensorrt/requirements-amd64.txt @@ -1,8 +1,8 @@ # NVidia TensorRT Support (amd64 only) --extra-index-url 'https://pypi.nvidia.com' numpy < 1.24; platform_machine == 'x86_64' -tensorrt == 8.5.3.*; platform_machine == 'x86_64' -cuda-python == 11.8; platform_machine == 'x86_64' +tensorrt == 8.6.1.*; platform_machine == 'x86_64' +cuda-python == 11.8.*; platform_machine == 'x86_64' cython == 0.29.*; platform_machine == 'x86_64' nvidia-cuda-runtime-cu12 == 12.1.*; platform_machine == 'x86_64' nvidia-cuda-runtime-cu11 == 11.8.*; platform_machine == 'x86_64' From 0517c40bc81fdfa4d681e316ea2c9813d5614456 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Tue, 17 Dec 2024 07:27:44 -0700 Subject: [PATCH 11/16] Update other deps --- docker/rockchip/requirements-wheels-rk.txt | 2 +- docker/tensorrt/Dockerfile.arm64 | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/rockchip/requirements-wheels-rk.txt b/docker/rockchip/requirements-wheels-rk.txt index c56b69b66d..71a9f58d13 100644 --- a/docker/rockchip/requirements-wheels-rk.txt +++ b/docker/rockchip/requirements-wheels-rk.txt @@ -1 +1 @@ -rknn-toolkit-lite2 @ https://github.com/MarcA711/rknn-toolkit2/releases/download/v2.0.0/rknn_toolkit_lite2-2.0.0b0-cp39-cp39-linux_aarch64.whl \ No newline at end of file +rknn-toolkit-lite2 @ https://github.com/MarcA711/rknn-toolkit2/releases/download/v2.0.0/rknn_toolkit_lite2-2.0.0b0-cp311-cp311-linux_aarch64.whl \ No newline at end of file diff --git a/docker/tensorrt/Dockerfile.arm64 b/docker/tensorrt/Dockerfile.arm64 index 23a2459ace..ba2638fcb6 100644 --- a/docker/tensorrt/Dockerfile.arm64 +++ b/docker/tensorrt/Dockerfile.arm64 @@ -41,11 +41,11 @@ RUN --mount=type=bind,source=docker/tensorrt/detector/build_python_tensorrt.sh,t && TENSORRT_VER=$(cat /etc/TENSORRT_VER) /deps/build_python_tensorrt.sh COPY docker/tensorrt/requirements-arm64.txt /requirements-tensorrt.txt -ADD https://nvidia.box.com/shared/static/9aemm4grzbbkfaesg5l7fplgjtmswhj8.whl /tmp/onnxruntime_gpu-1.15.1-cp39-cp39-linux_aarch64.whl +ADD https://nvidia.box.com/shared/static/psl23iw3bh7hlgku0mjo1xekxpego3e3.whl /tmp/onnxruntime_gpu-1.15.1-cp311-cp311-linux_aarch64.whl RUN pip3 uninstall -y onnxruntime-openvino \ && pip3 wheel --wheel-dir=/trt-wheels -r /requirements-tensorrt.txt \ - && pip3 install --no-deps /tmp/onnxruntime_gpu-1.15.1-cp39-cp39-linux_aarch64.whl + && pip3 install --no-deps /tmp/onnxruntime_gpu-1.15.1-cp311-cp311-linux_aarch64.whl FROM build-wheels AS trt-model-wheels ARG DEBIAN_FRONTEND From 8164b2457aa62e134e1804a7e38a08001f8d6239 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Wed, 18 Dec 2024 07:25:52 -0700 Subject: [PATCH 12/16] Filter out tflite log --- frigate/log.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/frigate/log.py b/frigate/log.py index 079fc61076..53e9004f53 100644 --- a/frigate/log.py +++ b/frigate/log.py @@ -18,12 +18,19 @@ ) ) +# filter out norfair warning LOG_HANDLER.addFilter( lambda record: not record.getMessage().startswith( "You are using a scalar distance function" ) ) +# filter out tflite logging +LOG_HANDLER.addFilter( + lambda record: "Created TensorFlow Lite XNNPACK delegate for CPU." + not in record.getMessage() +) + log_listener: Optional[QueueListener] = None From 8cb1380a4f3ce0f7232821c8c419397cf1c9502f Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Wed, 18 Dec 2024 07:32:09 -0700 Subject: [PATCH 13/16] Get ROCm build working --- docker/rocm/Dockerfile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docker/rocm/Dockerfile b/docker/rocm/Dockerfile index eebe048788..5c146a07ea 100644 --- a/docker/rocm/Dockerfile +++ b/docker/rocm/Dockerfile @@ -34,7 +34,7 @@ RUN mkdir -p /opt/rocm-dist/etc/ld.so.conf.d/ RUN echo /opt/rocm/lib|tee /opt/rocm-dist/etc/ld.so.conf.d/rocm.conf ####################################################################### -FROM --platform=linux/amd64 debian:11 as debian-base +FROM --platform=linux/amd64 debian:12 as debian-base RUN apt-get update && apt-get -y upgrade RUN apt-get -y install --no-install-recommends libelf1 libdrm2 libdrm-amdgpu1 libnuma1 kmod @@ -51,7 +51,7 @@ COPY --from=rocm /opt/rocm-$ROCM /opt/rocm-$ROCM RUN ln -s /opt/rocm-$ROCM /opt/rocm RUN apt-get -y install g++ cmake -RUN apt-get -y install python3-pybind11 python3.9-distutils python3-dev +RUN apt-get -y install python3-pybind11 python3-distutils python3-dev WORKDIR /opt/build @@ -70,10 +70,10 @@ RUN apt-get -y install libnuma1 WORKDIR /opt/frigate/ COPY --from=rootfs / / -COPY docker/rocm/requirements-wheels-rocm.txt /requirements.txt -RUN python3 -m pip install --upgrade pip \ - && pip3 uninstall -y onnxruntime-openvino \ - && pip3 install -r /requirements.txt +#COPY docker/rocm/requirements-wheels-rocm.txt /requirements.txt +#RUN python3 -m pip install --upgrade pip \ +# && pip3 uninstall -y onnxruntime-openvino \ +# && pip3 install -r /requirements.txt ####################################################################### FROM scratch AS rocm-dist @@ -86,7 +86,7 @@ COPY --from=rocm /opt/rocm-$ROCM/share/miopen/db/*$AMDGPU* /opt/rocm-$ROCM/share COPY --from=rocm /opt/rocm-$ROCM/share/miopen/db/*gfx908* /opt/rocm-$ROCM/share/miopen/db/ COPY --from=rocm /opt/rocm-$ROCM/lib/rocblas/library/*$AMDGPU* /opt/rocm-$ROCM/lib/rocblas/library/ COPY --from=rocm /opt/rocm-dist/ / -COPY --from=debian-build /opt/rocm/lib/migraphx.cpython-39-x86_64-linux-gnu.so /opt/rocm-$ROCM/lib/ +COPY --from=debian-build /opt/rocm/lib/migraphx.cpython-311-x86_64-linux-gnu.so /opt/rocm-$ROCM/lib/ ####################################################################### FROM deps-prelim AS rocm-prelim-hsa-override0 From eb6e065106ed28c8ee521b1da0ece36c3abfc7ff Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Wed, 18 Dec 2024 08:21:10 -0700 Subject: [PATCH 14/16] Get rockchip build working --- docker/rockchip/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker/rockchip/Dockerfile b/docker/rockchip/Dockerfile index e1b43c2553..0fde75aa8b 100644 --- a/docker/rockchip/Dockerfile +++ b/docker/rockchip/Dockerfile @@ -7,13 +7,14 @@ FROM wheels as rk-wheels COPY docker/main/requirements-wheels.txt /requirements-wheels.txt COPY docker/rockchip/requirements-wheels-rk.txt /requirements-wheels-rk.txt RUN sed -i "/https:\/\//d" /requirements-wheels.txt +RUN python3 -m pip config set global.break-system-packages true RUN pip3 wheel --wheel-dir=/rk-wheels -c /requirements-wheels.txt -r /requirements-wheels-rk.txt FROM deps AS rk-frigate ARG TARGETARCH RUN --mount=type=bind,from=rk-wheels,source=/rk-wheels,target=/deps/rk-wheels \ - pip3 install -U /deps/rk-wheels/*.whl + pip3 install -U /deps/rk-wheels/*.whl --break-system-packages WORKDIR /opt/frigate/ COPY --from=rootfs / / From bddfb897e1df7aafd823f8bc6dacf9dbbac36b88 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Wed, 18 Dec 2024 09:24:08 -0700 Subject: [PATCH 15/16] Get hailo build working --- docker/hailo8l/Dockerfile | 2 ++ docker/hailo8l/install_hailort.sh | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docker/hailo8l/Dockerfile b/docker/hailo8l/Dockerfile index 959e7692ed..33b5b08f0d 100644 --- a/docker/hailo8l/Dockerfile +++ b/docker/hailo8l/Dockerfile @@ -5,6 +5,7 @@ ARG DEBIAN_FRONTEND=noninteractive # Build Python wheels FROM wheels AS h8l-wheels +RUN python3 -m pip config set global.break-system-packages true COPY docker/main/requirements-wheels.txt /requirements-wheels.txt COPY docker/hailo8l/requirements-wheels-h8l.txt /requirements-wheels-h8l.txt @@ -30,6 +31,7 @@ COPY --from=hailort /hailo-wheels /deps/hailo-wheels COPY --from=hailort /rootfs/ / # Install the wheels +RUN python3 -m pip config set global.break-system-packages true RUN pip3 install -U /deps/h8l-wheels/*.whl RUN pip3 install -U /deps/hailo-wheels/*.whl diff --git a/docker/hailo8l/install_hailort.sh b/docker/hailo8l/install_hailort.sh index 62eba96115..efcc4f541f 100755 --- a/docker/hailo8l/install_hailort.sh +++ b/docker/hailo8l/install_hailort.sh @@ -15,5 +15,5 @@ wget -qO- "https://github.com/frigate-nvr/hailort/releases/download/v${hailo_ver mkdir -p /hailo-wheels -wget -P /hailo-wheels/ "https://github.com/frigate-nvr/hailort/releases/download/v${hailo_version}/hailort-${hailo_version}-cp39-cp39-linux_${arch}.whl" +wget -P /hailo-wheels/ "https://github.com/frigate-nvr/hailort/releases/download/v${hailo_version}/hailort-${hailo_version}-cp311-cp311-linux_${arch}.whl" From eb47177380bb538b05485e2b5eba1b4758eb6286 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Wed, 18 Dec 2024 09:36:50 -0700 Subject: [PATCH 16/16] Add note to comment --- docker/rocm/Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docker/rocm/Dockerfile b/docker/rocm/Dockerfile index 5c146a07ea..34c7efffb0 100644 --- a/docker/rocm/Dockerfile +++ b/docker/rocm/Dockerfile @@ -70,6 +70,7 @@ RUN apt-get -y install libnuma1 WORKDIR /opt/frigate/ COPY --from=rootfs / / +# Temporarily disabled to see if a new wheel can be built to support py3.11 #COPY docker/rocm/requirements-wheels-rocm.txt /requirements.txt #RUN python3 -m pip install --upgrade pip \ # && pip3 uninstall -y onnxruntime-openvino \ @@ -90,8 +91,8 @@ COPY --from=debian-build /opt/rocm/lib/migraphx.cpython-311-x86_64-linux-gnu.so ####################################################################### FROM deps-prelim AS rocm-prelim-hsa-override0 - -ENV HSA_ENABLE_SDMA=0 +\ + ENV HSA_ENABLE_SDMA=0 COPY --from=rocm-dist / /