immich-app / immich

High performance self-hosted photo and video management solution.
https://immich.app
GNU Affero General Public License v3.0
49.39k stars 2.6k forks source link

SyntaxError: source code string cannot contain null bytes #13208

Closed mydogger closed 5 days ago

mydogger commented 2 weeks ago

The bug

immich_machine_learning keeps restarting

The OS that Immich Server is running on

Ubuntu 22.04

Version of Immich Server

2.2.23

Version of Immich Mobile App

none

Platform with the issue

Your docker-compose.yml content

name: immich

services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    # extends:
    #   file: hwaccel.transcoding.yml
    #   service: cpu # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
    volumes:
      # Do not edit the next line. If you want to change the media storage location on your system, edit the value of UPLOAD_LOCATION in the .env file
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    ports:
      - 2283:3001
    depends_on:
      - redis
      - database
    restart: always
    healthcheck:
      disable: false

  immich-machine-learning:
    container_name: immich_machine_learning
    # For hardware acceleration, add one of -[armnn, cuda, openvino] to the image tag.
    # Example tag: ${IMMICH_VERSION:-release}-cuda
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
    # extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/ml-hardware-acceleration
    #   file: hwaccel.ml.yml
    #   service: cpu # set to one of [armnn, cuda, openvino, openvino-wsl] for accelerated inference - use the `-wsl` version for WSL2 where applicable
    volumes:
      - model-cache:/cache
    env_file:
      - .env
    environment:
      HTTP_PROXY: http://192.168.0.151:1082
      HTTPS_PROXY: http://192.168.0.151:1082
    restart: always
    healthcheck:
      disable: false

  redis:
    container_name: immich_redis
    image: docker.io/redis:6.2-alpine@sha256:2d1463258f2764328496376f5d965f20c6a67f66ea2b06dc42af351f75248792
    healthcheck:
      test: redis-cli ping || exit 1
    restart: always

  database:
    container_name: immich_postgres
    image: docker.io/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
      POSTGRES_INITDB_ARGS: '--data-checksums'
    volumes:
      # Do not edit the next line. If you want to change the database storage location on your system, edit the value of DB_DATA_LOCATION in the .env file
      - ${DB_DATA_LOCATION}:/var/lib/postgresql/data
    healthcheck:
      test: pg_isready --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' || exit 1; Chksum="$$(psql --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' --tuples-only --no-align --command='SELECT COALESCE(SUM(checksum_failures), 0) FROM pg_stat_database')"; echo "checksum failure count is $$Chksum"; [ "$$Chksum" = '0' ] || exit 1
      interval: 5m
      start_interval: 30s
      start_period: 5m
    command: ["postgres", "-c", "shared_preload_libraries=vectors.so", "-c", 'search_path="$$user", public, vectors', "-c", "logging_collector=on", "-c", "max_wal_size=2GB", "-c", "shared_buffers=512MB", "-c", "wal_compression=on"]
    restart: always

volumes:
  model-cache:

Your .env content

# You can find documentation for all the supported env variables at https://immich.app/docs/install/environment-variables

# The location where your uploaded files are stored
UPLOAD_LOCATION=./library
# The location where your database files are stored
DB_DATA_LOCATION=./postgres

# To set a timezone, uncomment the next line and change Etc/UTC to a TZ identifier from this list: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
# TZ=Etc/UTC

# The Immich version to use. You can pin this to a specific version like "v1.71.0"
IMMICH_VERSION=release

# Connection secret for postgres. You should change it to a random password
# Please use only the characters `A-Za-z0-9`, without special characters or spaces
DB_PASSWORD=...

# The values below this line do not need to be changed
###################################################################################
DB_USERNAME=postgres
DB_DATABASE_NAME=immich

Reproduction steps

docker compose up docker logs -f immich_machine_learning

Relevant log output

