Superset

安装Miniconda

下载地址:https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
[xiamu@hadoop202 superset]$ ls
Miniconda3-latest-Linux-x86_64.sh
[xiamu@hadoop202 superset]$ pwd
/opt/software/superset
[xiamu@hadoop202 superset]$ bash Miniconda3-latest-Linux-x86_64.sh

# 按回车
# 两次空格
# yes
# /opt/module/miniconda3
# yes

==> For changes to take effect, close and re-open your current shell. <==

If you'd prefer that conda's base environment not be activated on startup,
set the auto_activate_base parameter to false:

conda config --set auto_activate_base false

Thank you for installing Miniconda3!

# 出现这段话说明安装成功了, 但是需要重新启动一下shell或者重新加载一次配置文件
# 加载配置文件
[xiamu@hadoop202 ~]$ source ~/.bashrc
# 这是自动激活出现的base
(base) [xiamu@hadoop202 ~]$ python -V
Python 3.7.4
(base) [xiamu@hadoop202 ~]$

# 取消自动激活base
(base) [xiamu@hadoop202 ~]$ conda config --set auto_activate_base false

# 再开一个新shell, 查看版本变成了2.7
[xiamu@hadoop202 ~]$ python -V
Python 2.7.5

创建不同的python环境

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# 激活base环境
[xiamu@hadoop202 ~]$ conda activate base
(base) [xiamu@hadoop202 ~]$ python -V
Python 3.7.4

# 取消激活
(base) [xiamu@hadoop202 ~]$ conda deactivate
[xiamu@hadoop202 ~]$

# 配置conda国内镜像

[xiamu@hadoop202 ~]$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
[xiamu@hadoop202 ~]$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

# 查看源
[xiamu@hadoop202 ~]$ conda config --show-sources

# 创建Python环境
[xiamu@hadoop202 ~]$ conda create --name superset python=3.7

# 激活环境
[xiamu@hadoop202 ~]$ conda activate superset
# 取消激活
[xiamu@hadoop202 ~]$ conda deactivate

Superset部署

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# 安装Superset之前,需安装以下所需依赖。
(superset) [xiamu@hadoop202 ~]$ sudo yum install -y gcc gcc-c++ libffi-devel python-devel python-pip python-wheel python-setuptools openssl-devel cyrus-sasl-devel openldap-devel

# 安装(更新)setuptools和pip
(superset) [xiamu@hadoop202 ~]$ pip install --upgrade setuptools pip -i https://pypi.douban.com/simple/

# 安装Supetset
(superset) [xiamu@hadoop202 ~]$ pip install apache-superset -i https://pypi.douban.com/simple/


(superset) [xiamu@hadoop202 ~]$ superset db upgrade

Traceback (most recent call last):
File "/opt/module/miniconda3/envs/superset/bin/superset", line 5, in <module>
from superset.cli.main import superset
File "/opt/module/miniconda3/envs/superset/lib/python3.7/site-packages/superset/__init__.py", line 18, in <module>
from flask import current_app, Flask
File "/opt/module/miniconda3/envs/superset/lib/python3.7/site-packages/flask/__init__.py", line 14, in <module>
from jinja2 import escape
File "/opt/module/miniconda3/envs/superset/lib/python3.7/site-packages/jinja2/__init__.py", line 12, in <module>
from .environment import Environment
File "/opt/module/miniconda3/envs/superset/lib/python3.7/site-packages/jinja2/environment.py", line 25, in <module>
from .defaults import BLOCK_END_STRING
File "/opt/module/miniconda3/envs/superset/lib/python3.7/site-packages/jinja2/defaults.py", line 3, in <module>
from .filters import FILTERS as DEFAULT_FILTERS # noqa: F401
File "/opt/module/miniconda3/envs/superset/lib/python3.7/site-packages/jinja2/filters.py", line 13, in <module>
from markupsafe import soft_unicode
ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/opt/module/miniconda3/envs/superset/lib/python3.7/site-packages/markupsafe/__init__.py)

# 如果出现这个报错
# 则执行如下命令,将markupsafe依赖的版本回退到 2.0.1。
(superset) [xiamu@hadoop202 superset]$ pip install --force-reinstall MarkupSafe==2.0.1

Traceback (most recent call last):
File "/opt/module/miniconda3/envs/superset/bin/superset", line 5, in <module>
from superset.cli.main import superset
File "/opt/module/miniconda3/envs/superset/lib/python3.7/site-packages/superset/__init__.py", line 21, in <module>
from superset.app import create_app
File "/opt/module/miniconda3/envs/superset/lib/python3.7/site-packages/superset/app.py", line 23, in <module>
from superset.initialization import SupersetAppInitializer
File "/opt/module/miniconda3/envs/superset/lib/python3.7/site-packages/superset/initialization/__init__.py", line 33, in <module>
from superset.extensions import (
File "/opt/module/miniconda3/envs/superset/lib/python3.7/site-packages/superset/extensions/__init__.py", line 116, in <module>
celery_app = celery.Celery()
File "/opt/module/miniconda3/envs/superset/lib/python3.7/site-packages/celery/local.py", line 509, in __getattr__
module = __import__(self._object_origins[name], None, None, [name])
File "/opt/module/miniconda3/envs/superset/lib/python3.7/site-packages/celery/app/__init__.py", line 5, in <module>
from celery import _state
File "/opt/module/miniconda3/envs/superset/lib/python3.7/site-packages/celery/_state.py", line 17, in <module>
from celery.utils.threads import LocalStack
File "/opt/module/miniconda3/envs/superset/lib/python3.7/site-packages/celery/utils/__init__.py", line 19, in <module>
from .nodenames import nodename, nodesplit, worker_direct
File "/opt/module/miniconda3/envs/superset/lib/python3.7/site-packages/celery/utils/nodenames.py", line 9, in <module>
from kombu.entity import Exchange, Queue
File "/opt/module/miniconda3/envs/superset/lib/python3.7/site-packages/kombu/entity.py", line 9, in <module>
from .serialization import prepare_accept_content
File "/opt/module/miniconda3/envs/superset/lib/python3.7/site-packages/kombu/serialization.py", line 456, in <module>
for ep, args in entrypoints('kombu.serializers'): # pragma: no cover
File "/opt/module/miniconda3/envs/superset/lib/python3.7/site-packages/kombu/utils/compat.py", line 93, in entrypoints
for ep in importlib_metadata.entry_points().get(namespace, [])
AttributeError: 'EntryPoints' object has no attribute 'get'

(superset) [xiamu@hadoop202 superset]$ pip install importlib-metadata==4.13.0


Traceback (most recent call last):
File "/opt/module/miniconda3/envs/superset/bin/superset", line 5, in <module>
from superset.cli.main import superset
File "/opt/module/miniconda3/envs/superset/lib/python3.7/site-packages/superset/__init__.py", line 21, in <module>
from superset.app import create_app
File "/opt/module/miniconda3/envs/superset/lib/python3.7/site-packages/superset/app.py", line 23, in <module>
from superset.initialization import SupersetAppInitializer
File "/opt/module/miniconda3/envs/superset/lib/python3.7/site-packages/superset/initialization/__init__.py", line 51, in <module>
from superset.security import SupersetSecurityManager
File "/opt/module/miniconda3/envs/superset/lib/python3.7/site-packages/superset/security/__init__.py", line 17, in <module>
from superset.security.manager import SupersetSecurityManager # noqa: F401
File "/opt/module/miniconda3/envs/superset/lib/python3.7/site-packages/superset/security/manager.py", line 68, in <module>
from superset.security.guest_token import (
File "/opt/module/miniconda3/envs/superset/lib/python3.7/site-packages/superset/security/guest_token.py", line 18, in <module>
from typing import List, Optional, TypedDict, Union
ImportError: cannot import name 'TypedDict' from 'typing' (/opt/module/miniconda3/envs/superset/lib/python3.7/typing.py)


卸载Python版本
(superset) [xiamu@hadoop202 superset]$ conda deactivate
[xiamu@hadoop202 superset]$ conda remove -n superset --all
# 安装新版
[xiamu@hadoop202 superset]$ conda create --name superset python=3.9

# 参考
https://blog.csdn.net/qq1787546870/article/details/124582727

Traceback (most recent call last):
File "/opt/module/miniconda3/envs/superset/bin/superset", line 5, in <module>
from superset.cli.main import superset
File "/opt/module/miniconda3/envs/superset/lib/python3.9/site-packages/superset/__init__.py", line 21, in <module>
from superset.app import create_app
File "/opt/module/miniconda3/envs/superset/lib/python3.9/site-packages/superset/app.py", line 23, in <module>
from superset.initialization import SupersetAppInitializer
File "/opt/module/miniconda3/envs/superset/lib/python3.9/site-packages/superset/initialization/__init__.py", line 33, in <module>
from superset.extensions import (
File "/opt/module/miniconda3/envs/superset/lib/python3.9/site-packages/superset/extensions/__init__.py", line 32, in <module>
from superset.utils.async_query_manager import AsyncQueryManager
File "/opt/module/miniconda3/envs/superset/lib/python3.9/site-packages/superset/utils/async_query_manager.py", line 26, in <module>
from superset.utils.core import get_user_id
File "/opt/module/miniconda3/envs/superset/lib/python3.9/site-packages/superset/utils/core.py", line 106, in <module>
from superset.sql_parse import sanitize_clause
File "/opt/module/miniconda3/envs/superset/lib/python3.9/site-packages/superset/sql_parse.py", line 67, in <module>
re.compile(r"'(''|\\\\|\\|[^'])*'", sqlparse.keywords.FLAGS).match,
AttributeError: module 'sqlparse.keywords' has no attribute 'FLAGS'
(superset) [xiamu@hadoop202 superset]$ pip install sqlparse=='0.4.3'

(superset) [xiamu@hadoop202 superset]$ superset db upgrade
Usage: superset [OPTIONS] COMMAND [ARGS]...
Try 'superset --help' for help.


Error: Could not locate a Flask application. You did not provide the "FLASK_APP" environment variable, and a "wsgi.py" or "app.py" module was not found in the current directory.
(superset) [xiamu@hadoop202 superset]$ export FLASK_APP=superset


(superset) [xiamu@hadoop202 superset]$ superset db upgrade
--------------------------------------------------------------------------------
WARNING
--------------------------------------------------------------------------------
A Default SECRET_KEY was detected, please use superset_config.py to override it.
Use a strong complex alphanumeric string and use a tool to help you generate
a sufficiently random sequence, ex: openssl rand -base64 42
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Refusing to start due to insecure SECRET_KEY

(superset) [xiamu@hadoop202 superset]$ openssl rand -base64 42
qh1gH4ZwdmLPN09dczEKhqbgE7U1EN8omxbtnSUSvpxeHwTiHqwcTbNc
(superset) [xiamu@hadoop202 superset]$ export SECRET_KEY='qh1gH4ZwdmLPN09dczEKhqbgE7U1EN8omxbtnSUSvp
xeHwTiHqwcTbNc'

(superset) [xiamu@hadoop202 ~]$ superset db upgrade
--------------------------------------------------------------------------------
WARNING
--------------------------------------------------------------------------------
A Default SECRET_KEY was detected, please use superset_config.py to override it.
Use a strong complex alphanumeric string and use a tool to help you generate
a sufficiently random sequence, ex: openssl rand -base64 42
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Refusing to start due to insecure SECRET_KEY

pip install apache-superset==1.4.2

使用docker部署安装Superset

非常简单, 不折腾之前的安装方式了QAQ

1
2
3
4
5
6
7
8
9
wget https://github.com/apache/superset/archive/refs/heads/master.zip
下载安装包, 然后使用unzip解压
[xiamu@hadoop202 superset]$ unzip master.zip -d /opt/module/

cd /opt/module/superset-master/
sudo docker compose -f docker-compose-non-dev.yml pull
sudo docker compose -f docker-compose-non-dev.yml up
此时打开浏览器 输入:http://IP:8088/登录即可。
默认用户名密码是admin

参考: https://blog.csdn.net/m0_37657585/article/details/130767228


Superset
https://xiamu.icu/大数据/Superset/
作者
肉豆蔻吖
发布于
2023年6月13日
许可协议