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

使用Poetry安装pyarrow等Python模块失败的问题求助

解决方案

1. 修复Poetry运行环境与项目环境不一致问题

你安装Poetry时使用的是系统默认python3(当时大概率是Python3.10),导致Poetry自身运行在3.10环境,和项目指定的3.12环境冲突,引发依赖解析、wheel匹配错误。解决步骤:

  • 用Python3.12重新安装Poetry:
    curl -sSL https://install.python-poetry.org | python3.12 -
    
  • 验证环境一致性:
    poetry --version
    poetry env info
    
    确认输出中Poetry Python对应版本为3.12。

2. 正确安装适配Python3.12的pyarrow

你使用的pyarrow 13.0.0不支持Python3.12(该版本最高兼容至Python3.11),pyarrow从14.0.0版本开始正式支持Python3.12,按以下步骤操作:

  • 移除pyproject.toml中pyarrow的本地wheel配置,改为指定兼容版本:
    [tool.poetry.dependencies]
    pyarrow = "^14.0.0"
    
  • 确保项目环境为Python3.12,执行安装命令:
    poetry add pyarrow
    
    此时Poetry会自动下载适配Python3.12的预编译wheel,无需手动编译。

若因特殊架构需编译安装,先补全编译依赖:

sudo apt install python3.12-dev cmake libboost-all-dev

先安装numpy(pyarrow编译依赖)再安装pyarrow:

poetry add numpy
poetry add pyarrow

3. 解决pytickersymbols的pyyaml依赖问题

无需手动指定本地wheel,直接在pyproject.toml中明确依赖约束,让Poetry自动处理:

[tool.poetry.dependencies]
pytickersymbols = "^1.13.0"
pyyaml = ">=6.0,<6.1"  # 明确允许6.0版本,满足pytickersymbols的降级需求

执行命令更新锁文件并安装:

poetry lock --no-update
poetry install

4. 本地wheel导入错误的原因

你使用的pyarrow-13.0.0-cp310-cp310-*.whl是针对Python3.10编译的,CPython的ABI在3.10到3.12存在兼容性变化,跨版本wheel无法在Python3.12环境正常导入,必须使用对应Python版本的wheel包。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.08 14:10:24