安装Superset到Mac电脑

安装时间

大约需要1-2小时。

安装Superset - 安装进Python虚拟机

Superset提供3种安装方式:1)安装进Docker 2)直接安装进操作系统 3)安装进Python虚拟机。第1种方式来自社区志愿者,没有项目核心人员在维护这种发式,安装过程中可能会有些问题,本人就通过docker死活装不上;第2种方式不推荐,因为Superset会依赖很多包,直接装进操作系统可能会和其他应用冲突;所以推荐使用Python虚拟机进行安装。以下是安装步骤。

安装Python3.6

因为Superset需要运行在Python3.6及以上版本里,所以需要首先运行:

python3 --version

确认你是否有Python3.6及以上版本,如果没有可以去Python官网下载并安装最新版。

安装Python虚拟机visualenv

pip install virtualenv

创建和激活virtualenv:

# virtualenv is shipped in Python 3.6+ as venv instead of pyvenv.
# See https://docs.python.org/3.6/library/venv.html
python3 -m venv venv
. venv/bin/activate

一旦激活后你的所有操作都在Python虚拟机里面,要退出的话输入deactivate

Python的配置工具和pip

pip install --upgrade setuptools pip

Superset的安装和初始化

# Install superset
pip install superset

# 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

打开http://localhost:8088就可以查看你的Superset。

问题

在Superset的安装和初始化中可能会遇到的2个问题。

问题1:

Was unable to import superset Error: cannot import name '_maybe_box_datetimelike' from 'pandas.core.common' (/usr/bin/venv/lib/python3.7/site-packages/pandas/core/common.py)

解决方法:跟pandas版本有关,卸载掉重装低版本,参考来源:https://github.com/apache/incubator-superset/issues/6770。

pip uninstall pandas
pip list | grep pandas
pip install pandas==0.23.4

问题2:

sqlalchemy.exc.InvalidRequestError: Can't determine which FROM clause to join from, there are multiple FROMS which can join to this entity. Try adding an explicit ON clause to help resolve the ambiguity.

解决方法:安装sqlalchemy 1.2.18,参考来源:https://github.com/apache/incubator-superset/issues/6977。

pip install sqlalchemy==1.2.18

运行

当你不小心关闭终端,或中断了进程 ,你会发现http://localhost:8088会打不开。这时候就需要重新激活虚拟机,并运行superset就可以了。

. venv/bin/activate
superset runserver -d

参考

Last updated

Was this helpful?