使用pip安装dbt-snowflake失败求助:pyarrow编译wheel报错
错误信息
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pyarrow
Failed to build pyarrow
ERROR: Could not build wheels for pyarrow, which is required to install pyproject.toml-based projects
[end of output]note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.note: This error originates from a subprocess, and is likely not a problem with pip.
解决方案
升级pip及构建工具
确保pip、setuptools和wheel是最新版本,避免工具本身的兼容性问题:pip install --upgrade pip setuptools wheel安装系统级编译依赖
pyarrow编译需要C++编译环境和相关依赖库,根据操作系统安装:- Debian/Ubuntu:
sudo apt-get install build-essential cmake libboost-all-dev - macOS:
先安装Xcode命令行工具:
再通过Homebrew安装依赖:xcode-select --installbrew install cmake boost - Windows:
安装Visual Studio Build Tools,勾选「Desktop development with C++」组件(包含MSVC编译器、CMake等)
- Debian/Ubuntu:
直接安装预编译pyarrow包
跳过本地编译,使用官方预编译的wheel包:pip install pyarrow --only-binary :all:完成后再尝试安装dbt-snowflake:
pip install dbt-snowflake指定兼容的dbt-snowflake版本
部分新版本dbt-snowflake依赖的pyarrow版本对编译环境要求较高,可尝试安装稳定旧版本:pip install dbt-snowflake==1.8.0使用conda安装(推荐)
若使用conda环境,conda会自动处理所有依赖(包括预编译的pyarrow):conda install -c conda-forge dbt-snowflake
内容的提问来源于stack exchange,提问作者Micah Tobias

