Superset配置时遇到错误

825 阅读1分钟

本文已参与「新人创作礼」活动,一起开启掘金创作之路。

今天在学习数据仓库可视化工具superset时,在配置superset环境时遇到的错误,解决后记录下来。

1.ImportError: cannot import name ‘soft_unicode’ from ‘markupsafe’

这个错误是新版本的markupsafe代码变动问题产生的,需要退回到2.0.1

python -m pip install markupsafe==2.0.1

或者

pip3 install --force-reinstall MarkupSafe==2.0.1

2.ImportError: cannot import name ‘TypedDict’ from ‘typing’ (/opt/module/miniconda3/envs/superset/lib/python3.7/typing.py)

解决方法为将python环境更改为3.8

conda deactivate

conda remove -n superset --all

conda create --name superset python=3.8

conda activate superset

之后安装superset所需要的依赖和工具包

sudo yum install -y gcc gcc-c++ libffi-devel python-devel python-pip python-wheel python-setuptools openssl-devel cyrus-sasl-devel openldap-devel

pip install --upgrade setuptools pip -i https://pypi.douban.com/simple/

安装superset

pip install apache-superset -i https://pypi.douban.com/simple/

之后初始化数据库

superset db upgrade

这里如果遇到 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.

需要配置export FLASK_APP=superset

3(主要问题).ModuleNotFoundError: No module named 'werkzeug.wrappers.etag'错误,

解决方法为将该包版本回滚,这里回滚的版本要大于2.0.0,原因是super使用的flask框架需要werkzeug大于2.0.0,否则superset启动后虽然可以成功,但是页面显示的内容是空白错误的。

image.png

python -m pip install werkzeug==2.0.0

之后配置用户初始化superset解决问题。

image.png

参考网址:blog.csdn.net/Ajekseg/art…