asg017 / sqlite-vss

A SQLite extension for efficient vector search, based on Faiss!
MIT License
1.58k stars 58 forks source link

zsh: illegal hardware instruction #121

Open ankurt opened 4 months ago

ankurt commented 4 months ago

I've built a macOS app that bundles sqlite with this extension. I re-built python and enabled it with loadable extensions and it works fine on my mac, running 13.1.0 Ventura. Unfortunately the same vss0.dylib and vector0.dylib seem are returning these errors for the people I've distributed the bundle too:

Terminal:
> illegal hardware instruction

Apple Crash report:
> Execption Type: EXC_BAD_INSTRUCTION (SIGILL)
> Termination Reason: Namespace SIGNAL, Code 4 Illegal instruction: 4

In our code base, we run:

  create_statements = [ """
      CREATE VIRTUAL TABLE webpage_embeddings using vss0(
          body_embedding(384),
      );
      """]
  print("Creating virtual embedding tables")
  with VssSession.engine.connect() as connection:
      # VssSession handles loading the extension in another module, but it works fine on my computer and a few users:
      # import sqlite_vss
      #  dbapi_con.enable_load_extension(True) 
      #  sqlite_vss.load(dbapi_con)
      #  dbapi_con.enable_load_extension(False)

      for statement in create_statements:
          connection.execute(statement) <--------- Seems to be crashing here based on logs

It seems to not be working for users before 13.1 since I built mac bundle on my computer, but randomly it is working for some users on 13.0. We cannot be sure if its actually a mac app version issue or something else.

We tried building the dylibs for sqlite-vss directly as well by including: set(ENV{MACOSX_DEPLOYMENT_TARGET} “11”) in the CMake file, and swapping them out in the sqlite-vss library within the .venv but this didn't work either .

To get it working on my computer: brew install sqlite3 Installed python v3.10.13 using pyenv with PYTHON_CONFIGURE_OPTS="--enable-shared --enable-loadable-sqlite-extensions" poetry install sqlite-vss

Do you have any suggestions?

romiras commented 2 months ago

There is a note in documentation about support of AVX2 instructions