Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So I just installed QGIS 1.5 using the windows installer not the osgeo4w one and now any plugins that need access to PostgreSQL databases don't seem to work, they all throw a:

"Couldn't import Python module 'psycopg2' for communication with PostgreSQL database. Without it you won't be able to run xxxxx. Please install it."

My current environment variables look like:

C:\Program Files\TortoiseSVN\bin;C:\Program Files\Mercurial\;
C:\Program Files\Console2;
C:\Program Files\Git\bin;
C:\Program Files\Git\cmd;
C:\Program Files\Quantum GIS Tethys\apps\qgis\bin;
C:\Program Files\IronRuby 1.1\bin;
C:\Program Files\Quantum GIS Tethys\bin;

and PYTHONPATH is set to:

PYTHONPATH=C:\Program Files\Quantum GIS Tethys\apps\qgis\python

I used to have version 1.4 installed and I noticed that in the python folder for 1.4 there was a folder and file called psycopg2_psycopg.pyd, but if I take that file and put it in the python path for 1.5 it still doesn't work (didn't think it would but was worth a try)

I downloaded and tried to install psycopg2-2.2.2.win32-py2.4-pg8.4.4-release.exe which is the latest verstion of psycopg2 but because have the python that is installed with QGIS it throws a "Python 2.4 not in registry error".

Anyone know how I can get this version of QGIS running with psycopg2?

share|improve this question
up vote 3 down vote accepted

Firest, are you sure about the version of your Python? From Osgeo4w you should have installed Python 2.5. Second, from the same installer, under Libs, you have the option to install psycopg2 too.

Otherwise, if you want to install modules thorugh their own windows installer, you have to put the needed registry values. They're set when you install Python by yourself, while the osgeo4w installer keeps your system clean to do not override your settings... That's why the psycopg2 installer complains it can't find the registry values.

you can put the following lines into a "youfile".reg file, and load it from the registry to have the needed values set:




[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.5\InstallPath] @="C:\OSGeo4W\apps\Python25"

[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.5\PythonPath] @="C:\OSGeo4W\apps\Python25\Lib;C:\OSGeo4W\apps\Python25\DLLs;C:\OSGeo4W\apps\Python25\Lib\lib-tk"


share|improve this answer
Thanks, that did the trick. – Nathan W Aug 3 '10 at 5:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.