ImportError: No module named psycopg2

ws_123 picture ws_123 · Oct 16, 2012 · Viewed 181.4k times · Source

When installing process of OpenERP 6, I want to generate a config file with this command,

cd /home/openerp/openerp-server/bin/

./openerp-server.py -s --stop-after-init -c /home/openerp/openerp-server.cfg

But it was always showed a message

ImportError: No module named psycopg2

When I check for psycopg2 package, it's already installed,

Package python-psycopg2-2.4.5-1.rhel5.x86_64 already installed and latest version

Nothing to do

What's wrong with this?

My server is CentOS, I've installed python 2.6.7.

Answer

Tarique picture Tarique · Apr 16, 2014

Step 1: Install the dependencies

sudo apt-get install build-dep python-psycopg2

Step 2: Run this command in your virtualenv

pip install psycopg2 

Ref: Fernando Munoz