I have literally tried all top 20 solutions from Google and stackoverflow but I cannot get my postgres 17 to install an extension called 'pgvector'. When I enter 'make' or 'cl' , i can see those are added to my path and the terminal input is able to open those exe files. I even installed WSL as suggested by AI. I cloned the repo for pgvector in my documents folder, and when I reach there using the Powershell command (admin) and run the command make, I get this error
C:\Users\rohit\Documents\Coding\pgvector>make cl -Wall -O2 /wd4018 /wd4244 /wd4273 /wd4101 /wd4102 /wd4090 /wd4267 -march=native -ftree-vectorize -fassociative-math -fno-signed-zeros -fno-trapping-math -I. -I./ -IC:/PROGRA~1/PostgreSQL/17/include/server -IC:/PROGRA~1/PostgreSQL/17/include/internal /DWIN32 /DWINDOWS /D__WINDOWS__ /D__WIN32__ /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE -IC:/PROGRA~1/PostgreSQL/17/include/server/port/win32 -DWIN32_STACK_RLIMIT=4194304 -c -o src/bitutils.o src/bitutils.c Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30157 for x86 Copyright (C) Microsoft Corporation. All rights reserved.
trapping-math' bitutils.c C:\Program Files\PostgreSQL\17\include\server\c.h(75): fatal error C1083: Cannot open include file: 'libintl.h': No such file or directory make: *** [: src/bitutils.o] Error 2
Anybody has any idea what I can do? I even tried using the docker image method, and even with that docker image running, when i run the make command i still get similar error.
I have installed VS studio code with the C++ tools installed on my system as well.
I have tried using this command as well:
"C:\Program Files\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x64
but my system does not have that VC and later folders. Should I reinstall my postgres 17 or reisntall vs studio code?
I believe all my paths are fixed as no more errors such as cl.exe not found or make not found.
If I get to psql and run
ERROR: extension "pgvector" is not available DETAIL: Could not open extension control file "C:/Program Files/PostgreSQL/17/share/extension/pgvector.control": No such file or directory. HINT: The extension must first be installed on the system where PostgreSQL is running.
The weird part is, I can see my system having this exact file called c.h in the same directory as the error above suggests. I saw on my antivirus if there was a permissions error but there was none.
Following the repos exact documentation, I was able to run the command
cd "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build" and I get a message [vcvarsall.bat] Environment initialized for: 'x64'
After that when I clone a new repo for pgvector I get this new error:
C:\Users\rohit\AppData\Local\Temp\pgvector>nmake /F Makefile.win install
Microsoft (R) Program Maintenance Utility Version 14.43.34808.0 Copyright (C) Microsoft Corporation. All rights reserved.
copy vector.dll "C:\Program Files\PostgreSQL\17\lib" Access is denied. 0 file(s) copied. NMAKE : fatal error U1077: 'copy vector.dll "C:\Program Files\PostgreSQL\17\lib"' : return code '0x1' Stop.
Please Note I ran these commands on Powershell Run as administrator and even on MS VS code launch option terminal.
As you can see from the terminal output after running nmake, it does show that it has been installed. It even showed me installing 100s of files named pgvector, but when I restart my postgres service and see if my postgres has any extension named pgvector it just says cant find anyhting
Following the instructions, I was also able to run the nmake command after cloning the pgvector repo, and it even shows it installed it correctly (I am assuming?) but still after restarting the postgres service or the whole system, inside psql i cannot use that extension
C:\pgvector>nmake /F Makefile.win install Microsoft (R) Program Maintenance Utility Version 14.43.34808.0 Copyright (C) Microsoft Corporation. All rights reserved.
cl /nologo /I"C:\Program Files\PostgreSQL\17\include\server\port\win32_msvc" /I"C:\Program
Files\PostgreSQL\17\include\server\port\win32" /I"C:\Program Files\PostgreSQL\17\include\server" /I"C:\Program Files\PostgreSQL\17\include" /O2 /fp:fast /c src\hnsw.c /Fosrc\hnsw.obj hnsw.c C:\Program Files\PostgreSQL\17\include\server\access/tupmacs.h(65): error C2196: case value '4' already used C:\Program Files\PostgreSQL\17\include\server\access/tupmacs.h(197): error C2196: case value '4' already used NMAKE : fatal error U1077: 'cl /nologo /I"C:\Program Files\PostgreSQL\17\include\server\port\win32_msvc" /I"C:\Program Files\PostgreSQL\17\include\server\port\win32" /I"C:\Program Files\PostgreSQL\17\include\server" /I"C:\Program Files\PostgreSQL\17\include" /O2 /fp:fast /c src\hnsw.c /Fosrc\hnsw.obj' : return code '0x2' Stop.
Also, is it really this hard to install a simple postgres extension on a windows system?all unix or mac system can just use any package manager but windows users are forced to install through VS studio and I still am stuck on this for 2 full days.
Offloading the entire dependency management effort to a package manager side-steps most of these problems, like you pointed out yourself:
unix or mac system can just use any package manager but windows users are forced to install through VS studio
VS studio has a package manager in it. PostgreSQL also officially recommends a dedicated package manager from EnterpriseDB, the StackBuilder. The pgvector
module is listed among their supported non-contribs:
You just tick a box and let it go through that .DLL hell on its own.
pgvector
in there as well.pg_vector
's readme.md mentions it's possible to point it to the right one. If that's just your local dev environment, you can pg_dump
the contents of your db and do a clean re-install of just one.