Re: Installing via pip under Win7 + virtualenv + VC++2008 - Mailing list psycopg

From Stephen Lacy
Subject Re: Installing via pip under Win7 + virtualenv + VC++2008
Date
Msg-id BANLkTik2YtxUvhyimTzQ9pGyi7o65OXxog@mail.gmail.com
Whole thread Raw
In response to Re: Installing via pip under Win7 + virtualenv + VC++2008  (Daniele Varrazzo <daniele.varrazzo@gmail.com>)
Responses Re: Installing via pip under Win7 + virtualenv + VC++2008  (Daniele Varrazzo <daniele.varrazzo@gmail.com>)
List psycopg
Yeah, I went down this track as well.  And in short, here's where I am:

I didn't have C:\...\PostgreSQL\8.4\bin on my path. 
So, after building my env and installing, I added it to my path.  "import psycopg2" worked, which was good. 

But then, as a sanity check, I nuked the env and am now trying to rebuild it.  "pip install psycopg" is currently failing with "Error: pg_config executable not found" even though I've got it on my path and can run it directly from the commandline.  Even more odd is how "pip install psycopg2" works *without* PostgreSQL in my path, but *fails* if I have it in.  Very, very confusing. :) 

Here's the output from "pip install psycopg2" when I have PostgreSQL in my path.  

(env) C:\Users\Steve Lacy\Desktop\src\explore>pip install psycopg2
Downloading/unpacking psycopg2
  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 ...

    or with the pg_config option in 'setup.cfg'.
    Complete output from command python setup.py egg_info:
    running egg_info

writing pip-egg-info\psycopg2.egg-info\PKG-INFO

writing top-level names to pip-egg-info\psycopg2.egg-info\top_level.txt

writing dependency_links to pip-egg-info\psycopg2.egg-info\dependency_links.txt

warning: manifest_maker: standard file '-c' not found



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
Storing complete log in C:\Users\Steve Lacy\AppData\Roaming\pip\pip.log

(env) C:\Users\Steve Lacy\Desktop\src\explore>echo %PATH%
C:\Users\Steve Lacy\Desktop\src\explore\env\Scripts;C:\Windows\system32;C:\Windo
ws;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Progr
am Files\Git\cmd;C:\Program Files\Mercurial\;C:\Program Files\PostgreSQL\8.4\bin
;C:\Python27;

(env) C:\Users\Steve Lacy\Desktop\src\explore>pg_config
BINDIR = C:/PROGRA~1/POSTGR~1/8.4/bin
DOCDIR = C:/PROGRA~1/POSTGR~1/8.4/doc
HTMLDIR = C:/PROGRA~1/POSTGR~1/8.4/doc
INCLUDEDIR = C:/PROGRA~1/POSTGR~1/8.4/include
PKGINCLUDEDIR = C:/PROGRA~1/POSTGR~1/8.4/include
INCLUDEDIR-SERVER = C:/PROGRA~1/POSTGR~1/8.4/include/server
LIBDIR = C:/PROGRA~1/POSTGR~1/8.4/lib
PKGLIBDIR = C:/PROGRA~1/POSTGR~1/8.4/lib
LOCALEDIR = C:/PROGRA~1/POSTGR~1/8.4/share/locale
MANDIR = C:/Program Files/PostgreSQL/8.4/man
SHAREDIR = C:/PROGRA~1/POSTGR~1/8.4/share
SYSCONFDIR = C:/Program Files/PostgreSQL/8.4/etc
PGXS = C:/Program Files/PostgreSQL/8.4/lib/pgxs/src/makefiles/pgxs.mk
CONFIGURE = --enable-thread-safety --enable-integer-datetimes --enable-nls --wit
h-ldap --with-ossp-uuid --with-libxml --with-libxslt --with-krb5 --with-tcl --wi
th-perl --with-python
VERSION = PostgreSQL 8.4.8

On Fri, Jun 3, 2011 at 12:54 AM, Daniele Varrazzo <daniele.varrazzo@gmail.com> wrote:
On Fri, Jun 3, 2011 at 12:07 AM, Stephen Lacy <slacy@slacy.com> wrote:

> ImportError: DLL load failed: The specified module could not be found.

the file _psycopg.pyd is a dll. For its relatively small size it is
probably dynamically linked to the libpq.dll. I think the system
either fails to find libpq.dll or some of the other dependencies (they
are listed in the setup.py).

I suggest you to use a tool to check its dll dependencies (maybe
http://www.dependencywalker.com/ could be ok) and see if there is
anything missing. If libpq.dll is the missing one, try putting it in a
PATH directory or in the psycopg2 package directory.

Jason, what is the default for building psycopg on windows: static or
dynamic libpq? Is there any default setting we may change to make
psycopg installable with pip/easy_install (if it currently fails - I
don't know).

-- Daniele

psycopg by date:

Previous
From: Federico Di Gregorio
Date:
Subject: Re: Transaction control overhauling
Next
From: Daniele Varrazzo
Date:
Subject: Re: Installing via pip under Win7 + virtualenv + VC++2008