3

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.

TylerH
  • 20,799
  • 66
  • 75
  • 101
Sam
  • 11,799
  • 9
  • 49
  • 68

2 Answers2

6

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.

benvdh
  • 454
  • 5
  • 13
Sam
  • 11,799
  • 9
  • 49
  • 68
  • This worked for me only when I didn't declare `BASE_DIR` variable but wrote its value inline when declaring `UPLOAD_FOLDER` and `IMG_UPLOAD_FOLDER`. – tuomastik Sep 06 '18 at 07:46
  • Hi I used ur suggestion and added the value of BASE_DIR directly in UPLOAD_FOLDER. However I still see the permission denied error while uploading csv. Can u help? I have commented out the development option in docker-compose.yml file as it was throwing some Mkdir permission denied issue. – Baktaawar Mar 12 '19 at 22:22
0

This error like said above is related to folder permissions mostly. You can get this to run by executing with root permissions.

For example in my case I got this error after running superset runserver -d -p8080.

Use the command sudo superset runserver -d -p8080 instead and you will be able to upload your csv files.

Note: The other flags and port number specified can be changed according to your needs.

Also Note: This permission error arises only if you installed superset with root privileges i.e instead of pip install superset you probably used sudo pip install superset

TylerH
  • 20,799
  • 66
  • 75
  • 101
Tadiwanashe
  • 1,246
  • 14
  • 15