Pip install psycopg2. Psycopg2-binary. connection = psycopg2.connect(. install psycopg2 library problem.