Problem setting up psycopg2 under Windows

Problem setting up psycopg2 under Windows

04, Sep 2009 André Kolell

When I set up Pylons today in a virtual isolated Python environment on my Windows machine, I had a little fight with psycopg2 (which usually allows me to connect to my PostgreSQL database). At first, everytime I tried to “easy_install psycopg2″, I ended up with the error message “unable to find vcvarsall.bat”.

Luckily I found a solution to get the “unable to find vcvarsall.bat” problem fixed.

But unfortunately there was another error when I wanted paster to serve:

File “C:\Python26\lib\site-packages\psycopg2\__init__.py”,
line 60, in <module>
from _psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: DLL load failed: This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.

Of course, reinstallation did not fix the problem. I thought the whole challenge might be caused by my virtual environment, because Jason Erickson (who publishes the psycopg Windows binaries) mentioned problems that would occur when using psycopg with virtual environments in his blog. But nothing I tried improved my situation.

Solution: Use an older version (2.0.10) of psycopg2!

Later on I found a post in Google Groups, where someone had a similar problem with psycopg2 under Windows. He figured out that there was something wrong with the build of psycopg2 (version 2.0.12) and that simply using an older version (for example 2.0.10) worked fine… That made my day!

You can find the Windows Download here: http://www.stickpeople.com/projects/python/win-psycopg/

Next Post Previous Post