Lantern HNSW
Installation
lantern_hnsw is a Postgres extension that provides vector search inside Postgres.
Lantern builds and uses usearch, a single-header state-of-the-art HNSW implementation.
It is available as a Docker image, a Homebrew package, a binary, or from source.
Run with Docker
For convenience, we provide the Lantern Suite Docker image, which includes both Lantern and Lantern Extras. This enables both vector search and vector generation inside Postgres.
docker run -p 5432:5432 --name lantern-demo -e 'POSTGRES_PASSWORD=postgres' -d lanterndata/lantern-suite:pg15-latestAlternatively, to install only Lantern for vector search, we provide the Lantern Docker image.
docker run -p 5432:5432 --name lantern-demo -e 'POSTGRES_PASSWORD=postgres' -d lanterndata/lantern:pg15-latestNote: The image is based on the official Postgres docker image. Please refer to the Postgres image documentation for a full list of supported features and flags.
Install From Binaries
Prerequisites
- PostgreSQL 11, 12, 13, 14, 15, 16, 17
 
Supported platforms
- Linux (x86_64)
 - Mac (intel)
 
Installation
Use our releases from GitHub.
Note: You can replace LDB_VERSION with the version you want to install
cd /tmp
LDB_VERSION=0.4.1
wget "https://github.com/lanterndata/lantern/releases/download/v${LDB_VERSION}/lantern-${LDB_VERSION}.tar"
tar xf "lantern-${LDB_VERSION}.tar"
cd "lantern-${LDB_VERSION}"
make installInstall From Homebrew
Prerequisites
Supported platforms
- Mac
 
Installation
brew tap lanterndata/lantern
brew install lantern && lantern_installInstall From Source
Prerequisites
- cmake version: >=3.3
 - gcc && g++ version: >=11 when building portable binaries, >= 12 when building on new hardware or with CPU-specific vectorization
 - PostgreSQL 11, 12, 13, 14, 15, 16, or 17
 - Corresponding development package for PostgreSQL (postgresql-server-dev-$version)
 
Supported platforms
- Linux
 - Mac
 
Installation
To build Lantern on new hardware or with CPU-specific vectorization:
git clone --recursive https://github.com/lanterndata/lantern.git
cd lantern
cmake -DMARCH_NATIVE=ON -S lantern_hnsw -B build
make -C build install -jTo build portable Lantern binaries:
git clone --recursive https://github.com/lanterndata/lantern.git
cd lantern
cmake -DMARCH_NATIVE=OFF -S lantern_hnsw -B build
make -C build install -jIf you have previously cloned Lantern and would like to update, run git pull && git submodule update --recursive
Post Installation
If you are not on Lantern Cloud, make sure you enable the extension after following the installation steps for Lantern.
CREATE EXTENSION IF NOT EXISTS lantern;