Support Questions

Find answers, ask questions, and share your expertise

[Superset]: No module named psycopg2

avatar

I am trying to add a postgres database to superset. This is my connection URI: postgresql://username:password@localhost/mydatabase.
I keep getting the following error while trying to test connection: No module named psycopg2 !

I made sure I installed this module using pip install psycopg2 in shell but it's still not working!





1 ACCEPTED SOLUTION

avatar
Contributor

@Khouloud LandariIn HDP superset is installed inside a python virtual environment.

In order to install psycopg2, you will need to run following command -

/usr/hdp/current/superset/bin/pip install psycopg2

Alternatively, We package superset with pygresql and you can change the connection URI to use that -

postgresql+pygresql://user:password@host:port/dbname

View solution in original post

2 REPLIES 2

avatar
Contributor

@Khouloud LandariIn HDP superset is installed inside a python virtual environment.

In order to install psycopg2, you will need to run following command -

/usr/hdp/current/superset/bin/pip install psycopg2

Alternatively, We package superset with pygresql and you can change the connection URI to use that -

postgresql+pygresql://user:password@host:port/dbname

avatar

Thank you @Nishant Bangarwa! "No module psycopg2" solved!
Though I am getting another error now:
Error: Fatal: no pg_hba.conf entry for host "x.x.x.x", user "x", database "x", SSL off.
Plus, I am not sure about the user & password for my Postgres database