躬行系列-superset安装

332 阅读2分钟

官方文档

superset.apache.org/docs/instal…

安装

前提:superset是python开发的,依赖python环境

  • 安装conda,参考我另一篇文档 segmentfault.com/a/119000004…
  • 安装相关依赖 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和pippip install --upgrade setuptools pip -i https://pypi.douban.com/simple/
  • 安装superset pip install apache-superset -i https://pypi.douban.com/simple/
  • 初始化db superset db upgrade
  • 设置superset使用的web框架环境变量 export FLASK_APP=superset
  • 创建admin用户 superset fab create-admin
  • init superset init
  • 安装gunicorn pip install gunicorn
  • 启动 gunicorn --workers 5 --timeout 120 --bind 192.168.0.121:8787 "superset.app:create_app()" --daemon
  • ps -ef | awk '/superset/ && !/awk/{print $2}' | xargs kill -9

常用命令

查看version superset --version

问题

执行superset db upgrade报错

(python3) [root@localhost ~]# 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
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
logging was configured successfully
2022-11-24 10:14:39,033:INFO:superset.utils.logging_configurator:logging was configured successfully
2022-11-24 10:14:39,038:INFO:root:Configured event logger of type <class 'superset.utils.log.DBEventLogger'>
Falling back to the built-in cache, that stores data in the metadata database, for the following cache: `FILTER_STATE_CACHE_CONFIG`. It is recommended to use `RedisCache`, `MemcachedCache` or another dedicated caching backend for production deployments
2022-11-24 10:14:39,040:WARNING:superset.utils.cache_manager:Falling back to the built-in cache, that stores data in the metadata database, for the following cache: `FILTER_STATE_CACHE_CONFIG`. It is recommended to use `RedisCache`, `MemcachedCache` or another dedicated caching backend for production deployments
Falling back to the built-in cache, that stores data in the metadata database, for the following cache: `EXPLORE_FORM_DATA_CACHE_CONFIG`. It is recommended to use `RedisCache`, `MemcachedCache` or another dedicated caching backend for production deployments
2022-11-24 10:14:39,042:WARNING:superset.utils.cache_manager:Falling back to the built-in cache, that stores data in the metadata database, for the following cache: `EXPLORE_FORM_DATA_CACHE_CONFIG`. It is recommended to use `RedisCache`, `MemcachedCache` or another dedicated caching backend for production deployments
Failed to create app
Traceback (most recent call last):
  File "/usr/local/miniconda3/envs/python3/lib/python3.8/site-packages/superset/app.py", line 37, in create_app
    app_initializer.init_app()
  File "/usr/local/miniconda3/envs/python3/lib/python3.8/site-packages/superset/initialization/__init__.py", line 460, in init_app
    self.init_app_in_ctx()
  File "/usr/local/miniconda3/envs/python3/lib/python3.8/site-packages/superset/initialization/__init__.py", line 409, in init_app_in_ctx
    self.configure_url_map_converters()
  File "/usr/local/miniconda3/envs/python3/lib/python3.8/site-packages/superset/initialization/__init__.py", line 508, in configure_url_map_converters
    from superset.utils.url_map_converters import (
  File "/usr/local/miniconda3/envs/python3/lib/python3.8/site-packages/superset/utils/url_map_converters.py", line 21, in <module>
    from superset.models.tags import ObjectTypes
  File "/usr/local/miniconda3/envs/python3/lib/python3.8/site-packages/superset/models/__init__.py", line 17, in <module>
    from . import core, datasource_access_request, dynamic_plugins, sql_lab, user_attributes
  File "/usr/local/miniconda3/envs/python3/lib/python3.8/site-packages/superset/models/core.py", line 63, in <module>
    from superset.utils import cache as cache_util, core as utils
  File "/usr/local/miniconda3/envs/python3/lib/python3.8/site-packages/superset/utils/cache.py", line 28, in <module>
    from werkzeug.wrappers.etag import ETagResponseMixin
ModuleNotFoundError: No module named 'werkzeug.wrappers.etag'

参考链接:https://github.com/apache/superset/issues/20942

pip uninstall Flask
pip uninstall jinja2
pip uninstall werkzeug
pip install flask==2.0.3
pip install jinja2==3.0.1
pip install werkzeug==2.0.3