[10/05/24 16:04:43] INFO     Worker exiting (pid: 10)
[10/05/24 16:04:44] ERROR    Worker (pid:10) exited with code 3
[10/05/24 16:04:44] ERROR    Shutting down: Master
[10/05/24 16:04:44] ERROR    Reason: Worker failed to boot.
[10/05/24 16:04:54] INFO     Starting gunicorn 23.0.0
[10/05/24 16:04:54] INFO     Listening at: http://[::]:3003 (9)
[10/05/24 16:04:54] INFO     Using worker: app.config.CustomUvicornWorker
[10/05/24 16:04:54] INFO     Booting worker with pid: 10
[10/05/24 16:05:09] ERROR    Exception in worker process
                             ╭─────── Traceback (most recent call last) ───────╮
                             │ /opt/venv/lib/python3.11/site-packages/gunicorn │
                             │ /arbiter.py:608 in spawn_worker                 │
                             │                                                 │
                             │   605 │   │   │   util._setproctitle("worker [% │
                             │   606 │   │   │   self.log.info("Booting worker │
                             │   607 │   │   │   self.cfg.post_fork(self, work │
                             │ ❱ 608 │   │   │   worker.init_process()         │
                             │   609 │   │   │   sys.exit(0)                   │
                             │   610 │   │   except SystemExit:                │
                             │   611 │   │   │   raise                         │
                             │                                                 │
                             │ /opt/venv/lib/python3.11/site-packages/gunicorn │
                             │ /workers/base.py:135 in init_process            │
                             │                                                 │
                             │   132 │   │   │   self.reloader = reloader_cls( │
                             │   133 │   │   │   │   │   │   │   │   │   │     │
                             │   134 │   │                                     │
                             │ ❱ 135 │   │   self.load_wsgi()                  │
                             │   136 │   │   if self.reloader:                 │
                             │   137 │   │   │   self.reloader.start()         │
                             │   138                                           │
                             │                                                 │
                             │ /opt/venv/lib/python3.11/site-packages/gunicorn │
                             │ /workers/base.py:147 in load_wsgi               │
                             │                                                 │
                             │   144 │                                         │
                             │   145 │   def load_wsgi(self):                  │
                             │   146 │   │   try:                              │
                             │ ❱ 147 │   │   │   self.wsgi = self.app.wsgi()   │
                             │   148 │   │   except SyntaxError as e:          │
                             │   149 │   │   │   if not self.cfg.reload:       │
                             │   150 │   │   │   │   raise                     │
                             │                                                 │
                             │ /opt/venv/lib/python3.11/site-packages/gunicorn │
                             │ /app/base.py:66 in wsgi                         │
                             │                                                 │
                             │    63 │                                         │
                             │    64 │   def wsgi(self):                       │
                             │    65 │   │   if self.callable is None:         │
                             │ ❱  66 │   │   │   self.callable = self.load()   │
                             │    67 │   │   return self.callable              │
                             │    68 │                                         │
                             │    69 │   def run(self):                        │
                             │                                                 │
                             │ /opt/venv/lib/python3.11/site-packages/gunicorn │
                             │ /app/wsgiapp.py:57 in load                      │
                             │                                                 │
                             │   54 │   │   if self.cfg.paste is not None:     │
                             │   55 │   │   │   return self.load_pasteapp()    │
                             │   56 │   │   else:                              │
                             │ ❱ 57 │   │   │   return self.load_wsgiapp()     │
                             │   58                                            │
                             │   59                                            │
                             │   60 def run(prog=None):                        │
                             │                                                 │
                             │ /opt/venv/lib/python3.11/site-packages/gunicorn │
                             │ /app/wsgiapp.py:47 in load_wsgiapp              │
                             │                                                 │
                             │   44 │   │   │   │   raise ConfigError("No appl │
                             │   45 │                                          │
                             │   46 │   def load_wsgiapp(self):                │
                             │ ❱ 47 │   │   return util.import_app(self.app_ur │
                             │   48 │                                          │
                             │   49 │   def load_pasteapp(self):               │
                             │   50 │   │   from .pasterapp import get_wsgi_ap │
                             │                                                 │
                             │ /opt/venv/lib/python3.11/site-packages/gunicorn │
                             │ /util.py:370 in import_app                      │
                             │                                                 │
                             │   367 │   │   module, obj = parts[0], parts[1]  │
                             │   368 │                                         │
                             │   369 │   try:                                  │
                             │ ❱ 370 │   │   mod = importlib.import_module(mod │
                             │   371 │   except ImportError:                   │
                             │   372 │   │   if module.endswith(".py") and os. │
                             │   373 │   │   │   msg = "Failed to find applica │
                             │                                                 │
                             │ /usr/local/lib/python3.11/importlib/__init__.py │
                             │ :126 in import_module                           │
                             │                                                 │
                             │   123 │   │   │   if character != '.':          │
                             │   124 │   │   │   │   break                     │
                             │   125 │   │   │   level += 1                    │
                             │ ❱ 126 │   return _bootstrap._gcd_import(name[le │
                             │   127                                           │
                             │   128                                           │
                             │   129 _RELOADING = {}                           │
                             │ in _gcd_import:1204                             │
                             │ in _find_and_load:1176                          │
                             │ in _find_and_load_unlocked:1147                 │
                             │ in _load_unlocked:690                           │
                             │ in exec_module:940                              │
                             │ in _call_with_frames_removed:241                │
                             │                                                 │
                             │ /usr/src/app/main.py:21 in <module>             │
                             │                                                 │
                             │    18 from pydantic import ValidationError      │
                             │    19 from starlette.formparsers import MultiPa │
                             │    20                                           │
                             │ ❱  21 from app.models import get_model_deps     │
                             │    22 from app.models.base import InferenceMode │
                             │    23 from app.models.transforms import decode_ │
                             │    24                                           │
                             │                                                 │
                             │ /usr/src/app/models/__init__.py:9 in <module>   │
                             │                                                 │
                             │    6 from app.schemas import ModelSource, Model │
                             │    7                                            │
                             │    8 from .constants import get_model_source    │
                             │ ❱  9 from .facial_recognition.detection import  │
                             │   10 from .facial_recognition.recognition impor │
                             │   11                                            │
                             │   12                                            │
                             │                                                 │
                             │ /usr/src/app/models/facial_recognition/detectio │
                             │ n.py:4 in <module>                              │
                             │                                                 │
                             │    1 from typing import Any                     │
                             │    2                                            │
                             │    3 import numpy as np                         │
                             │ ❱  4 from insightface.model_zoo import RetinaFa │
                             │    5 from numpy.typing import NDArray           │
                             │    6                                            │
                             │    7 from app.models.base import InferenceModel │
                             │                                                 │
                             │ /opt/venv/lib/python3.11/site-packages/insightf │
                             │ ace/__init__.py:18 in <module>                  │
                             │                                                 │
                             │   15                                            │
                             │   16 from . import model_zoo                    │
                             │   17 from . import utils                        │
                             │ ❱ 18 from . import app                          │
                             │   19 from . import data                         │
                             │   20 from . import thirdparty                   │
                             │   21                                            │
                             │                                                 │
                             │ /opt/venv/lib/python3.11/site-packages/insightf │
                             │ ace/app/__init__.py:2 in <module>               │
                             │                                                 │
                             │   1 from .face_analysis import *                │
                             │ ❱ 2 from .mask_renderer import *                │
                             │   3                                             │
                             │                                                 │
                             │ /opt/venv/lib/python3.11/site-packages/insightf │
                             │ ace/app/mask_renderer.py:4 in <module>          │
                             │                                                 │
                             │     1 import os, sys, datetime                  │
                             │     2 import numpy as np                        │
                             │     3 import os.path as osp                     │
                             │ ❱   4 import albumentations as A                │
                             │     5 from albumentations.core.transforms_inter │
                             │     6 from .face_analysis import FaceAnalysis   │
                             │     7 from ..utils import get_model_dir         │
                             │                                                 │
                             │ /opt/venv/lib/python3.11/site-packages/albument │
                             │ ations/__init__.py:5 in <module>                │
                             │                                                 │
                             │    2                                            │
                             │    3 __version__ = "1.3.1"                      │
                             │    4                                            │
                             │ ❱  5 from .augmentations import *               │
                             │    6 from .core.composition import *            │
                             │    7 from .core.serialization import *          │
                             │    8 from .core.transforms_interface import *   │
                             │                                                 │
                             │ /opt/venv/lib/python3.11/site-packages/albument │
                             │ ations/augmentations/__init__.py:8 in <module>  │
                             │                                                 │
                             │    5 from .crops.transforms import *            │
                             │    6                                            │
                             │    7 # New transformations goes to individual f │
                             │ ❱  8 from .domain_adaptation import *           │
                             │    9 from .dropout.channel_dropout import *     │
                             │   10 from .dropout.coarse_dropout import *      │
                             │   11 from .dropout.cutout import *              │
                             │                                                 │
                             │ /opt/venv/lib/python3.11/site-packages/albument │
                             │ ations/augmentations/domain_adaptation.py:6 in  │
                             │ <module>                                        │
                             │                                                 │
                             │     3                                           │
                             │     4 import cv2                                │
                             │     5 import numpy as np                        │
                             │ ❱   6 from qudida import DomainAdapter          │
                             │     7 from skimage.exposure import match_histog │
                             │     8 from sklearn.decomposition import PCA     │
                             │     9 from sklearn.preprocessing import MinMaxS │
                             │                                                 │
                             │ /opt/venv/lib/python3.11/site-packages/qudida/_ │
                             │ _init__.py:6 in <module>                        │
                             │                                                 │
                             │    3                                            │
                             │    4 import cv2                                 │
                             │    5 import numpy as np                         │
                             │ ❱  6 from sklearn.decomposition import PCA      │
                             │    7 from typing_extensions import Protocol     │
                             │    8                                            │
                             │    9                                            │
                             │                                                 │
                             │ /opt/venv/lib/python3.11/site-packages/sklearn/ │
                             │ __init__.py:83 in <module>                      │
                             │                                                 │
                             │    80 │   │   __check_build,  # noqa: F401      │
                             │    81 │   │   _distributor_init,  # noqa: F401  │
                             │    82 │   )                                     │
                             │ ❱  83 │   from .base import clone               │
                             │    84 │   from .utils._show_versions import sho │
                             │    85 │                                         │
                             │    86 │   __all__ = [                           │
                             │                                                 │
                             │ /opt/venv/lib/python3.11/site-packages/sklearn/ │
                             │ base.py:19 in <module>                          │
                             │                                                 │
                             │     16 from . import __version__                │
                             │     17 from ._config import config_context, get │
                             │     18 from .exceptions import InconsistentVers │
                             │ ❱   19 from .utils import _IS_32BIT             │
                             │     20 from .utils._estimator_html_repr import  │
                             │     21 from .utils._metadata_requests import _M │
                             │     22 from .utils._param_validation import val │
                             │                                                 │
                             │ /opt/venv/lib/python3.11/site-packages/sklearn/ │
                             │ utils/__init__.py:22 in <module>                │
                             │                                                 │
                             │     19 from . import _joblib, metadata_routing  │
                             │     20 from ._bunch import Bunch                │
                             │     21 from ._estimator_html_repr import estima │
                             │ ❱   22 from ._param_validation import Interval, │
                             │     23 from .class_weight import compute_class_ │
                             │     24 from .deprecation import deprecated      │
                             │     25 from .discovery import all_estimators    │
                             │                                                 │
                             │ /opt/venv/lib/python3.11/site-packages/sklearn/ │
                             │ utils/_param_validation.py:15 in <module>       │
                             │                                                 │
                             │    12 from scipy.sparse import csr_matrix, issp │
                             │    13                                           │
                             │    14 from .._config import config_context, get │
                             │ ❱  15 from .validation import _is_arraylike_not │
                             │    16                                           │
                             │    17                                           │
                             │    18 class InvalidParameterError(ValueError, T │
                             │                                                 │
                             │ /opt/venv/lib/python3.11/site-packages/sklearn/ │
                             │ utils/validation.py:25 in <module>              │
                             │                                                 │
                             │     22                                          │
                             │     23 from .. import get_config as _get_config │
                             │     24 from ..exceptions import DataConversionW │
                             │ ❱   25 from ..utils._array_api import _asarray_ │
                             │     26 from ..utils.fixes import ComplexWarning │
                             │     27 from ._isfinite import FiniteStatus, cy_ │
                             │     28 from .fixes import _object_dtype_isnan   │
                             │                                                 │
                             │ /opt/venv/lib/python3.11/site-packages/sklearn/ │
                             │ utils/_array_api.py:9 in <module>               │
                             │                                                 │
                             │     6 import scipy.special as special           │
                             │     7                                           │
                             │     8 from .._config import get_config          │
                             │ ❱   9 from .fixes import parse_version          │
                             │    10                                           │
                             │    11                                           │
                             │    12 def _check_array_api_dispatch(array_api_d │
                             │                                                 │
                             │ /opt/venv/lib/python3.11/site-packages/sklearn/ │
                             │ utils/fixes.py:19 in <module>                   │
                             │                                                 │
                             │    16 import numpy as np                        │
                             │    17 import scipy                              │
                             │    18 import scipy.sparse.linalg                │
                             │ ❱  19 import scipy.stats                        │
                             │    20 import threadpoolctl                      │
                             │    21                                           │
                             │    22 import sklearn                            │
                             │                                                 │
                             │ /opt/venv/lib/python3.11/site-packages/scipy/st │
                             │ ats/__init__.py:608 in <module>                 │
                             │                                                 │
                             │   605                                           │
                             │   606 from ._warnings_errors import (ConstantIn │
                             │   607 │   │   │   │   │   │   │      Degenerate │
                             │ ❱ 608 from ._stats_py import *                  │
                             │   609 from ._variation import variation         │
                             │   610 from .distributions import *              │
                             │   611 from ._morestats import *                 │
                             │                                                 │
                             │ /opt/venv/lib/python3.11/site-packages/scipy/st │
                             │ ats/_stats_py.py:46 in <module>                 │
                             │                                                 │
                             │      43                                         │
                             │      44 import scipy.special as special         │
                             │      45 from scipy import linalg                │
                             │ ❱    46 from . import distributions             │
                             │      47 from . import _mstats_basic as mstats_b │
                             │      48 from ._stats_mstats_common import (_fin │
                             │      49 │   │   │   │   │   │   │   │      sieg │
                             │                                                 │
                             │ /opt/venv/lib/python3.11/site-packages/scipy/st │
                             │ ats/distributions.py:8 in <module>              │
                             │                                                 │
                             │    5 # NOTE: To look at history using `git blam │
                             │    6 #       instead of `git blame -Lxxx,+x`.   │
                             │    7 #                                          │
                             │ ❱  8 from ._distn_infrastructure import (rv_dis │
                             │    9                                            │
                             │   10 from . import _continuous_distns           │
                             │   11 from . import _discrete_distns             │
                             │                                                 │
                             │ /opt/venv/lib/python3.11/site-packages/scipy/st │
                             │ ats/_distn_infrastructure.py:26 in <module>     │
                             │                                                 │
                             │     23 from scipy import optimize               │
                             │     24                                          │
                             │     25 # for functions of continuous distributi │
                             │ ❱   26 from scipy import integrate              │
                             │     27                                          │
                             │     28 # to approximate the pdf of a continuous │
                             │     29 from scipy._lib._finite_differences impo │
                             │ in _handle_fromlist:1229                        │
                             │                                                 │
                             │ /opt/venv/lib/python3.11/site-packages/scipy/__ │
                             │ init__.py:189 in __getattr__                    │
                             │                                                 │
                             │   186 │                                         │
                             │   187 │   def __getattr__(name):                │
                             │   188 │   │   if name in submodules:            │
                             │ ❱ 189 │   │   │   return _importlib.import_modu │
                             │   190 │   │   else:                             │
                             │   191 │   │   │   try:                          │
                             │   192 │   │   │   │   return globals()[name]    │
                             │                                                 │
                             │ /usr/local/lib/python3.11/importlib/__init__.py │
                             │ :126 in import_module                           │
                             │                                                 │
                             │   123 │   │   │   if character != '.':          │
                             │   124 │   │   │   │   break                     │
                             │   125 │   │   │   level += 1                    │
                             │ ❱ 126 │   return _bootstrap._gcd_import(name[le │
                             │   127                                           │
                             │   128                                           │
                             │   129 _RELOADING = {}                           │
                             │                                                 │
                             │ /opt/venv/lib/python3.11/site-packages/scipy/in │
                             │ tegrate/__init__.py:95 in <module>              │
                             │                                                 │
                             │    92 from ._quadrature import *                │
                             │    93 from ._odepack_py import *                │
                             │    94 from ._quadpack_py import *               │
                             │ ❱  95 from ._ode import *                       │
                             │    96 from ._bvp import solve_bvp               │
                             │    97 from ._ivp import (solve_ivp, OdeSolution │
                             │    98 │   │   │   │      OdeSolver, RK23, RK45, │
                             ╰─────────────────────────────────────────────────╯
                             ╭─────────────────────────────────────────────────╮
                             │                                                 │
                             │ ▲                                               │
                             ╰─────────────────────────────────────────────────╯
                             SyntaxError: source code string cannot contain null
                             bytes
[10/05/24 16:05:11] INFO     Worker exiting (pid: 10)
[10/05/24 16:05:12] ERROR    Worker (pid:10) exited with code 3
[10/05/24 16:05:12] ERROR    Shutting down: Master
[10/05/24 16:05:12] ERROR    Reason: Worker failed to boot.


### Additional information

_No response_
bo0tzz commented 2 weeks ago

Can you try deleting the ML image and pulling it again? What sort of system are you running this on?

mmomjian commented 5 days ago

Closing for now