First step is to install PostgreSQL on Ubuntu. In its default installation, Ubuntu does not included PostgreSQL. So uou have to install it separately. sudo apt-get install postgresql Now install the python module for accessing PostgreSQL -- psycopg2. You have two choices here -- either install this from the OS package manager …