Re: Installing via pip under Win7 + virtualenv + VC++2008

From: Jason Erickson <jerickso(at)stickpeople(dot)com>
To: Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>
Cc: Stephen Lacy <slacy(at)slacy(dot)com>, psycopg(at)postgresql(dot)org
Subject: Re: Installing via pip under Win7 + virtualenv + VC++2008
Date: 2011-06-04 15:19:31
Message-ID: 20110604084247.X70586@stickpeople.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

On Fri, 3 Jun 2011, Daniele Varrazzo wrote:

> On Fri, Jun 3, 2011 at 12:07 AM, Stephen Lacy <slacy(at)slacy(dot)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).

The default for bulding psycopg is static, but...
it is probably being linked to the dynamic library if the prebuilt
version of PostgreSQL is used.

The main difference between static and dynamic is the link library name.

When built from source, the static library is named libpq.lib and the
dynamic library is libpqdll.lib.

When using the binary distrubtion of PostgreSQL for windows, the dynamic
library is named libpq.lib (I am not aware of a static library in the
distribution). Note that using the binary distribution will require not
only the libpq.dll in the path, but also the openssl libraries in the path
(libeay32.dll and ssleay32.dll).

Don't ask me why the name difference between source build and binary
distribution (besides to cause confusion). :)

I am probably a special case as I build everything from source. I can see
most people building psycopg2 from source using the prebuilt PostgreSQL
binaries, so we should make sure it builds in that configuration.
Challenges I see is that 1) we should make sure that the libpq dlls are
in the path so can be found with python, 2) if a psycopg2 distribution
file is made, we would also need to include in the dlls.

-jason

>
> -- Daniele
>

In response to

Responses

Browse psycopg by date

  From Date Subject
Next Message Daniele Varrazzo 2011-06-04 15:47:14 Re: Installing via pip under Win7 + virtualenv + VC++2008
Previous Message Daniele Varrazzo 2011-06-04 01:01:14 Re: Deadlock