Mac OS siera に superset をインストールしてみました。
実施した際の手順を記載します。
前提
OS の version 情報は以下になります。
- OS
% sw_vers ProductName: Mac OS X ProductVersion: 10.12.6 BuildVersion: 16G29
手順
incubator-superset/installation.rst at master · apache/incubator-superset を参考に記載しています。
-
前提となるパッケージ類のインストール
pkg-config、opensslはインストール済みだったようで、brew install pkg-config libffi openssl python
libffi、sqlite、python がインストールされました。
==> Summary 🍺 /usr/local/Cellar/libffi/3.2.1: 16 files, 297.0KB ==> Summary 🍺 /usr/local/Cellar/sqlite/3.20.0: 11 files, 3.0MB ==> Summary 🍺 /usr/local/Cellar/python/2.7.13_1: 3,528 files, 48MB
-
cryptographyのインストール
cryptography という 暗号化ライブラリをインストールします。
以下のエラーが発生しました。env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" pip install cryptography==1.7.2
Permission denied なので、root ユーザーにスイッチして再度コマンドを実施し、成功しました。OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/idna'
Successfully installed cffi-1.10.0 cryptography-1.7.2 enum34-1.1.6 idna-2.6 ipaddress-1.0.18 pycparser-2.18
supersetのインストールと初期化
incubator-superset/installation.rst at master · apache/incubator-superset には、virtualenv
のインストールを推奨する記載があります。
私は、素でインストールしてしまいましたが、いろいろインストールされますので、
基本的にvirtualenv
環境で動かすか、使用しない場合は、superset 専用サーバ上で動作させるのがよいかと思います。
-
supersetのインストール
sudo をつけて pip install します。
結構時間がかかり、いろいろインストールされました。sudo pip install superset
Successfully installed Flask-0.12.2 Flask-Babel-0.11.2 Flask-Login-0.2.11 Flask-OpenID-1.2.5 Mako-1.0.7 PyHive-0.4.0 WTForms-2.1 Werkzeug-0.12.2 alembic-0.9.5 amqp-1.4.9 anyjson-0.3.3 asn1crypto-0.22.0 babel-2.5.0 billiard-3.3.0.23 boto3-1.4.4 botocore-1.5.95 celery-3.1.25 certifi-2017.7.27.1 chardet-3.0.4 colorama-0.3.9 cryptography-1.9 docutils-0.14 flask-appbuilder-1.9.1 flask-cache-0.13.1 flask-migrate-2.0.3 flask-script-2.0.5 flask-sqlalchemy-2.1 flask-testing-0.6.2 flask-wtf-0.14.2 flower-0.9.1 futures-3.1.1 gunicorn-19.7.1 humanize-0.5.1 itsdangerous-0.24 jmespath-0.9.3 kombu-3.0.37 markdown-2.6.8 pandas-0.20.2 parsedatetime-2.0 pydruid-0.3.1 python-dateutil-2.6.0 python-editor-1.0.3 python-openid-2.2.5 requests-2.17.3 s3transfer-0.1.10 sasl-0.2.1 simplejson-3.10.0 sqlalchemy-1.1.9 sqlalchemy-utils-0.32.14 sqlparse-0.2.3 superset-0.19.0 thrift-0.10.0 thrift-sasl-0.2.1 tornado-4.2 urllib3-1.21.1
-
create-admin 実行
fabmanager が何かよくわかってないのですが、Installation — Flask AppBuilder に多少記載があり、Flask AppBuilder のコマンドだと理解しました。
fabmanager create-admin
はどのディレクトリで実行しても結果は変わりません。
以降、管理者のusername や password 等聞かれるので、入力します。fabmanager create-admin --app superset
ちなみにfabmanager
を引数なしで実行すると以下がコンソールに出力されます。
% fabmanager Usage: fabmanager [OPTIONS] COMMAND [ARGS]... This is a set of commands to ease the creation and maintenance of your flask-appbuilder applications. All commands that import your app will assume by default that your running on your projects directory just before the app directory. will assume also that on the __init__.py your initializing AppBuilder like this (using a var named appbuilder) just like the skeleton app:: appbuilder = AppBuilder(......) If your using different namings use app and appbuilder parameters. Options: --help Show this message and exit. Commands: babel-compile Babel, Compiles all translations babel-extract Babel, Extracts and updates all messages... collect-static Copies flask-appbuilder static files to your... create-addon Create a Skeleton AddOn (needs internet... create-admin Creates an admin user create-app Create a Skeleton application (needs internet... create-db Create all your database objects (SQLAlchemy... list-users List all users on the database list-views List all registered views reset-password Resets a user's password run Runs Flask dev web server. security-cleanup Cleanup unused permissions from views and... version Flask-AppBuilder package version
babel-comlile
などのコマンドもあるのは、Flask-Babel-0.11.2
とかがインストールされたからでしょうか? とりあえず先に進めます。 -
DB初期化
% superset db upgrade INFO [alembic.runtime.migration] Context impl SQLiteImpl. INFO [alembic.runtime.migration] Will assume transactional DDL.
-
サンプルデータのロード
データセットがロードされます。% superset load_examples Loading examples into <SQLA engine=u'sqlite:////Users/username/.superset/superset.db'> Loading [Birth names] Loading [Random time series data] Loading [Random long/lat data] Loading [Country Map data] Loading [Multiformat time series] Loading [Misc Charts] dashboard
-
初期化 デフォルトロールの作成
% superset init 2017-08-19 19:11:04,835:INFO:root:Syncing role definition 2017-08-19 19:11:04,835:INFO:root:Creating database reference 2017-08-19 19:11:04,889:INFO:root:Syncing Admin perms 2017-08-19 19:11:04,999:INFO:root:Syncing Alpha perms 2017-08-19 19:11:05,365:INFO:root:Syncing Gamma perms 2017-08-19 19:11:05,729:INFO:root:Syncing granter perms 2017-08-19 19:11:06,033:INFO:root:Syncing sql_lab perms 2017-08-19 19:11:06,375:INFO:root:Fetching a set of all perms to lookup which ones are missing 2017-08-19 19:11:06,471:INFO:root:Creating missing datasource permissions. 2017-08-19 19:11:06,481:INFO:root:Creating missing database permissions. 2017-08-19 19:11:06,495:INFO:root:Creating missing metrics permissions
サーバー起動
% superset runserver
Starting server with command:
http://0.0.0.0:8088
にアクセスして、作成したユーザーでログイン、以下のようなダッシュボードが表示されることを確認しました。結構エラーは吐いています。
以上です。
コメント