?

Log in

No account? Create an account

Previous Entry | Next Entry

Installing PyGreSQL isn't trivial, especially on Dell computers.  Here's a recipe that worked for me and Python 2.5:

  1. Download and install postgresql-8.3.5-2-windows.exe  (You shouldn't need the whole install.)
  2. Add C:\Program Files\PostgreSQL\8.3\lib to your PATH for libpq.dll.
  3. Add C:\Program Files\PostgreSQL\8.3\bin to your PATH for ssleay32.dll.
  4. Hide System32's copy of LIBEAY32.dll  (If you're on a DELL, and that one is far smaller and older than the others.)
  5. Download and install PyGreSQL-4.0.win32-py2.5.exe
And here's some explanation with accompanying error text so that people searching for a solution to this problem can find it.  Here's my experience:

Downloaded PyGreSQL first, before realizing it had dependencies to a postgresql install.  Got some nebulous ImportErrors when I tried to "import pg".

from _pg import *
ImportError: DLL load failed: The specified module could not be found.
Great.  What module?  Searching the web, I discovered I needed to install postgresql.  So I did, but I still got the error, even after updating the system's PATH variable.  (Note, sys.path and os.environ("PATH") are two different things.)  Eventually I discovered this great tip:

Try doing the failing import from the Python command line.  (Start->Python 2.5->Python (command line)).  Doing that will actually display a modal dialog that says exactly which dll could not be loaded.  Yay!

Finally, I got the LIBEAY32.dll error mentioned above, the exact text of which follows:

The ordinal 2821 could not be located in the dynamic link library LIBEAY32.dll
and once I hid the old LIBEAY32.dll, I got pg linking with the correct libraries, I was good to go.  Hope this helps somebody.

Comments

bothwill
Oct. 21st, 2010 06:14 pm (UTC)
I get the same error every time I try to install the software. I should tell that I am not using a Dell, are these steps actually specific just for Dell computers? I even searched for more information on Microsoft dll files and I think I found a valuable track there. Is there any other resource you could share on this topic?