-
Notifications
You must be signed in to change notification settings - Fork 21
Installation Notes
If your machine has multiple Postgres installations, specify the path to pg_config with:
export PG_CONFIG=/Library/PostgreSQL/18/bin/pg_configThen re-run the installation instructions (run make clean before make if needed). If sudo is needed for make install, use:
sudo --preserve-env=PG_CONFIG make installA few common paths on Mac are:
- EDB installer -
/Library/PostgreSQL/18/bin/pg_config - Homebrew (arm64) -
/opt/homebrew/opt/postgresql@18/bin/pg_config - Homebrew (x86-64) -
/usr/local/opt/postgresql@18/bin/pg_config
Note: Replace 18 with your Postgres server version
If compilation fails with fatal error: postgres.h: No such file or directory, make sure Postgres development files are installed on the server.
For Ubuntu and Debian, use:
sudo apt install postgresql-server-dev-18Note: Replace 18 with your Postgres server version
If compilation fails and the output includes warning: no such sysroot directory on Mac, your Postgres installation points to a path that no longer exists.
pg_config --cppflagsReinstall Postgres to fix this.
By default, pgvector compiles with -march=native on some platforms for best performance. However, this can lead to Illegal instruction errors if trying to run the compiled extension on a different machine.
To compile for portability, use:
make OPTFLAGS=""If compilation fails with Cannot open include file: 'postgres.h': No such file or directory, make sure PGROOT is correct.
If compilation fails with error C2196: case value '4' already used, make sure you’re using the x64 Native Tools Command Prompt. Then run nmake /F Makefile.win clean and re-run the installation instructions.
If linking fails with unresolved external symbol float_to_shortest_decimal_bufn with Postgres 17.0-17.2, upgrade to Postgres 17.3+.
If installation fails with Access is denied, re-run the installation instructions as an administrator.
Get the Docker image with:
docker pull pgvector/pgvector:pg18-trixieThis adds pgvector to the Postgres image (replace 18 with your Postgres server version, and run it the same way).
Supported tags are:
-
pg18-trixie,0.8.2-pg18-trixie -
pg18-bookworm,0.8.2-pg18-bookworm,pg18,0.8.2-pg18 -
pg17-trixie,0.8.2-pg17-trixie -
pg17-bookworm,0.8.2-pg17-bookworm,pg17,0.8.2-pg17 -
pg16-trixie,0.8.2-pg16-trixie -
pg16-bookworm,0.8.2-pg16-bookworm,pg16,0.8.2-pg16 -
pg15-trixie,0.8.2-pg15-trixie -
pg15-bookworm,0.8.2-pg15-bookworm,pg15,0.8.2-pg15 -
pg14-trixie,0.8.2-pg14-trixie -
pg14-bookworm,0.8.2-pg14-bookworm,pg14,0.8.2-pg14 -
pg13-trixie,0.8.2-pg13-trixie -
pg13-bookworm,0.8.2-pg13-bookworm,pg13,0.8.2-pg13
You can also build the image manually:
git clone --branch v0.8.2 https://github.com/pgvector/pgvector.git
cd pgvector
docker build --pull --build-arg PG_MAJOR=18 -t myuser/pgvector .If you increase maintenance_work_mem, make sure --shm-size is at least that size to avoid an error with parallel HNSW index builds.
docker run --shm-size=1g ...With Homebrew Postgres, you can use:
brew install pgvectorNote: This only adds it to the postgresql@18 and postgresql@17 formulas
Install from the PostgreSQL Extension Network with:
pgxn install vectorDebian and Ubuntu packages are available from the PostgreSQL APT Repository. Follow the setup instructions and run:
sudo apt install postgresql-18-pgvectorNote: Replace 18 with your Postgres server version
RPM packages are available from the PostgreSQL Yum Repository. Follow the setup instructions for your distribution and run:
sudo yum install pgvector_18
# or
sudo dnf install pgvector_18Note: Replace 18 with your Postgres server version
Install the FreeBSD package with:
pkg install postgresql17-pgvectoror the port with:
cd /usr/ports/databases/pgvector
make installInstall the Alpine package with:
apk add postgresql-pgvectorWith Conda Postgres, install from conda-forge with:
conda install -c conda-forge pgvectorThis method is community-maintained by @mmcauliffe
Download the latest release with Postgres 15+.
pgvector is available on these providers.
Install the latest version (use the same method as the original installation). Then in each database you want to upgrade, run:
ALTER EXTENSION vector UPDATE;You can check the version in the current database with:
SELECT extversion FROM pg_extension WHERE extname = 'vector';