大数据大数据 爬虫Python AI Sql大数据,机器学习,人工智能

用superset搭建一套数据分析平台(mac遇坑无数)

2018-11-20  本文已影响15人  李明轩Matthew

2018-11-20更新到03 superset安装(单机版)

前言

想要做一套在线数据分析系统,又不想从网页开发这样的底层开始重复造轮子,怎么办?
记住一句话 “你遇到的问题,前人早就遇到过,还有可能解决了” --明轩
百度到了秦璐老师分享的如何搭建一套数据分析平台?
使用superset这一由Airbnb数据团队开源的数据分析框架,搭建一个自主可用的数据分析平台。

superset

superset支持MySQL等10多个数据库,数百种图表显示方式,还支持将数据按类别切片处理等,是一个轻量级但是功能强大的商业智能系统。
今天我们就搭建一个单机版数据分析平台,体验一下superset的魅力。


目录


01 superset简介

Superset是一款轻量级的BI工具,由Airbnb的数据部门开源。整个项目基于Python框架,它集成了Flask、D3(前端)、Pandas、SqlAlchemy等。

02 实验环境

mac os

03 superset安装

在anaconda中安装superset,减少依赖包带来的麻烦

step01
conda create是创建虚拟环境的命令。-n是环境的命名参数,在这里,我们创建了名为superset的环境,它安装在Anaconda的envs目录下。python版本为3.6

conda create -n superset python=3.6

step02
source activate是激活命令,superset为想要激活的虚拟环境名。
如果要退出,则是source deactivate

source activate superset

step03
如果觉得速度慢,可以在命令行后加上 -i https://pypi.douban.com/simple ,这是豆瓣的镜像源,速度嗖嗖的。

pip install superset

此处遇到报错


gcc报错

尝试升级conda版本【无效】

conda update -n base -c defaults conda

按照superset官网的install指导,

#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本地安装解决

安装包要放在命令执行时的当前目录下

(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

安装完之后显示结果

(superset) sh-3.2# conda list | grep superset
# packages in environment at /anaconda3/envs/superset:
superset                  0.20.1           py27h6ec930a_0    <unknown>

总结一下这次蛋疼的安装过程
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)
上一篇下一篇

猜你喜欢

热点阅读