Skip to content

Pre-compiled extension does not load on Windows 11 (The specified module could not be found) #45

Description

@reasv

Same issue as #13

I'm on Windows 11 64 bit, Python 3.12, SQLite 3.45 and sqlite-vec = "^0.0.1a36"

I wrote this function to make the result more explicit:

def load_sqlite_vec(conn: sqlite3.Connection) -> sqlite3.Connection:
    sqlite_version = conn.execute("select sqlite_version()").fetchone()
    print(f"SQLite version: {sqlite_version}")
    import sys

    print(f"Python version: {sys.version}")
    # Load the SQLite vector extension
    conn.enable_load_extension(True)
    # sqlite_vec.load(conn)
    sqlite_vec_path = sqlite_vec.loadable_path()
    print(f"Loading SQLite vector extension from {sqlite_vec_path}")
    if os.path.exists(sqlite_vec_path + ".dll"):
        try:
            conn.load_extension(sqlite_vec_path)
        except sqlite3.OperationalError as e:
            print(f"Error loading extension: {e}")
        try:
            conn.load_extension(sqlite_vec_path + ".dll")
        except sqlite3.OperationalError as e:
            print(f"Error loading extension: {e}")
    else:
        print(f"Could not find SQLite vector extension at {sqlite_vec_path}")
    conn.enable_load_extension(False)
    return conn

Outputs:

SQLite version: ('3.45.3',)
Python version: 3.12.4 (tags/v3.12.4:8e8a4ba, Jun  6 2024, 19:30:16) [MSC v.1940 64 bit (AMD64)]
Loading SQLite vector extension from .venv\Lib\site-packages\sqlite_vec\vec0
Error loading extension: The specified module could not be found.

Error loading extension: The specified module could not be found.

The file vec0.dll is present, as is evident from os.path.exists succeeding.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions