Windows安装Superset

💻搭建系统:Windows10 企业版 LTSB
⌨️可视化系统:Superset

创建Superset python虚拟环境
1610693699538

安装superset
1610693686534
然后执行安装命令

pip install wtforms_json flask_compress celery flask_migrate flask_talisman flask_caching sqlparse bleach markdown numpy pandas parsedatetime pathlib2 simplejson humanize geohash polyline geopy cryptography backoff msgpack pyarrow contextlib2 croniter retry selenium isodate -i https://pypi.douban.com/simple

坑:Microsoft Visual C++ is requird
1610693666385
解决办法:安装Microsoft Visual C++ 14.0 tools http://go.microsoft.com/fwlink/?LinkId=691126 这个工具安装有几个G,安装速度尚可

对于安装不成功的包,示例如下

py -3 -m pip install pandas -i https://pypi.douban.com/simple/ --trusted-host pypi.douban.com

或手动在https://pypi.org/project/ 或 https://pypi.tuna.tsinghua.edu.cn/simple 中找对应的包进行安装

python -m pip install pandas-1.2.0-cp38-cp38-win_amd64.whl

进入虚拟环境 superset/bin路径下,初始化数据库

如果使用其他数据库请先修改config.py文件配置

(venv) D:\workspace\superset\venv\Lib\site-packages\superset\bin>python superset db upgrade

报错1
1610693642732

解决方式是:

geohash这个组件安装之后在site-packages下其目录是大写的"Geohash",这导致geohash这个组件pip install之后,仍然报找不到。我们把文件夹名"Geohash"修改为“geohash”。再将geohash文件夹下_init_.py文件,用文本打开,里面的from geohash修改成 from .geohash。
1610693626515
init.py文件:
1610693604380

报错2:
1610693586743
解决方式是:

手动安装cryptography

python -m pip install D:\workspace\superset\cryptography-3.2.1-cp38-cp38-win_amd64.whl

同时建议安装低版本sqlalchemy

pip install SQLAlchemy==1.2.18

报错3:
1610693401718
解决方式是:
Python3.8不再支持time.clock,但在调用时依然包含该方法;
有效处理:
用time.perf_counter()替换

import time

tis1 =time.perf_counter()
print("等待5秒......")
time.sleep(5)
tis2=time.perf_counter()
print(tis2-tis1)

报错4:
1610693433164
解决方法:

手动安装pyarrow

python -m pip install D:\workspace\superset\pyarrow-2.0.0-cp38-cp38-win_amd64.whl

执行superset相关命令

fabmanager create-admin --app superset
或下面的命令,建议下面这种方式
set FLASK_APP=superset(解决报错AttributeError: 'NoneType' object has no attribute 'auth_type')
flask fab create-admin

坑:

1610693475915

解决办法:pip install flask-appbuilder
1610693525828
报错:
1610693546986
解决方法:在superset/bin下执行

python superset fab create-admin

然后初始化系统并加载实例

python superset init
python superset load-examples

注意在load-examples这步由于raw.githubusercontent.com国内网络访问出现问题,所以请科学上网一下。

最后运行

python superset run