Superset时superset db upgrade报错

解决方法:

1、先执行如下命令,将markupsafe依赖的版本回退到 2.0.1。

(superset) [atguigu@hadoop102 ~]$ pip install –force-reinstall MarkupSafe==2.0.1

再次运行superset db upgrade 代码 查看是否解决

如果没有解决继续下面步骤

2、删除superset3.7的环境

(base) [atguigu@hadoop102 ~]$ conda remove -n superset –all

3、重新下载一个新的环境(3.8版本)

(base) [atguigu@hadoop102 ~]$ conda create –name superset python=3.8

4、激活superset环境

(base) [atguigu@hadoop102 ~]$ conda activate superset

5、安装(更新)setuptools和pip

(superset)[atguigu@hadoop102 ~]$ pip install –upgrade setuptools pip -i https://pypi.douban.com/simple/

6、安装Supetset

(superset) [atguigu@hadoop102 ~]$ pip install apache-superset -i https://pypi.douban.com/simple/

7、再次执行superset db upgrade,可能会报以下错误

执行:

(superset) [lxy@hadoop102 superset]$ export FLASK_APP=superset

8、再次执行superset db upgrade,可能会报以下错误

9、进入superet的python3.8安装目录下(如我的:/opt/module/miniconda3/envs/superset/lib/python3.8)

新增文件:vim superset_config.py

添加如下内容

Superset specific config# SS 相关的配置# 行数限制 5000 行ROW_LIMIT = 5000# 网站服务器端口 8088SUPERSET_WEBSERVER_PORT = 8088# Flask App Builder configuration# Your App secret key will be used for securely signing the session cookie# and encrypting sensitive information on the database# Make sure you are changing this key for your deployment with a strong key.# You can generate a strong key using `openssl rand -base64 42`# Flask 应用构建器配置# 应用密钥用来保护会话 cookie 的安全签名# 并且用来加密数据库中的敏感信息# 请确保在你的部署环境选择一个强密钥# 可以使用命令 openssl rand -base64 42 来生成一个强密钥SECRET_KEY = 'LqLpdU4LfBymvLBCxnM5vcdmBjqE5eBLu7fjMQHF9BWbi8QBzD4SFXmc'# The SQLAlchemy connection string to your database backend# This connection defines the path to the database that stores your# superset metadata (slices, connections, tables, dashboards, ...).# Note that the connection information to connect to the datasources# you want to explore are managed directly in the web UI# SQLAlchemy 数据库连接信息# 这个连接信息定义了 SS 元数据库的路径(切片、连接、表、数据面板等等)# 注意:需要探索的数据源连接及数据库连接直接通过网页界面进行管理#SQLALCHEMY_DATABASE_URI = 'sqlite:path/to/superset.db'# Flask-WTF flag for CSRF# 跨域请求攻击标识WTF_CSRF_ENABLED = True# Add endpoints that need to be exempt from CSRF protection# CSRF 白名单WTF_CSRF_EXEMPT_LIST = []# A CSRF token that expires in 1 year# CSFR 令牌过期时间 1 年WTF_CSRF_TIME_LIMIT = 60 * 60 * 24 * 365# Set this API key to enable Mapbox visualizations# 接口密钥用来启用 Mapbox 可视化MAPBOX_API_KEY = ''

第20行的引号中的内容:使用命令openssl rand -base64 42 来生成一个强密钥代替

同时,将第30行的代码(SQLALCHEMY_DATABASE_URI = ‘sqlite:path/to/superset.db’)注释掉

10、再次执行superset db upgrade,可能会报 No module named ‘marshmallow_enum

执行:pip install marshmallow_enum -i http://mirrors.aliyun.com/pypi/simple/ –trusted-host mirrors.aliyun.com

11、再次执行superset db upgrade,成功

12、继续进行初始化

export FLASK_APP=superset

supersetfab create-admin

superset init

没报错,即初始化成功