导入modin.pandas触发AttributeError:pyarrow.Message无__reduce_cython__属性
解决
import modin.pandas时出现的AttributeError: type object 'pyarrow.lib.Message' has no attribute '__reduce_cython__' 问题背景
- 通过
conda install -c conda-forge modin安装modin库 - 执行
import modin.pandas as pd时触发上述报错,根源是pyarrow模块初始化时找不到Cython生成的序列化属性
核心原因
该报错是pyarrow与当前环境的Cython版本不兼容,或是pyarrow安装包损坏、依赖版本冲突导致的。__reduce_cython__是Cython为扩展类型生成的序列化相关属性,若pyarrow编译时依赖的Cython版本和运行环境中的Cython版本不一致,就会出现属性缺失。
解决方案
方案1:重新安装兼容版本的依赖(conda环境推荐)
先清理现有冲突的包,再安装经过验证的兼容版本组合:
# 卸载现有相关包 conda remove modin pyarrow cython -y # 安装适配Python3.7的兼容版本 conda install -c conda-forge modin pyarrow=9.0.0 cython=0.29.36 -y
方案2:改用pip安装(conda依赖处理异常时尝试)
若conda的依赖解析仍有问题,切换到pip安装:
# 卸载现有包 pip uninstall modin pyarrow cython -y # 安装带完整依赖的modin及兼容版本的pyarrow、cython pip install modin[all] pyarrow==9.0.0 cython==0.29.36
方案3:验证安装
启动Python环境,依次执行以下命令验证:
import pyarrow import modin.pandas as pd
若未报错则说明问题解决。
内容的提问来源于stack exchange,提问作者sogu
相关产品推荐
相关产品推荐

