Installation Prerequisites In order to install the psycopg2 package, you first need to sudo apt install python3-dev sudo apt install libpq-dev