imagegenius / docker-immich

Monolithic (Single) Docker Container for Immich
GNU General Public License v3.0
627 stars 29 forks source link

cosine_ops does not exist for access method vectors #259

Open Scridgeon opened 11 months ago

Scridgeon commented 11 months ago

I upgraded to the latest release of immich and now it will not connect to my Postgres 14 container (tensorchord/pgvecto-rs:pg14-latest).

The Immich logs are filled with the following error message that keeps repeating.

ERROR [TypeOrmModule] Unable to connect to the database. Retrying (8)... QueryFailedError: operator class "cosine_ops" does not exist for access method "vectors" at PostgresQueryRunner.query (/app/immich/server/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:211:19) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async AddCLIPEmbeddingIndex1700713994428.up (/app/immich/server/dist/infra/migrations/1700713994428-AddCLIPEmbeddingIndex.js:9:9) at async MigrationExecutor.executePendingMigrations (/app/immich/server/node_modules/typeorm/migration/MigrationExecutor.js:225:17) at async DataSource.runMigrations (/app/immich/server/node_modules/typeorm/data-source/DataSource.js:260:35) at async DataSource.initialize (/app/immich/server/node_modules/typeorm/data-source/DataSource.js:148:17)

martabal commented 11 months ago

You have to use tensorchord/pgvecto-rs:pg14-v0.1.11

Scridgeon commented 11 months ago

Thanks, that worked! How do I ensure the PG version is correct moving forward if there are release changes?

dnlldl commented 11 months ago

That's annoying, took me hours to figure out how to build from source on OpenSUSE (never used Rust before). Will do some testings tomorrow with the correct release this time rather than a git clone. Should be faster now that I went through all the potential barriers (that's after thinking pgvector and pgvecto.rs were the same, oopsies).

hydazz commented 11 months ago

that's after thinking pgvector and pgvecto.rs were the same, oopsies

I too had fun with that barrier

martabal commented 11 months ago

Thanks, that worked! How do I ensure the PG version is correct moving forward if there are release changes?

I think you have to read Immich release notes which will say when to update your postgres container.

naxiemolv commented 11 months ago

ERROR [TypeOrmModule] Unable to connect to the database. Retrying (9)... QueryFailedError: could not open extension control file "/usr/share/postgresql/14/extension/vectors.control": No such file or directory

martabal commented 11 months ago

ERROR [TypeOrmModule] Unable to connect to the database. Retrying (9)... QueryFailedError: could not open extension control file "/usr/share/postgresql/14/extension/vectors.control": No such file or directory

Are you using the tensorchord/pgvecto-rs:pg14-v0.1.11 image ?

dnlldl commented 11 months ago

I downgraded to v0.1.11 and now have a new error:

[Nest] 831  - 12/18/2023, 1:46:49 PM   ERROR [ExceptionHandler] could not find function "typmod_in_wrapper" in file "/usr/lib/postgresql14/lib64/vectors.so"
QueryFailedError: could not find function "typmod_in_wrapper" in file "/usr/lib/postgresql14/lib64/vectors.so"
    at PostgresQueryRunner.query (/app/immich/server/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:211:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async UsePgVectors1700713871511.up (/app/immich/server/dist/infra/migrations/1700713871511-UsePgVectors.js:19:9)
    at async MigrationExecutor.executePendingMigrations (/app/immich/server/node_modules/typeorm/migration/MigrationExecutor.js:225:17)
    at async DataSource.runMigrations (/app/immich/server/node_modules/typeorm/data-source/DataSource.js:260:35)
    at async DataSource.initialize (/app/immich/server/node_modules/typeorm/data-source/DataSource.js:148:17)

Edit: just noticed this: https://github.com/immich-app/immich/issues/5731#issuecomment-1858687776

I guess I'll try to clean things up as much as possible and restart from scratch.

So far without success.

vm-dev:~ # rm -rf /var/lib/pgsql/data/pg_vectors
vm-dev:~ # rm /usr/lib/postgresql14/lib64/vectors.so
vm-dev:~ # rm /usr/share/postgresql14/extension/vectors.control
vm-dev:~ # rm /usr/share/postgresql14/extension/vectors--0.1.1.sql
vm-dev:~ # rm /usr/share/postgresql14/extension/vectors--0.0.0.sql
vm-dev:~ # rm -rf /root/.rustup/toolchains/*
vm-dev:~ # rm -rf /var/lib/pgsql/.rustup/toolchains/*
dnlldl commented 11 months ago

Fixed it through https://github.com/tensorchord/pgvecto.rs/issues/199.

dkerlee commented 11 months ago

You have to use tensorchord/pgvecto-rs:pg14-v0.1.11

Where do I put this info?

martabal commented 11 months ago

Where do I put this info?

https://github.com/imagegenius/docker-immich/issues/254