I am running apache superset 0.36 in docker with separate dockers for redis and postgres. While trying to connect to MySQL datasource which is running on host machine, I am getting
ERROR:superset.views.core:Unexpected error No module named ‘pymysql’"
I tried bash to superset container sudo docker run -it superset_superset bash
and then pip install pymysql
but getting warning
"WARNING: The directory ‘/home/superset/.cache/pip/http’ or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag."
and it does not install pymysql.
Error thrown while running pip install pymysql inside container is
Installing collected packages: pymysql ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: ‘/usr/local/lib/python3.6/site-packages/pymysql’ Consider using the –user option or check the permissions.
Tried pip install pymysql –user also but same error.
2
Answers
To some extent the error message already show the answer:
A pretty reson for
sudo -H
If you’re using
docker-compose
, check out this article: https://preset.io/blog/2020-05-18-install-db-drivers/Basically, extra packages can be added by adding them to
docker/requirements-local.txt
before runningdocker-compose up
.Note:
requirements-local.txt
is installed into the locally built image: https://github.com/apache/incubator-superset/blob/master/Dockerfile-dev#L23