Installation Error of Psycopg2 on windows 7
Reported by chandramouli | November 15th, 2012 @ 11:40 AM
I was trying to iinstall Psycopg2 on win 7 (64 - bit, installed
python2.7 32 bit)
- Installtion stops saying Python is not found in registry.
- Have tried giving .Zip and extracted all files, placed in
getting error "%1 is not a standard win32 command" on invoking psycopg2
any help would be highly appreciated as am stuck on this for a while.
Comments and changes to this ticket
Hi Daniele ,
I was trying out with both 64 as well as 32 bit versions..
Both installers fail saying "Python2.7 is not found in the registry"
Then I have unzipped them manually and placed them in C:\Python27 (my python instal dir)
if i try to invoke psycopg2 it gives error "%1 is not win32 recognized command"
I've asked Jason to take a look at your case, but if it is possible, I'd suggest you to uninstall all the Python installation instances from your machine and try re-installing python again.
Unpacking the .exe (which you have already discovered it is a .zip) and copying manually the psycopg2 directory and its contained file _psycopg.dll into a PYTHONPATH directory should work as well, provided Python is correctly installed and the 32/64 bit option and Python version match.
A few questions come to mind:
- Is your python 2.7 installed from the installation package at python.org?
- Are you using virtualenv?
- Are you using python from a 3rd party package (ie, like ArcGIS, ABACUS, etc)?
The python.org installation sets up the registry keys in one of the two locations for your environment:
Being that the psycopg2 installation is not finding the installation keys leads me to believe that there is something unusually with your setup.
From your description (32bit Python 2.7), you would need the following psycopg2 package:
Can you remove all instances of psycopg2 that you installed by hand and start the python interpreter?:
And issue the following in the python interpreter:
We should see the following error (We want it to fail at this point)
ImportError: No module named psycopg2
If we don't, it means that python is attempting to install psycopg2 from another location and you will have to remove those files. What I am looking for is that python is not grabbing psycopg2 from somewhere else, and that we are starting from a clean slate.
Once we are at this point, we can extract the files by hand. Using a program like 7zip, open up the above psycopg2 installation package. Go into the PLATLIB directory. At this point, there will be a psycopg2 directory and a psycopg2-2.4.5-py2.7.egg-info file. The "psycopg2" directory should be extracted and placed in the "C:\Python27\lib\site-packages" directory.
Start the python interpreter again and issue the import psycopg2, this time it should be successful with importing the module. (Fingers crossed).
If you are still having problems, issue the following commands at the python interpreter and let me know the output:
import sys sys.version
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
Psycopg is the most used PostgreSQL adapter for the Python programming language. At the core it fully implements the Python DB API 2.0 specifications. Several extensions allow access to many of the features offered by PostgreSQL.