0

I am facing problem to connect postgresql with superset while i giving my connection username,password hostname and database name and when we click on test connection even I have install postgresql and psycopg2.

It says

ERROR: {"error": "Connection failed!

The error and shows pop up in the superset page.

ERROR: {"error": "Connection failed!

The error message returned was:
No module named 'psycopg2'", "stacktrace": "Traceback (most recent call last):
  File \"/home/tutree/venv/lib/python3.6/site-packages/superset/views/core.py\", line 1702, in testconn
    engine = database.get_sqla_engine(user_name=username)
  File \"/home/tutree/venv/lib/python3.6/site-packages/superset/utils/core.py\", line 131, in __call__
    value = self.func(*args, **kwargs)
  File \"/home/tutree/venv/lib/python3.6/site-packages/superset/models/core.py\", line 911, in get_sqla_engine
    return create_engine(url, **params)
  File \"/home/tutree/venv/lib/python3.6/site-packages/sqlalchemy/engine/__init__.py\", line 479, in create_engine
    return strategy.create(*args, **kwargs)
  File \"/home/tutree/venv/lib/python3.6/site-packages/sqlalchemy/engine/strategies.py\", line 87, in create
    dbapi = dialect_cls.dbapi(**dbapi_args)
  File \"/home/tutree/venv/lib/python3.6/site-packages/sqlalchemy/dialects/postgresql/psycopg2.py\", line 737, in dbapi
    import psycopg2
ModuleNotFoundError: No module named 'psycopg2'
"}


TylerH
  • 20,799
  • 66
  • 75
  • 101

2 Answers2

1

I solved it by running this command

pip install psycopg2
0

Read the error message:

The problem may be that you need to install psychopg2 on the same virtualenv as the original superset.

so:

1. source your-virtual-env
2. pip install the requriements
3. run superset
Felipe Valdes
  • 1,998
  • 15
  • 26