Error: No module named psycopg2.extensions Error: No module named psycopg2.extensions python python

Error: No module named psycopg2.extensions


The first thing to do is to install the dependencies.

sudo apt-get build-dep python-psycopg2sudo apt install python3-psycopg2 # Python 3

After that go inside your virtualenv and use:

pip install psycopg2-binary

These two commands should solve the problem.


pip install psycopg2-binary

The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: http://initd.org/psycopg/docs/install.html#binary-install-from-pypi.


For Django 2 and python 3 install psycopg2 using pip3 :

pip3 install psycopg2