skip to Main Content

I attempted to install Superset (3.0.0) on Ubuntu Server 22.04.3 from scratch using this guide https://superset.apache.org/docs/installation/installing-superset-from-scratch, and I can’t say that it was successful.

Here is what I did step by step:

  1. sudo apt-get install build-essential libssl-dev libffi-dev python3-dev python3-pip libsasl2-dev libldap2-dev default-libmysqlclient-dev – SUCCESS.
  2. pip install --upgrade setuptools pip – SUCCESS.
  3. pip install virtualenv – SUCCESS, but with warning "The script virtualenv is installed in ‘/home/superset/.local/bin’ which is not on PATH".
  4. python3 -m venv venv . venv/bin/activate
    Here I got error "The virtual environment was not created successfully because ensurepip is not available. On Debian/Ubuntu systems, you need to install the python3-venv package using the following command: apt install python3.10-venv".
  5. apt install python3.10-venv – SUCCESS.
  6. python3 -m venv venv . venv/bin/activate
    SUCCESS.
  7. pip install apache-superset – SUCCESS.
  8. superset db upgradeERROR: "Error: Could not locate a Flask application. Use the ‘flask –app’ option, ‘FLASK_APP’ environment variable, or a ‘wsgi.py’ or ‘app.py’ file in the current directory". Before applying this command, you should set the environment variable ‘export FLASK_APP=superset’.
  9. export FLASK_APP=superset – SUCCESS.
  10. superset db upgradeERROR: "A Default SECRET_KEY was detected, please use superset_config.py to override it.". But it doesn’t work. As I understood еhe SECRET_KEY is read from the environment variable. Ok, apply next steps.
  11. openssl rand -base64 42 – SUCCESS.
  12. export SUPERSET_SECRET_KEY= the previously generated key – SUCCESS.
  13. superset db upgrade – SUCCESS.
  14. superset fab create-admin – I received a warning ‘No PIL installation found,’ but proceeded successfully with the admin user creation process.
  15. superset load_examples – I received a warning "No PIL installation found" but proceeded successfully.
  16. superset init – I received a warning "No PIL installation found" but proceeded successfully.
  17. cd superset-frontend
    npm ci
    npm run build
    cd ..
    I attempted to locate the ‘superset-frontend’ directory, but I was unsuccessful, so I skipped this step.
  18. superset run -h 0.0.0.0 -p 8088 --with-threads --reload --debugger
    Here I added ‘-h 0.0.0.0’ to the default command – SUCCESS.
  19. http://192.168.10.12:8088/login/ – SUCCESS, the login page was displayed.
  20. I entered my login and password, pressed Enter, and… I was redirected to the login page again. I checked the console and found an error:
    "GET /login/ HTTP/1.1" 200 - 2023-10-09 11:30:15,676:INFO:flask_wtf.csrf:The CSRF session token is missing. Refresh CSRF token error Traceback (most recent call last): File "/home/superset/venv/lib/python3.10/site-packages/flask_wtf/csrf.py", line 261, in protect validate_csrf(self._get_csrf_token()) File "/home/superset/venv/lib/python3.10/site-packages/flask_wtf/csrf.py", line 103, in validate_csrf raise ValidationError("The CSRF session token is missing.") wtforms.validators.ValidationError: The CSRF session token is missing.
  21. Ok, I stopped the Superset server, opened the /home/superset/venv/lib/python3.10/site-packages/superset/config.py file, and changed WTF_CSRF_ENABLED from True to False.
  22. Started the server again with command superset run -h 0.0.0.0 -p 8088 --with-threads --reload --debugger and… I was redirected to the login page again! I checked the console and found a warning: WARNING:root:Class ‘werkzeug.local.LocalProxy’ is not mapped.

I’m not very experienced with Linux, so at this point, I have no idea what to do next.

Can anyone suggest what to do next?

2

Answers


  1. Chosen as BEST ANSWER

    I found the following workaround: In /home/superset/venv/lib/python3.10/site-packages/superset/config.py set:

    TALISMAN_ENABLED=False
    

  2. This is great – thank you for documenting this.

    I installed pillow to resolve the errors/warnings about PIL

    pip3 install pillow

    I also wanted to share a bit about how I got around the WTF_CSRF_ENABLED part of step 21. This felt weird to me, to be modifying the source for a package… I set the following in my python config file:

    WTF_CSRF_ENABLED = False
    TALISMAN_ENABLED = True
    
    TALISMAN_CONFIG = {
        "content_security_policy": {
            "default-src": ["'self'"],
            "img-src": ["'self'", "data:"],
            "worker-src": ["'self'", "blob:"],
            "connect-src": [
                "'self'",
                "https://api.mapbox.com",
                "https://events.mapbox.com",
            ],
            "object-src": "'none'",
            "style-src": ["'self'", "'unsafe-inline'"],
            "script-src": ["'self'", "'strict-dynamic'"],
        },
        "content_security_policy_nonce_in": ["script-src"],
        "force_https": False,
        "session_cookie_secure": False
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search