Installing pgvector on Window
08-09-2025
Insatalling pgvector:
- https://github.com/pgvector/pgvector
- https://github.com/pgvector/pgvector-python
- ensure C++ support in Visual Studio is installed and run
x64 Native Tools Command Prompt for VSas administrator, then usenmaketo build:
set "PGROOT=C:\Users\lmiloszewski\dev_programs\postgres\17.6-1\pgsql"
cd %TEMP%
git clone --branch v0.8.1 [https://github.com/pgvector/pgvector.git](https://github.com/pgvector/pgvector.git)
cd pgvector
nmake /F Makefile.win
nmake /F Makefile.win installValidate installation:
- validate installation by looking at postgres installation lib directory (for
vector.dll) and share directory (for extensions onvector.*)
C:\Users\LMILOS~1\AppData\Local\Temp\1\pgvector>^Lnmake /F Makefile.win
Microsoft (R) Program Maintenance Utility Version 14.40.33813.0
Copyright (C) Microsoft Corporation. All rights reserved.
...
Creating library vector.lib and object vector.exp
copy sql\vector.sql sql\vector--0.8.1.sql
1 file(s) copied.
C:\Users\LMILOS~1\AppData\Local\Temp\1\pgvector>nmake /F Makefile.win install
Microsoft (R) Program Maintenance Utility Version 14.40.33813.0
Copyright (C) Microsoft Corporation. All rights reserved.
copy vector.dll "C:\Users\lmiloszewski\dev_programs\postgres\17.6-1\pgsql\lib"
1 file(s) copied.
copy vector.control "C:\Users\lmiloszewski\dev_programs\postgres\17.6-1\pgsql\share\extension"
1 file(s) copied.
copy sql\vector--*.sql "C:\Users\lmiloszewski\dev_programs\postgres\17.6-1\pgsql\share\extension"
36 file(s) copied.
mkdir "C:\Users\lmiloszewski\dev_programs\postgres\17.6-1\pgsql\include\server\extension\vector"
for %f in (src\halfvec.h src\sparsevec.h src\vector.h) do copy %f "C:\Users\lmiloszewski\dev_programs\postgres\17.6-1\pgsql\include\server\extension\vector"
C:\Users\LMILOS~1\AppData\Local\Temp\1\pgvector>copy src\halfvec.h "C:\Users\lmiloszewski\dev_programs\postgres\17.6-1\pgsql\include\server\extension\vector"
1 file(s) copied.
C:\Users\LMILOS~1\AppData\Local\Temp\1\pgvector>copy src\sparsevec.h "C:\Users\lmiloszewski\dev_programs\postgres\17.6-1\pgsql\include\server\extension\vector"
1 file(s) copied.
C:\Users\LMILOS~1\AppData\Local\Temp\1\pgvector>copy src\vector.h "C:\Users\lmiloszewski\dev_programs\postgres\17.6-1\pgsql\include\server\extension\vector"
1 file(s) copied.Usage:
- sqlalchemy full text search
- parsing queries
- https://www.postgresql.org/docs/current/textsearch-controls.html#TEXTSEARCH-PARSING-QUERIES
- convert a query to the tsquery data type
websearch_to_tsquerycreates a tsquery value from querytext using an alternative syntax in which simple unformatted text is a valid query. Unlike plainto_tsquery and phraseto_tsquery, it also recognizes certain operators. Moreover, this function will never raise syntax errors, which makes it possible to use raw user-supplied input for search
session.execute(text('CREATE EXTENSION IF NOT EXISTS vector'))