Immich UV test (#5032)

- Simplifies UV use in Immich install & update
- Uses Python 3.11 (No official support for 3.12 yet)
- Restores python3-dev package
This commit is contained in:
Chris
2025-06-07 02:54:48 -04:00
committed by GitHub
parent 0c04d8900b
commit 84e93cd7d0
2 changed files with 16 additions and 25 deletions

View File

@ -27,6 +27,9 @@ function update_script() {
msg_error "No ${APP} Installation Found!"
exit
fi
setup_uv
STAGING_DIR=/opt/staging
BASE_DIR=${STAGING_DIR}/base-images
SOURCE_DIR=${STAGING_DIR}/image-source
@ -251,23 +254,16 @@ EOF
msg_ok "Updated ${APP} web and microservices"
cd "$SRC_DIR"/machine-learning
$STD python3 -m venv "$ML_DIR"/ml-venv
export VIRTUAL_ENV="${ML_DIR}/ml-venv"
$STD uv venv "$VIRTUAL_ENV"
if [[ -f ~/.openvino ]]; then
msg_info "Updating HW-accelerated machine-learning"
(
source "$ML_DIR"/ml-venv/bin/activate
$STD pip3 install -U uv
uv -q sync --extra openvino --no-cache --active
)
patchelf --clear-execstack "$ML_DIR"/ml-venv/lib/python3.11/site-packages/onnxruntime/capi/onnxruntime_pybind11_state.cpython-311-x86_64-linux-gnu.so
uv -q sync --extra openvino --no-cache --active
patchelf --clear-execstack "${VIRTUAL_ENV}/lib/python3.11/site-packages/onnxruntime/capi/onnxruntime_pybind11_state.cpython-311-x86_64-linux-gnu.so"
msg_ok "Updated HW-accelerated machine-learning"
else
msg_info "Updating machine-learning"
(
source "$ML_DIR"/ml-venv/bin/activate
$STD pip3 install -U uv
uv -q sync --extra cpu --no-cache --active
)
uv -q sync --extra cpu --no-cache --active
msg_ok "Updated machine-learning"
fi
cd "$SRC_DIR"

View File

@ -13,7 +13,7 @@ setting_up_container
network_check
update_os
PYTHON_VERSION="3.12" setup_uv
setup_uv
msg_info "Configuring apt and installing dependencies"
echo "deb http://deb.debian.org/debian testing main contrib" >/etc/apt/sources.list.d/immich.list
@ -29,6 +29,7 @@ $STD apt-get install --no-install-recommends -y \
redis \
autoconf \
build-essential \
python3-dev \
cmake \
jq \
libbrotli-dev \
@ -304,22 +305,16 @@ cp LICENSE "$APP_DIR"
msg_ok "Installed Immich Web Components"
cd "$SRC_DIR"/machine-learning
$STD uv venv "$ML_DIR/.venv"
$ML_DIR/.venv/bin/uv pip install --upgrade uv
$ML_DIR/.venv/bin/uv sync --no-cache
cd "$SRC_DIR"/machine-learning
$STD uv venv "$ML_DIR/.venv"
$ML_DIR/.venv/bin/uv pip install --upgrade uv
export VIRTUAL_ENV="${ML_DIR}/ml-venv"
$STD uv venv "$VIRTUAL_ENV"
if [[ -f ~/.openvino ]]; then
msg_info "Installing HW-accelerated machine-learning"
$STD "$ML_DIR/.venv/bin/uv" sync --no-cache --extra openvino
patchelf --clear-execstack "$ML_DIR/.venv/lib/python3.12/site-packages/onnxruntime/capi/onnxruntime_pybind11_state.cpython-312-x86_64-linux-gnu.so"
uv -q sync --no-cache --extra openvino --active
patchelf --clear-execstack "${VIRTUAL_ENV}/lib/python3.11/site-packages/onnxruntime/capi/onnxruntime_pybind11_state.cpython-311-x86_64-linux-gnu.so"
msg_ok "Installed HW-accelerated machine-learning"
else
msg_info "Installing machine-learning"
$STD "$ML_DIR/.venv/bin/uv" sync --no-cache --extra cpu
uv -q sync --no-cache --extra cpu --active
msg_ok "Installed machine-learning"
fi
@ -396,7 +391,7 @@ set -a
. ${INSTALL_DIR}/.env
set +a
python -m immich_ml
python3 -m immich_ml
EOF
chmod +x "$ML_DIR"/ml_start.sh
cat <<EOF >/etc/systemd/system/"${APPLICATION}"-web.service