Python Flask ModuleNotFoundError: No module named ‘psycopg2’

When you working with Python Flask application, you may found the following error:

ModuleNotFoundError: No module named 'psycopg2'

This means you want to use Python to talk to your PostgreSQL database, without install the psycopg2 plugin.

You can simply apply the following pip install command, and you should be fine:

pip install psycopg2

And if you working with postgresql database table. You may experience the following error when you try to talk to the database.

sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) fe_sendauth: no password supplied
 (Background on this error at:

That actually means you have not provide the username, password for connecting to your database. In this case, you need to check your db connection. You have to make sure your connection should be follow the following pattern: