Recently, when I attempted to install the
PostgreSQL adapter for
psycopg2 ), in a
virtualenv folder in Ubuntu 12.04, it failed. Upon attempting several solutions, I have boiled down to a fix that worked and decided to document it in an effort to help others resolve similar issue.
# Install the PostgreSQL development files (if you haven't installed them already). sudo apt-get install postgresql-server-dev-all # Install other required libraries sudo apt-get install libpq-dev python-dev # Attempt installation of psycopg2 within the virtualenv folder. source /bin/activate pip install psycopg2 # The installation of psycopg2 should proceed smoothly by now. If it still fails, try installing the postgresql-client libraries. sudo apt-get install postgresql-client-common # Attempt installation of psycopg2 again and hopefully it should work without issues.