Search code examples
pythongitbashpostgresqlmulticorn

pg_config not found while I have it installed


I have installed postgresql development packages and I have it in C:/pgsql96 (in bin directory I have packages, such as pg_config, I also added the path to my environment variables. Now that I want to install Multicorn (a postgresql python package), I cloned the git repository of Multicorn in C:/Multicorn, and when I want to run make && make install command, I get the following error:

make: pg_config: Command not found
make: pythonpython:-config: Command not found
expr: syntax error
expr: syntax error
Python version is python:
./preflight-check.sh
which: no pg_config in (/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl)
No pg_config found in your path.
Please check if you installed the PostgreSQL development packages.
make: *** [Makefile:28: preflight-check] Error 1

I have python installed in my system because I have access to it from my command prompt (I run python --version and I see that I have it installed) but in MinGW bash which I am running make && make install, there is no python installed. Anyone knows how can I solve these problems:

1) pg_config in not in my path, although I added C:\pgsql96\bin to my system variables ( should it be added to user variables instead of system variavles? I also tried adding it to both environment variables!!) but the command:

which pg_config

returns me:

 no pg_config in (/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl)

2- I have access to python modules from my command prompt but I cannot access them from mingw bash, I need to work with mingw bash in order to be able to run make && make install commands. Can you please explain me when should I use command prompt and when should I use MinGW, and if there should be synchronization between these two?

UPDATE 1: For the first problem that pg_config was not found, I added the path to my mingw/bin directory. However, I have another problem about python.h:

make: pythonpython:-config: Command not found
Python version is python:
x86_64-w64-mingw32-gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2    -I. -I./ -IC:/pgsql96/include/server -IC:/pgsql96/include/internal -I/c/Builds/postgresql/source/src/include/port/win32 -DEXEC_BACKEND  -IC:/pgsql96/include/server/port/win32  -c -o src/errors.o src/errors.c
In file included from src/errors.c:15:0:
src/multicorn.h:1:20: fatal error: Python.h: No such file or directory
 #include "Python.h"
                    ^
compilation terminated.
make: *** [<builtin>: src/errors.o] Error 1

UPDATE 2:

I added Python path to the configuration process, and here is result: ANOTHER ERROR:

$ make && make install
Python version is 2.7
[ -d sql ] || mkdir sql
[ -d src ] || mkdir src
touch directories.stamp
x86_64-w64-mingw32-gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2  -I/usr/include/python2.7 -I/usr/include/python2.7  -I. -I./ -IC:/pgsql96/include/server -IC:/pgsql96/include/internal -I/c/Builds/postgresql/source/src/include/port/win32 -DEXEC_BACKEND  -IC:/pgsql96/include/server/port/win32  -c -o src/errors.o src/errors.c
make: *** [<builtin>: src/errors.o] Error 1

Any idea?


Solution

  • Try

    PATH="/c/pgsql96/bin:$PATH" make