CentOS7下安装superset


一、前言

Superset 由 Python 语言编写,Superset2.0 版要求 Python3.9 的环境。

二、安装 Miniconda

Miniconda 是一个开源的包、环境管理器,包括 Conda、Python。

1.下载

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

2.安装

执行 Miniconda3-latest-Linux-x86_64.sh
安装过程中,要求指定安装路径,如:/usr/local/miniconda3

3.加载环境变量配置文件

source ~/.bashrc

4.取消激活 base 环境

conda config --set auto_activate_base false

三、创建 Python3.9 环境

1.配置 conda 国内镜像

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
conda config --set show_channel_urls yes

2.创建 superset 环境并指定 Python3.9

conda create --name superset python=3.9

备注:
conda 常用命令:
创建环境:conda create -n env_name
查看所有环境:conda info --envs
删除一个环境:conda remove -n env_name --all

3.激活 superset 环境

conda activate superset

4.查看 python 版本确认

python -V

四、Superset 部署

conda activate superset

以下操作均在 superset 环境下进行。

1.安装依赖

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

2.安装 setuptools 和 pip

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

3.安装 Supetset

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

4.初始化 Supetset 数据库

superset db upgrade

常见问题:

(1)Could not locate a Flask application. Use the ‘flask --app’ option, ‘FLASK_APP’ environment variable, or a ‘wsgi.py’ or ‘app.py’ file in the current directory.

解决方法:
执行:export FLASK_APP=superset

(2)ImportError: cannot import name ‘soft_unicode’ from 'markupsafe

解决方法:
执行:python -m pip install markupsafe==2.0.1

扫描二维码关注公众号,回复: 15238597 查看本文章

(3)ModuleNotFoundError: No module named ‘werkzeug.wrappers.etag’

解决方法:
降低 Werkzeug 的版本:

python -m pip uninstall -y Werkzeug
python -m pip install Werkzeug==2.0.3

(4)TypeError: init() got an unexpected keyword argument 'unbound_message

解决方法:
降低 Flask 的版本:

python -m pip uninstall -y Flask
python -m pip install Flask==2.0.3

(5)ModuleNotFoundError: No module named 'wtforms.ext

解决方法:
降低 WTForms 的版本:

python -m pip uninstall -y WTForms
python -m pip install WTForms==2.3.3

5.创建管理员用户

export FLASK_APP=superset
superset fab create-admin

6.Superset 初始化

superset init

五、superset 启动

1.安装 gunicorn

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

2.启动 Superset

(1)对外开放端口 8080

/sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT

(2)启动

gunicorn --workers 5 --timeout 120 --bind 192.168.1.32:8080  "superset.app:create_app()" --daemon

(3)登录 Superset

http://IP地址:8080

3.停止 Superset

ps -ef | awk '/superset/ && !/awk/{print $2}' | xargs kill -9

4.退出 Superset 环境

conda deactivate

猜你喜欢

转载自blog.csdn.net/u012069313/article/details/130564096