Apache Superset: Installing locally is easy using the makefile
Tags: webdev, opensource, react, python
Published: 2023-08-20 18:01:01

Are you interested in trying out Superset, but you're intimidated by the local setup process? Worry not! Superset needs some initial setup to install locally, but I've got a streamlined way to get started - using [the makefile](https://github.com/apache/superset/blob/master/Makefile)! This file contains a set of scripts to simplify the setup process.

This setup is for Mac OS X, for other OS setups see: https://superset.apache.org/docs/installation/installing-superset-from-scratch/

To start, fork and download Superset from Github: https://github.com/apache/superset

You can run Superset directly without forking it, but you won't be able to create pull requests unless you're using your own forked version.

## Prerequisites

Superset has some prerequisites in order to run properly. Let's start with dependencies:

Make sure to update your machine to the latest version of Mac OS X. After updating, install the latest version of XCode command line tools:
```
xcode-select --install
```

Going forward, we'll be using **Homebrew** to install dependencies: https://brew.sh/

**Node**: Currently, Superset works best with `Node.js` version 16 and `npm` version 7. If you've got a preferred version of node, I suggest [using Node Version Manager (NVM)](https://github.com/nvm-sh/nvm#usage).

- [See here for full NVM installation instructions](https://github.com/nvm-sh/nvm#install--update-script)
```
nvm install 16
```
**Python**: Currently, Superset works best with Python version 3.9. We'll be using a Python virtual environment, so for now just install the Python version:
```
brew install python@3.9
```
Make sure to update `pip` and `setuptools` as well:
```
pip install --upgrade setuptools pip
```

Almost done, now we need the rest of the dependencies:
```
brew install readline pkg-config libffi openssl mysql postgresql@14
```

Set LDFLAGS and CFLAGS to allow certain Python packages to build properly. You can export the variables with these commands:
```
export LDFLAGS="-L$(brew --prefix openssl)/lib"
export CFLAGS="-I$(brew --prefix openssl)/include"
```

You will need to set a secret key in your `superset_config.py` file for security reasons. Open superset in your favorite code editor and create a file called `superset_config.py` in the root folder. In this file, set your secret key like this:
```
SECRET_KEY='insertSecurePasswordHere'
```

## Python Virtual Environment

Now we can set up our Python virtual environment. Start by installing `virtualenv`:
```
pip install virtualenv
```

`cd` into wherever you've locally cloned your forked instance of Superset. Create a virtual environment with Python 3.9:
```
// Create a venv directory
python3.9 -m venv venv

// Open the virtual environment
. venv/bin/activate
```

You will need two terminal windows to run Superset, I like to use iTerm2's horizontal window stacking to keep my terminal windows together: https://iterm2.com/

## Now it's time for the Makefile magic ✨

Make sure you're at the root file of Superset and in a virtual environment. Run this command to install Superset:
```
make install
```
That's it, you're installing Superset! This script will run for a bit, bring a snack.

Once the installation is complete, it's time to get things running. Boot up the back end with:
```
make flask-app
```

In a separate terminal window, once again make sure you're at the root file of Superset and in a virtual environment. Boot up the front end with:
```
make node-app
```

Once webpack finishes loading the app, go to `localhost:9000` in your browser. You'll see a login screen, log in with these credentials:
```
Username: admin
Password: general
```

You're in! Welcome to Superset, enjoy your experience and feel free to contribute. [It's open source](https://github.com/apache/superset/blob/master/CONTRIBUTING.md)!