Installing Superset from Scratch

OS Dependencies

Superset stores database connection information in its metadata database. For that purpose, we use the cryptography Python library to encrypt connection passwords. Unfortunately, this library has OS level dependencies.

Debian and Ubuntu

The following command will ensure that the required dependencies are installed:

  1. sudo apt-get install build-essential libssl-dev libffi-dev python-dev python-pip libsasl2-dev libldap2-dev default-libmysqlclient-dev

In Ubuntu 20.04 the following command will ensure that the required dependencies are installed:

  1. sudo apt-get install build-essential libssl-dev libffi-dev python3-dev python3-pip libsasl2-dev libldap2-dev default-libmysqlclient-dev

Fedora and RHEL-derivative Linux distributions

Install the following packages using the yum package manager:

  1. sudo yum install gcc gcc-c++ libffi-devel python-devel python-pip python-wheel openssl-devel cyrus-sasl-devel openldap-devel

In more recent versions of CentOS and Fedora, you may need to install a slightly different set of packages using dnf:

  1. sudo dnf install gcc gcc-c++ libffi-devel python3-devel python3-pip python3-wheel openssl-devel cyrus-sasl-devel openldap-devel

Also, on CentOS, you may need to upgrade pip for the install to work:

  1. pip3 install --upgrade pip

Mac OS X

If you’re not on the latest version of OS X, we recommend upgrading because we’ve found that many issues people have run into are linked to older versions of Mac OS X. After updating, install the latest version of XCode command line tools:

  1. xcode-select --install

We don’t recommend using the system installed Python. Instead, first install the homebrew manager and then run the following commands:

  1. brew install readline pkg-config libffi openssl mysql postgres

You should install a recent version of Python (the official docker image uses 3.8.12). We’d recommend using a Python version manager like pyenv (and also pyenv-virtualenv).

Let’s also make sure we have the latest version of pip and setuptools:

  1. pip install --upgrade setuptools pip

Lastly, you may need to set LDFLAGS and CFLAGS for certain Python packages to properly build. You can export these variables with:

  1. export LDFLAGS="-L$(brew --prefix openssl)/lib"
  2. export CFLAGS="-I$(brew --prefix openssl)/include"

These will now be available when pip installing requirements.

Python Virtual Environment

We highly recommend installing Superset inside of a virtual environment. Python ships with virtualenv out of the box. If you’re using pyenv, you can install pyenv-virtualenv. Or you can install it with pip:

  1. pip install virtualenv

You can create and activate a virtual environment using:

  1. # virtualenv is shipped in Python 3.6+ as venv instead of pyvenv.
  2. # See https://docs.python.org/3.6/library/venv.html
  3. python3 -m venv venv
  4. . venv/bin/activate

Or with pyenv-virtualenv:

  1. # Here we name the virtual env 'superset'
  2. pyenv virtualenv superset
  3. pyenv activate superset

Once you activated your virtual environment, all of the Python packages you install or uninstall will be confined to this environment. You can exit the environment by running deactivate on the command line.

Installing and Initializing Superset

First, start by installing apache-superset:

  1. pip install apache-superset

Then, you need to initialize the database:

  1. superset db upgrade

Finish installing by running through the following commands:

  1. # Create an admin user in your metadata database (use `admin` as username to be able to load the examples)
  2. export FLASK_APP=superset
  3. superset fab create-admin
  4. # Load some data to play with
  5. superset load_examples
  6. # Create default roles and permissions
  7. superset init
  8. # To start a development web server on port 8088, use -p to bind to another port
  9. superset run -p 8088 --with-threads --reload --debugger

If everything worked, you should be able to navigate to hostname:port in your browser (e.g. locally by default at localhost:8088) and login using the username and password you created.

Installing Superset with Helm in Kubernetes

You can install Superset into Kubernetes with Helm. The chart is located in the helm/ directory.

To install Superset in your Kubernetes cluster with Helm 3, run:

  1. helm dep up ./helm/superset
  2. helm upgrade --install superset ./helm/superset

Note that the above command will install Superset into default namespace of your Kubernetes cluster.