Search code examples
apache-superset

Apache Superset [Errno 13] Permission denied: '/usr/local/lib/python3.5/site-packages/superset/app'


I use Apache Superset for data exploration. I followed the installation instructions and had no problems using the app.

However, after I installed the community maintained docker image I tried to upload a CSV file for visualization and got the following error:

([Errno 13] Permission denied: '/usr/local/lib/python3.5/site-packages/superset/app')

I use sqlite as DB backend, and mounted the DB volume as suggested.

Other users had the same problem with different setup and configurations. The issues they opened (#4576, #4287) have not been resolved yet.

The problem does not seem to be related to DB access permissions as evident by the different DB backend and configurations the users are using.


Solution

  • Solution

    Add the following lines to your superset_config.py file, rebuild and run your docker image:

    import os
    
    BASE_DIR = os.path.abspath(os.path.dirname(__file__))
    
    # The file upload folder, when using models with files
    UPLOAD_FOLDER = BASE_DIR + '/app/static/uploads/'
    
    # The image upload folder, when using models with images
    IMG_UPLOAD_FOLDER = BASE_DIR + '/app/static/uploads/'
    

    You can also change the path to wherever you want to save the uploaded files and images in your docker image.

    Cause of the problem:

    Superset is trying to upload the CSV file to the path shown in the error message. The path is owned by the root user, and Superset does not have right permission to it.

    To fix this, you need to change the path where Superset uploads the CSV files. This can easily be done by setting a couple of configurations as shown above.

    This should also solve the problem when uploading a photo to use in a Superset user profile.