I am getting the following error when trying to connect to a postgres db in superset
ImportError: No module named psycopg2
I have install psycopg2 with pip and restarted the superset by still getting the same error. any idea?
If you are running superset inside a virtualenv, try to install psycopg2 at system level. Also, install psycopg2-binary package.
If you are using superset with Docker, you will need to install it by creating a custom image and running pip install. here is the Dockerfile and docker-compose.yml sample
Dockerfile
FROM apache/superset:latest
# Set the working directory
WORKDIR /app
# Copy and install local requirements
COPY requirements-local.txt /app/requirements-local.txt
RUN pip install -r requirements-local.txt
requirements-local.txt
psycopg2-binary
docker-compose.yml
services:
superset:
build:
context: .
dockerfile: Dockerfile
container_name: superset
restart: always
ports:
- "8088:8088"
environment:
- SUPERSET_SECRET_KEY=local
- SQLALCHEMY_DATABASE_URI=sqlite:////app/superset_home/superset.db
- REDIS_HOST=redis
- REDIS_PORT=6379
depends_on:
- redis
volumes:
- ./superset_home:/app/superset_home
- ./requirements-local.txt:/app/requirements-local.txt
command: ["/bin/bash", "-c", "superset db upgrade && superset init && superset run -p 8088 -h 0.0.0.0"]
redis:
image: redis:7
container_name: superset_redis
restart: always
volumes:
- ./redis_data:/data
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With