环境:superset 0.35+python3.6.7+node.js 10.15.3+npm 6.4.1
1、python安装,地址https://www.python.org/downloads/
验证方式,打开CMD:
C:\Users\72701>python -V
Python 3.6.7
2、node安装,地址:https://nodejs.org/en/download/
验证方式:
C:\Users\72701>node -v
v10.15.3
3、执行以下这步
npm install -g cnpm --registry=https://registry.npm.taobao.org
4、设置pip国内源
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
如果不成下载不成功,可以试一下http://pypi.hustunique.com/simple/这个源
5、安装组件
下载地址:https://www.lfd.uci.edu/~gohlke/pythonlibs/#sasl
下载好后,到所在目录去安装:
pip install sasl-0.2.1-cp36-cp36m-win_amd64.whl
pip install Twisted-19.7.0-cp36-cp36m-win_amd64.whl
pip install wordcloud-1.5.0-cp37-cp36m-win_amd64.whl
6、安装虚拟工具(管理员身份)
pip install virtualenv
7、下载superset源码(下载的时候可以选择版本,我的是0.34版)
https://github.com/apache/incubator-superset.git
8、启动pycharm(没有的话下载一个)
9、安装组件(就是在pycharm刚刚打开的那个地方写命令,后面的步骤都在pycharm里面)
pip install -r requirements.txt
pip install -r requirements-dev.txt
10、在superset目录下新建run.py
from superset import app
import sys
import getopt
app.run(debug=True, host='0.0.0.0', port=8088)
11、删除superset-0.34\superset\static里面的assets文件
mklink /J "E:\superset\superset-0.34\superset\static\assets" "E:\superset\superset-0.34\superset\assets"
12、执行以下命令
pip install -e .
13、创建用户名和密码
(venv) D:\zhangkai\mirrors-Superset-0.35\Superset>fabmanager create-admin --app superset
fabmanager is going to be deprecated in 2.2.X, you can use the same commands on the improved 'flask fab '
Username [admin]: admin
User first name [admin]: zhang
User last name [user]: kai
Email [[email protected]]: [email protected]
Password:
Repeat for confirmation:
2020-11-04 13:30:19,582:INFO:root:logging was configured successfully
2020-11-04 13:30:19,856:INFO:root:Configured event logger of type
2020-11-04 13:30:20,984:DEBUG:asyncio:Using selector: SelectSelector
Recognized Database Authentications.
Admin User admin created.
14、切换目录,初始化数据库
(venv) D:\zhangkai\mirrors-Superset-0.35\Superset>cd superset
(venv) D:\zhangkai\mirrors-Superset-0.35\Superset\superset>cd bin
(venv) D:\zhangkai\mirrors-Superset-0.35\Superset\superset\bin>Python superset db upgrade
2020-11-04 13:33:56,730:INFO:root:logging was configured successfully
2020-11-04 13:33:57,008:INFO:root:Configured event logger of type
2020-11-04 13:33:58,040:DEBUG:asyncio:Using selector: SelectSelector
INFO [alembic.runtime.migration] Context impl SQLiteImpl.
INFO [alembic.runtime.migration] Will assume transactional DDL.
ERROR [root] Error: Can't locate revision identified by 'f9a30386bd74'
这里有个错误:需要删除C:\Users\72701.superset\superset.db这个文件,再重新执行Python superset db upgrade这个命令
15、加载例子
(venv) D:\zhangkai\mirrors-Superset-0.35\Superset\superset\bin>Python superset load_examples
urllib.error.URLError:
报错了,但是这步也不影响整体的安装
16、初始化角色和权限
(venv) D:\zhangkai\mirrors-Superset-0.35\Superset\superset\bin>Python superset init
2020-11-04 15:08:45,670:INFO:root:logging was configured successfully
2020-11-04 15:08:45,975:INFO:root:Configured event logger of type
2020-11-04 15:08:47,080:DEBUG:asyncio:Using selector: SelectSelector
2020-11-04 15:09:19,988:INFO:root:Syncing role definition
2020-11-04 15:09:20,222:INFO:root:Syncing Admin perms
2020-11-04 15:09:20,530:INFO:root:Syncing Alpha perms
2020-11-04 15:09:22,105:INFO:root:Syncing Gamma perms
2020-11-04 15:09:23,560:INFO:root:Syncing granter perms
2020-11-04 15:09:24,653:INFO:root:Syncing sql_lab perms
2020-11-04 15:09:26,007:INFO:root:Fetching a set of all perms to lookup which ones are missing
2020-11-04 15:09:26,317:INFO:root:Creating missing datasource permissions.
2020-11-04 15:09:26,351:INFO:root:Creating missing database permissions.
2020-11-04 15:09:26,429:INFO:root:Creating missing metrics permissions
2020-11-04 15:09:26,443:INFO:root:Cleaning faulty perms
17、前台安装
D:\>cd zhangkai\mirrors-Superset-0.35\Superset\superset\assets
D:\zhangkai\mirrors-Superset-0.35\Superset\superset\assets>cnpm install -d
(venv) D:\zhangkai\mirrors-Superset-0.35\Superset\superset\assets>cnpm install -d
....省略
→ @babel/[email protected] › @babel/plugin-transform-react-jsx@^7.12.5(7.12.5) (06:34:12)
→ @babel/[email protected] › @babel/[email protected] › [email protected] › electron-to-chromium@^1.3.585(1.3.587) (11:02:35)
All packages installed (1837 packages installed from npm registry, used 4m(network 4m), speed 719.8kB/s, json 1553(4.87MB), tarball 163.59MB)
18、前台编译及运行
(venv) D:\zhangkai\mirrors-Superset-0.35\Superset\superset\assets>npm run build
(venv) D:\zhangkai\mirrors-Superset-0.35\Superset\superset\assets>npm run dev
这两步如果报错,可以尝试删除D:\zhangkai\mirrors-Superset-0.35\Superset\superset\assets\node_modules这个文件夹和D:\zhangkai\mirrors-Superset-0.35\Superset\superset\assets这个文件夹下的package-lock.json,而后重新执行
npm cache clear --force
npm install
19、登录
http://localhost:8088
用户名和密码是用户名初始化时设置的
如果出现无效用户名和密码的情况可重新执行初始化用户的那步操作.