Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cosine_ops does not exist for access method vectors #259

Open
Scridgeon opened this issue Dec 17, 2023 · 11 comments
Open

cosine_ops does not exist for access method vectors #259

Scridgeon opened this issue Dec 17, 2023 · 11 comments

Comments

@Scridgeon
Copy link

Scridgeon commented Dec 17, 2023

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
Copy link
Collaborator

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

@Scridgeon
Copy link
Author

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

@dnlldl
Copy link

dnlldl commented Dec 18, 2023

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
Copy link
Member

hydazz commented Dec 18, 2023

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

I too had fun with that barrier

@martabal
Copy link
Collaborator

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
Copy link

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
Copy link
Collaborator

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
Copy link

dnlldl commented Dec 18, 2023

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: immich-app/immich#5731 (comment)

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
Copy link

dnlldl commented Dec 19, 2023

Fixed it through tensorchord/pgvecto.rs#199.

@dkerlee
Copy link

dkerlee commented Dec 30, 2023

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

Where do I put this info?

@martabal
Copy link
Collaborator

Where do I put this info?

#254

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants