2018-11-20更新到03 superset安裝(單機版)
前言
想要做一套在線數(shù)據(jù)分析系統(tǒng),又不想從網(wǎng)頁開發(fā)這樣的底層開始重復(fù)造輪子,怎么辦?
記住一句話 “你遇到的問題,前人早就遇到過,還有可能解決了” --明軒
百度到了秦璐老師分享的如何搭建一套數(shù)據(jù)分析平臺?
使用superset這一由Airbnb數(shù)據(jù)團隊開源的數(shù)據(jù)分析框架,搭建一個自主可用的數(shù)據(jù)分析平臺。

superset支持MySQL等10多個數(shù)據(jù)庫,數(shù)百種圖表顯示方式,還支持將數(shù)據(jù)按類別切片處理等,是一個輕量級但是功能強大的商業(yè)智能系統(tǒng)。
今天我們就搭建一個單機版數(shù)據(jù)分析平臺,體驗一下superset的魅力。
目錄
- 01 superset簡介
- 02 實驗環(huán)境
- 03 superset安裝(單機版)
- 04 接入數(shù)據(jù)
- 05 SQL操作
- 06 數(shù)據(jù)可視化
01 superset簡介
Superset是一款輕量級的BI工具,由Airbnb的數(shù)據(jù)部門開源。整個項目基于Python框架,它集成了Flask、D3(前端)、Pandas、SqlAlchemy等。
02 實驗環(huán)境
mac os
03 superset安裝
在anaconda中安裝superset,減少依賴包帶來的麻煩
step01
conda create是創(chuàng)建虛擬環(huán)境的命令。-n是環(huán)境的命名參數(shù),在這里,我們創(chuàng)建了名為superset的環(huán)境,它安裝在Anaconda的envs目錄下。python版本為3.6
conda create -n superset python=3.6
step02
source activate是激活命令,superset為想要激活的虛擬環(huán)境名。
如果要退出,則是source deactivate
source activate superset
step03
如果覺得速度慢,可以在命令行后加上 -i https://pypi.douban.com/simple ,這是豆瓣的鏡像源,速度嗖嗖的。
pip install superset
此處遇到報錯

嘗試升級conda版本【無效】
conda update -n base -c defaults conda
按照superset官網(wǎng)的install指導(dǎo),
#OSX, system python is not recommended. brew’s python also ships with pip
brew install pkg-config libffi openssl python
env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" pip install cryptography==1.9
告警提示
Failed to build python-geohash sasl cchardet
Installing collected packages: sqlparse, python-geohash, unidecode, sqlalchemy-utils, cchardet, tabulator, tableschema, sasl, thrift-sasl, pyyaml, superset
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/anaconda3/envs/superset/lib/python3.6/site-packages/sqlparse'
Consider using the `--user` option or check the permissions.
其中 python-geohash 通過加--user解決【無效】
pip install geohash --user
最后通過下載superset安裝包,使用conda本地安裝解決
安裝包要放在命令執(zhí)行時的當(dāng)前目錄下
(superset) sh-3.2# conda install --use-local superset-0.20.1-py27h6ec930a_0.tar.bz2
Downloading and Extracting Packages
#################################################################################################################################################################################################### | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
安裝完之后顯示結(jié)果
(superset) sh-3.2# conda list | grep superset
# packages in environment at /anaconda3/envs/superset:
superset 0.20.1 py27h6ec930a_0 <unknown>
總結(jié)一下這次蛋疼的安裝過程
1.pip安裝會報錯【暫時無法解決】
error: command 'gcc' failed with exit status 1
----------------------------------------
Failed building wheel for sasl
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/anaconda3/envs/superset/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-install-6epsftg5/sasl/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/tmp/pip-record-0ncssknf/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-install-6epsftg5/sasl/
2.conda安裝會保找不到channel【暫時無法解決】
(superset) sh-3.2# conda install superset
Solving environment: failed
PackagesNotFoundError: The following packages are not available from current channels:
- superset
Current channels:
- https://repo.anaconda.com/pkgs/main/osx-64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/free/osx-64
- https://repo.anaconda.com/pkgs/free/noarch
- https://repo.anaconda.com/pkgs/r/osx-64
- https://repo.anaconda.com/pkgs/r/noarch
- https://repo.anaconda.com/pkgs/pro/osx-64
- https://repo.anaconda.com/pkgs/pro/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
進行到下一步又遇到蛋疼的問題
(superset) sh-3.2# fabmanager create-admin –app superset
Username [admin]: limingxuan
User first name [admin]: li
User last name [user]: mingxuan
Email [admin@fab.org]: limx2011@hotmail.com
Password:
Repeat for confirmation:
Usage: fabmanager create-admin [OPTIONS]
Error: Got unexpected extra arguments (–app superset)