From 84d2c964e6d8ddc405126e78246e3495f5dcb282 Mon Sep 17 00:00:00 2001 From: "CanbiZ (MickLesk)" <47820557+MickLesk@users.noreply.github.com> Date: Thu, 8 Oct 2026 11:47:06 +0200 Subject: [PATCH] Immich: Pin to 3.3.0 / Update ML Python to 3.13 (#17770) * Immich: pin v3.3.0 again Reapplies #17759, reverted in #17767 because machine learning broke on 3.3.0; the fixes follow. * Immich: run machine learning on Python 3.13 3.3.0 requires Python >=3.12 for machine learning and upstream builds both its CPU and OpenVINO images on 3.13. The CPU path still pinned 3.11, so uv sync failed on every update and install (#17762). * Immich: stop when uv sync keeps failing After three failed attempts the loop still reported the machine-learning step as done, so an update ended in "Updated successfully" with no usable venv and immich-ml failing on start. Exit with an error instead. * Immich: only mention the HEIC patch when it applies On 3.3.0 the sharp call it rewrites is gone, so every run printed "pattern not found, skipped" into the spinner line and then "Patched". Check for the pattern first and stay silent otherwise. * BookOrbit: retry the client build when the bundler crashes Since rolldown 1.2.8, vite build dies at random with SIGSEGV or SIGBUS (rolldown#10860, closed upstream), which stopped the 3.3.0 update with exit 139 (#17753). Retry the client build up to three times before giving up. --- ct/bookorbit.sh | 7 ++++++- ct/immich.sh | 35 ++++++++++++++--------------------- install/bookorbit-install.sh | 7 ++++++- install/immich-install.sh | 32 +++++++++++--------------------- 4 files changed, 37 insertions(+), 44 deletions(-) diff --git a/ct/bookorbit.sh b/ct/bookorbit.sh index 500ae374d..9a12774f9 100644 --- a/ct/bookorbit.sh +++ b/ct/bookorbit.sh @@ -48,7 +48,12 @@ function update_script() { $STD corepack prepare "pnpm@${PNPM_VERSION}" --activate $STD pnpm install --frozen-lockfile - $STD pnpm --filter client run build-only + # vite's bundler (rolldown) crashes at random on some builds, rolldown#10860. + for attempt in 1 2 3; do + $STD pnpm --filter client run build-only && break + [[ $attempt -eq 3 ]] && { msg_error "Client build failed three times"; exit 1; } + msg_warn "Client build failed (attempt $attempt), retrying" + done $STD pnpm --filter server run build cp -r /opt/bookorbit/client/dist /opt/bookorbit/server/public mkdir -p /opt/bookorbit/server/migrations diff --git a/ct/immich.sh b/ct/immich.sh index a6a51e118..eec9e55c8 100644 --- a/ct/immich.sh +++ b/ct/immich.sh @@ -77,7 +77,7 @@ EOF BASE_DIR=${STAGING_DIR}/base-images SOURCE_DIR=${STAGING_DIR}/image-source cd /tmp - RELEASE="v3.2.4" + RELEASE="v3.3.0" if [[ -f ~/.intel_version ]]; then INTEL_SRC="https://raw.githubusercontent.com/immich-app/immich/${RELEASE}/machine-learning" curl -fsSL "${INTEL_SRC}/scripts/install-intel-runtime.sh" -o ./intel-runtime 2>/dev/null || @@ -274,12 +274,13 @@ EOF msg_info "Updating Intel OpenVINO machine-learning" for attempt in $(seq 1 3); do $STD sudo --preserve-env=VIRTUAL_ENV,UV_HTTP_TIMEOUT -Pnu immich uv sync --extra openvino --no-dev --active --link-mode copy -n -p "${ML_PYTHON}" --managed-python && break - [[ $attempt -lt 3 ]] && msg_warn "uv sync attempt $attempt failed, retrying..." && sleep 10 + [[ $attempt -eq 3 ]] && { msg_error "uv sync failed three times, the machine-learning environment was not built"; exit 1; } + msg_warn "uv sync attempt $attempt failed, retrying..." && sleep 10 done patchelf --clear-execstack "${VIRTUAL_ENV}/lib/python3.13/site-packages/onnxruntime/capi/onnxruntime_pybind11_state.cpython-313-$(arch_resolve "x86_64" "aarch64")-linux-gnu.so" msg_ok "Updated Intel OpenVINO machine-learning" else - ML_PYTHON="python3.11" + ML_PYTHON="python3.13" msg_info "Pre-installing Python ${ML_PYTHON} for machine-learning" for attempt in $(seq 1 3); do $STD sudo --preserve-env=VIRTUAL_ENV -Pnu immich uv python install "${ML_PYTHON}" && break @@ -289,7 +290,8 @@ EOF msg_info "Updating machine-learning" for attempt in $(seq 1 3); do $STD sudo --preserve-env=VIRTUAL_ENV,UV_HTTP_TIMEOUT -Pnu immich uv sync --extra cpu --no-dev --active --link-mode copy -n -p "${ML_PYTHON}" --managed-python && break - [[ $attempt -lt 3 ]] && msg_warn "uv sync attempt $attempt failed, retrying..." && sleep 10 + [[ $attempt -eq 3 ]] && { msg_error "uv sync failed three times, the machine-learning environment was not built"; exit 1; } + msg_warn "uv sync attempt $attempt failed, retrying..." && sleep 10 done msg_ok "Updated machine-learning" fi @@ -333,6 +335,10 @@ EOF sed -i -e '$a\' "$INSTALL_DIR"/.env echo "IMMICH_HELMET_FILE=true" >>"$INSTALL_DIR"/.env fi + if ! grep -q 'MODEL_REVISION' "$INSTALL_DIR"/.env; then + sed -i -e '$a\' "$INSTALL_DIR"/.env + echo "MACHINE_LEARNING_MODEL_REVISION=v2" >>"$INSTALL_DIR"/.env + fi if grep -q 'ExecStart=/usr/bin/node' /etc/systemd/system/immich-web.service; then sed -i '/^EnvironmentFile=/d' /etc/systemd/system/immich-web.service @@ -341,25 +347,12 @@ EOF fi # MickLesk temporary patch for HEIC thumbnail gen - msg_info "Patching media.repository.js" MEDIA_REPO_JS="/opt/immich/app/dist/repositories/media.repository.js" - if [[ -f "$MEDIA_REPO_JS" ]]; then - python3 - <<'PY' -from pathlib import Path -p = Path('/opt/immich/app/dist/repositories/media.repository.js') -s = p.read_text() -old = "(0, sharp_1.default)(input).metadata()" -new = "(0, sharp_1.default)(input, { unlimited: true, limitInputPixels: false }).metadata()" -if new in s: - print('hotfix already there') -elif old in s: - p.write_text(s.replace(old, new, 1)) - print('hotfix applied') -else: - print('pattern not found, skipped') -PY + if grep -qF "(0, sharp_1.default)(input).metadata()" "$MEDIA_REPO_JS" 2>/dev/null; then + msg_info "Patching media.repository.js" + sed -i '0,/(0, sharp_1\.default)(input)\.metadata()/s//(0, sharp_1.default)(input, { unlimited: true, limitInputPixels: false }).metadata()/' "$MEDIA_REPO_JS" + msg_ok "Patched media.repository.js" fi - msg_ok "Patched media.repository.js" # chown excluding upload dir contents (may be a mount with restricted permissions) chown immich:immich "$INSTALL_DIR" diff --git a/install/bookorbit-install.sh b/install/bookorbit-install.sh index 14e574fe1..074d23fdf 100644 --- a/install/bookorbit-install.sh +++ b/install/bookorbit-install.sh @@ -33,7 +33,12 @@ PNPM_VERSION=$(jq -r '.packageManager | ltrimstr("pnpm@")' /opt/bookorbit/packag $STD corepack prepare "pnpm@${PNPM_VERSION}" --activate $STD pnpm install --frozen-lockfile -$STD pnpm --filter client run build-only +# vite's bundler (rolldown) crashes at random on some builds, rolldown#10860. +for attempt in 1 2 3; do + $STD pnpm --filter client run build-only && break + [[ $attempt -eq 3 ]] && { msg_error "Client build failed three times"; exit 1; } + msg_warn "Client build failed (attempt $attempt), retrying" +done $STD pnpm --filter server run build cp -r /opt/bookorbit/client/dist /opt/bookorbit/server/public mkdir -p /opt/bookorbit/server/migrations diff --git a/install/immich-install.sh b/install/immich-install.sh index d765df9dc..1ea0c6c65 100644 --- a/install/immich-install.sh +++ b/install/immich-install.sh @@ -13,7 +13,7 @@ setting_up_container network_check update_os -RELEASE="v3.2.4" +RELEASE="v3.3.0" if lscpu | grep -q 'GenuineIntel'; then echo "" echo "" @@ -442,12 +442,13 @@ if [[ -f ~/.openvino ]]; then msg_info "Installing Intel OpenVINO machine-learning" for attempt in $(seq 1 3); do $STD sudo --preserve-env=VIRTUAL_ENV,UV_HTTP_TIMEOUT -Pnu immich uv sync --extra openvino --no-dev --active --link-mode copy -n -p "${ML_PYTHON}" --managed-python && break - [[ $attempt -lt 3 ]] && msg_warn "uv sync attempt $attempt failed, retrying..." && sleep 10 + [[ $attempt -eq 3 ]] && { msg_error "uv sync failed three times, the machine-learning environment was not built"; exit 1; } + msg_warn "uv sync attempt $attempt failed, retrying..." && sleep 10 done patchelf --clear-execstack "${VIRTUAL_ENV}/lib/python3.13/site-packages/onnxruntime/capi/onnxruntime_pybind11_state.cpython-313-$(arch_resolve "x86_64" "aarch64")-linux-gnu.so" msg_ok "Installed Intel OpenVINO machine-learning" else - ML_PYTHON="python3.11" + ML_PYTHON="python3.13" msg_info "Pre-installing Python ${ML_PYTHON} for machine-learning" for attempt in $(seq 1 3); do $STD sudo --preserve-env=VIRTUAL_ENV -Pnu immich uv python install "${ML_PYTHON}" && break @@ -457,7 +458,8 @@ else msg_info "Installing machine-learning" for attempt in $(seq 1 3); do $STD sudo --preserve-env=VIRTUAL_ENV,UV_HTTP_TIMEOUT -Pnu immich uv sync --extra cpu --no-dev --active --link-mode copy -n -p "${ML_PYTHON}" --managed-python && break - [[ $attempt -lt 3 ]] && msg_warn "uv sync attempt $attempt failed, retrying..." && sleep 10 + [[ $attempt -eq 3 ]] && { msg_error "uv sync failed three times, the machine-learning environment was not built"; exit 1; } + msg_warn "uv sync attempt $attempt failed, retrying..." && sleep 10 done msg_ok "Installed machine-learning" fi @@ -488,25 +490,12 @@ ln -s "$GEO_DIR" "$APP_DIR" msg_ok "Installed GeoNames data" # MickLesk temporary patch for HEIC thumbnail gen -msg_info "Patching media.repository.js" MEDIA_REPO_JS="/opt/immich/app/dist/repositories/media.repository.js" -if [[ -f "$MEDIA_REPO_JS" ]]; then - python3 - <<'PY' -from pathlib import Path -p = Path('/opt/immich/app/dist/repositories/media.repository.js') -s = p.read_text() -old = "(0, sharp_1.default)(input).metadata()" -new = "(0, sharp_1.default)(input, { unlimited: true, limitInputPixels: false }).metadata()" -if new in s: - print('hotfix already there') -elif old in s: - p.write_text(s.replace(old, new, 1)) - print('hotfix applied') -else: - print('pattern not found, skipped') -PY +if grep -qF "(0, sharp_1.default)(input).metadata()" "$MEDIA_REPO_JS" 2>/dev/null; then + msg_info "Patching media.repository.js" + sed -i '0,/(0, sharp_1\.default)(input)\.metadata()/s//(0, sharp_1.default)(input, { unlimited: true, limitInputPixels: false }).metadata()/' "$MEDIA_REPO_JS" + msg_ok "Patched media.repository.js" fi -msg_ok "Patched media.repository.js" mkdir -p /var/log/immich touch /var/log/immich/{web.log,ml.log} @@ -537,6 +526,7 @@ MACHINE_LEARNING_CACHE_FOLDER=${INSTALL_DIR}/cache ## - inference speed while reducing accuracy ## - Default is FP32 # MACHINE_LEARNING_OPENVINO_PRECISION=FP16 +MACHINE_LEARNING_MODEL_REVISION=v2 IMMICH_MEDIA_LOCATION=${UPLOAD_DIR} EOF