WebFaction
Community site: login faq

I need to install psycopg2 for a Django project. This is what I do:

$ pip psycopg2

This is the error I get:

  Running setup.py egg_info for package 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 ...

    [CUT]

Which is the /path/to/pg_config I should specify?

asked 27 Feb '12, 15:03

Guandalino
3711318
accept rate: 0%

edited 27 Feb '12, 15:03


pg_config is in the $PATH already on CentOS 5 machines.

On, CentOS 6 machines, it is in:

/usr/pgsql-9.1/bin/

Hence, you need to add that to your $PATH using:

export PATH=/usr/pgsql-9.1/bin:$PATH

to install psycopg2.

permanent link

answered 27 Feb '12, 20:17

neeravk
1.5k3412
accept rate: 41%

edited 27 Feb '12, 20:17

psycopg2 is actually installed server wide. But if you need to install a separate version, try using the command line in the docs here http://docs.webfaction.com/software/python.html?highlight=easy_install#installing-packages-with-pip

If you still have problems please post those details, or feel free to open a support ticket. https://help.webfaction.com/

permanent link

answered 27 Feb '12, 17:03

bmeyer71 ♦♦
1.5k3613
accept rate: 33%

Both the system wide and the local installation don't fit my case well, because I deploy Django projects each one in its own dedicated virtual env. For this reason I need to install the packages inside the environnment, I don't want to use system wide or local packages in ~/lib/python-X.Y or so. I already installed packages in virtual environments without any problem (activating the environment and using pip the way I said in the question), but that doesn't worked with psycopg2 and I wonder why. Thanks

(27 Feb '12, 18:20) Guandalino

To build the psql python bindings you will also need to build postgres to have the dev source available. I can understand your situation with virtualenv, yet still the easiest thing to do is to copy the library from the /usr/ copy into your virtualenv. This is the solution I use for my pinax sites. The only reason to build your own binding is if you need a modified copy, in which case you should build PostgreSQL from source too.

(27 Feb '12, 20:10) johns
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×909
×109
×4

question asked: 27 Feb '12, 15:03

question was seen: 21,674 times

last updated: 27 Feb '12, 20:17

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM