Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pg_config executable not found

I am having trouble installing psycopg2. I get the following error when I try to pip install psycopg2:

Error: pg_config executable not found.  Please add the directory containing pg_config to the PATH  or specify the full executable path with the option:        python setup.py build_ext --pg-config /path/to/pg_config build ...    or with the pg_config option in 'setup.cfg'.  ---------------------------------------- Command python setup.py egg_info failed with error code 1 in /tmp/pip-build/psycopg2 

But the problem is pg_config is actually in my PATH; it runs without any problem:

$ which pg_config /usr/pgsql-9.1/bin/pg_config 

I tried adding the pg_config path to the setup.cfg file and building it using the source files I downloaded from their website (http://initd.org/psycopg/) and I get the following error message!

Error: Unable to find 'pg_config' file in '/usr/pgsql-9.1/bin/' 

But it is actually THERE!!!

I am baffled by these errors. Can anyone help please?

By the way, I sudo all the commands. Also I am on RHEL 5.5.

like image 855
user1448207 Avatar asked Jul 23 '12 19:07

user1448207


2 Answers

pg_config is in postgresql-devel (libpq-dev in Debian/Ubuntu, libpq-devel on Centos/Fedora/Cygwin/Babun.)

like image 88
TilmanBaumann Avatar answered Oct 16 '22 14:10

TilmanBaumann


On Mac OS X, I solved it using the homebrew package manager

brew install postgresql 
like image 40
azalea Avatar answered Oct 16 '22 14:10

azalea