Mac下安装Superset
2019-01-31 本文已影响0人
GYBE
笔主环境
# 系统
macOS Mojave Version 10.14.2
# Python
Python 3.7.1
环境准备
- 创建虚拟环境
conda create -n superset python=3.6
- 激活虚拟环境
conda activate superset
准备工作完成
- 安装依赖包
执行如下命令
wget https://raw.githubusercontent.com/apache/incubator-superset/master/requirements.txt
pip install -r requirements.txt
# 最好使用CFLAGS=-stdlib=libc++ pip install -r requirements.txt 安装
# 能解决可能的错误, 错误详情文章下面
安装Superset
pip install superset
一般正常情况下是可以安装成功, 也有例外, 我在安装过程中遇到了如下问题
Failed building wheel for python-geohash
Failed building wheel for cchardet
Failed to build python-geohash cchardet
Installing collected packages: python-geohash, cchardet, tabulator, tableschema, superset
Running setup.py install for python-geohash ... error
Complete output from command /anaconda3/envs/superset/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/f6/6zqglp5165q7jr8lg2kkwq_80000gn/T/pip-install-exkh7_b5/python-geohash/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/var/folders/f6/6zqglp5165q7jr8lg2kkwq_80000gn/T/pip-record-lfs5y7mf/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.7-x86_64-3.7
copying geohash.py -> build/lib.macosx-10.7-x86_64-3.7
copying quadtree.py -> build/lib.macosx-10.7-x86_64-3.7
copying jpgrid.py -> build/lib.macosx-10.7-x86_64-3.7
copying jpiarea.py -> build/lib.macosx-10.7-x86_64-3.7
running build_ext
building '_geohash' extension
creating build/temp.macosx-10.7-x86_64-3.7
creating build/temp.macosx-10.7-x86_64-3.7/src
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/anaconda3/envs/superset/include -arch x86_64 -I/anaconda3/envs/superset/include -arch x86_64 -I/usr/local/opt/libxml2/include -DPYTHON_MODULE=1 -I/anaconda3/envs/superset/include/python3.7m -c src/geohash.cpp -o build/temp.macosx-10.7-x86_64-3.7/src/geohash.o
warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
1 warning generated.
g++ -bundle -undefined dynamic_lookup -L/anaconda3/envs/superset/lib -arch x86_64 -L/anaconda3/envs/superset/lib -arch x86_64 -L/usr/local/opt/libxml2/lib -I/usr/local/opt/libxml2/include -arch x86_64 build/temp.macosx-10.7-x86_64-3.7/src/geohash.o -o build/lib.macosx-10.7-x86_64-3.7/_geohash.cpython-37m-darwin.so
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
ld: library not found for -lstdc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'g++' failed with exit status 1
----------------------------------------
Command "/anaconda3/envs/superset/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/f6/6zqglp5165q7jr8lg2kkwq_80000gn/T/pip-install-exkh7_b5/python-geohash/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/var/folders/f6/6zqglp5165q7jr8lg2kkwq_80000gn/T/pip-record-lfs5y7mf/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/f6/6zqglp5165q7jr8lg2kkwq_80000gn/T/pip-install-exkh7_b5/python-geohash/
解决办法如下:
安装gcc最新版本
brew info gcc@7
完成之后在重新安装superset
包
CFLAGS=-stdlib=libc++ pip install superset
初始化Superset
可能遇到的错误:
Was unable to import superset Error: cannot import name '_maybe_box_datetimelike'
from 'pandas.core.common' (
/anaconda3/envs/superset/lib/python3.7/site-packages/pandas/core/common.py)
解决办法: 安装较老版本的pandas
pip install --upgrade pandas==0.23.1 --force-reinstall
初始化
# Create an admin user (you will be prompted to set a username, first and last name before setting a password)
fabmanager create-admin --app superset
# Initialize the database
superset db upgrade
# Load some data to play with
superset load_examples
# Create default roles and permissions
superset init
# To start a development web server on port 8088, use -p to bind to another port
superset runserver -d