You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

执行superset db upgrade命令失败,请求排查依赖及导入错误

RHEL8安装Apache Superset后superset db upgrade报错的解决

问题背景

在RHEL8系统中按以下步骤安装Apache Superset:

yum install gcc gcc-c++ libffi-devel python3-devel python3-pip python3-wheel

pip3 install apache-superset --ignore-installed PyYAML

执行superset db upgrade时触发两个问题:

  1. Requests依赖警告(urllib3版本不兼容)
  2. 核心报错:ImportError: cannot import name '_ColumnEntity'

完整报错信息

/usr/lib/python3.6/site-packages/requests/__init__.py:91: RequestsDependencyWarning: urllib3 (1.26.12) or chardet (3.0.4) doesn't match a supported version!   RequestsDependencyWarning) Traceback (most recent call last):   File "/usr/local/bin/superset", line 5, in <module>
    from superset.cli import superset   File "/usr/local/lib/python3.6/site-packages/superset/__init__.py", line 21, in <module>
    from superset.app import create_app   File "/usr/local/lib/python3.6/site-packages/superset/app.py", line 24, in <module>
    from flask_appbuilder import expose, IndexView   File "/usr/local/lib/python3.6/site-packages/flask_appbuilder/__init__.py", line 5, in <module>
    from .api import ModelRestApi  # noqa: F401   File "/usr/local/lib/python3.6/site-packages/flask_appbuilder/api/__init__.py", line 21, in <module>
    from .convert import Model2SchemaConverter   File "/usr/local/lib/python3.6/site-packages/flask_appbuilder/api/convert.py", line 4, in <module>
    from flask_appbuilder.models.sqla.interface import SQLAInterface   File "/usr/local/lib/python3.6/site-packages/flask_appbuilder/models/sqla/interface.py", line 40, in <module>
    from sqlalchemy_utils.types.uuid import UUIDType   File "/usr/local/lib/python3.6/site-packages/sqlalchemy_utils/__init__.py", line 1, in <module>
    from .aggregates import aggregated  # noqa   File "/usr/local/lib/python3.6/site-packages/sqlalchemy_utils/aggregates.py", line 372, in <module>
    from .functions.orm import get_column_key   File "/usr/local/lib/python3.6/site-packages/sqlalchemy_utils/functions/__init__.py", line 1, in <module>
    from .database import (  # noqa   File "/usr/local/lib/python3.6/site-packages/sqlalchemy_utils/functions/database.py", line 11, in <module>
    from .orm import quote   File "/usr/local/lib/python3.6/site-packages/sqlalchemy_utils/functions/orm.py", line 14, in <module>
    from sqlalchemy.orm.query import _ColumnEntity ImportError: cannot import name '_ColumnEntity'

当前环境信息

urllib3版本:

pip3.6 list | grep urllib3
urllib3 1.26.12

解决步骤

1. 修复_ColumnEntity导入错误

该错误源于sqlalchemy_utils与SQLAlchemy版本不兼容,_ColumnEntity在高版本SQLAlchemy中已被移除。安装兼容版本的sqlalchemy_utils:

pip3 install sqlalchemy_utils==0.36.8

2. 解决Requests依赖警告

安装Requests支持的urllib3版本:

pip3 install urllib3==1.26.6

3. 重新执行数据库迁移

完成依赖调整后,再次运行:

superset db upgrade

内容的提问来源于stack exchange,提问作者Attapol Roungsook

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.19 01:20:41