在Deepnote中导入great_expectations遇AttributeError错误求助
解决Great Expectations导入时的AttributeError问题
问题原因
你遇到的AttributeError: module 'clickhouse_sqlalchemy.types.common' has no attribute 'Int256'错误,是因为great_expectations的部分版本与最新版clickhouse-sqlalchemy存在依赖冲突——新版clickhouse-sqlalchemy移除了Int256在clickhouse_sqlalchemy.types.common下的定义,而great_expectations的代码仍在引用这个路径。
解决方案(针对基础演示环境)
因为你仅需要搭建基础演示环境,不需要ClickHouse相关功能,通过安装兼容版本的依赖即可解决:
步骤1:卸载现有冲突包
执行以下命令清理已安装的冲突版本:
!pip uninstall -y great_expectations clickhouse-sqlalchemy
步骤2:安装兼容版本组合
选择以下任一方案执行:
方案一:指定兼容的clickhouse-sqlalchemy版本后安装great_expectations
!pip install great_expectations clickhouse-sqlalchemy==0.1.8
方案二:安装旧版great_expectations(内置兼容的依赖版本)
!pip install great_expectations==0.17.15
步骤3:验证导入
执行以下代码确认问题解决:
import great_expectations as gx print(f"Great Expectations版本: {gx.__version__}")
内容的提问来源于stack exchange,提问作者Muhammad Ali
相关产品推荐
相关产品推荐

