Thursday, February 16, 2017

Install psycopg2 on a Greenplum system

If you try to install psycopg2 on a Greenplum system using pip you may run into this error:

...
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'.
...

The solution is to add the path to the Greenplum bin directory to your environment PATH.

export PATH=$PATH:/path/to/greenplum-db/bin/

Then run pip install psycopg2 and all should be good.