skip to navigation
skip to content

Not Logged In

psycopg2cffi 2.5

An implementation of the psycopg2 module using cffi.

An implementation of the psycopg2 module using cffi. The module is currently compatible with Psycopg 2.5.

You can install psycopg2cffi from pypi:

pip install psycopg2cffi

Or from source:

python develop

Installation requirements are the same as for psycopg2 - you must have libpq headers, pg_config somewhere on your $PATH. Installation was tested on Ubuntu 12.04 and CentOS (RHEL 5.0). It should be possible to make it work on Windows, but I did not even test it.

This module is only tested with python 2.6+ and PyPy 2.x (and will definityly not work on PyPy 1.9).

To use this package with Django or SQLAlchemy invoke a compatability hook (for example, from in case of django, or from a file in site-packages of your virtual env):

from psycopg2cffi import compat

This will map psycopg2cffi to psycopg2.

To run tests, install pytest and run them with:

py.test psycopg2cffi

Submit issues to

If you notice that psycopg2cffi under PyPy is noticably slower than psycopg2 under CPython, submit this to the issues too - it should not be the case.

This is a port of (Michael van Tellingen port of Alex Gaynor's rpython port ( of psycopg2 to python + ctypes) to cffi.

The main motivation for a port was speed - the writeup with benchmarks is here:

File Type Py Version Uploaded on Size
psycopg2cffi-2.5.tar.gz (md5) Source 2013-10-17 60KB
  • Downloads (All Versions):
  • 90 downloads in the last day
  • 729 downloads in the last week
  • 3166 downloads in the last month