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

通过Git从requirements.txt安装dbt-core时出错求助

解决通过Git源安装dbt-core v1.6.0时的Wheel编译错误

问题重现

  • 项目根目录创建requirements.txt,内容如下:
    dbt-core @ git+https://github.com/dbt-labs/dbt-core.git@v1.6.0#subdirectory=core
    
  • 执行安装命令:
    pip install -r requirements.txt
    
  • 核心报错信息:
    error: could not create 'build\bdist.win-amd64\wheel\.\dbt\include\global_project\macros\materializations\models\materialized_view\get_materialized_view_configuration_changes.sql': No such file or directory
    

已尝试--no-cache-dir、--no-binary参数,无效;dbt-core 1.6以下版本可正常安装,且必须通过Git安装自定义分支。

原因分析

dbt-core v1.6.0起切换到pyproject.toml作为构建配置文件,但通过Git源安装时,pip默认尝试用旧的setup.py构建wheel,在Windows系统下出现路径解析或目录创建时序异常,导致文件写入失败。低版本未切换构建系统,因此无此问题。

可行解决方案

方案1:使用Editable模式安装(推荐)

跳过wheel构建,直接链接源码,适配自定义分支场景:

pip install -e git+https://github.com/your-username/dbt-core.git@your-custom-branch#subdirectory=core

该模式无需编译wheel,避免路径类构建错误,后续分支更新也更便捷。

方案2:强制使用PEP517构建标准

指定用pyproject.toml定义的构建后端,同时升级依赖的构建工具:

pip install -r requirements.txt --use-pep517 --upgrade setuptools wheel

--use-pep517让pip调用现代构建流程,配合升级setuptools和wheel可修复多数路径相关的构建问题。

方案3:本地克隆后手动安装

  1. 克隆自定义分支仓库:
    git clone https://github.com/your-username/dbt-core.git --branch your-custom-branch
    
  2. 进入core子目录:
    cd dbt-core/core
    
  3. 执行本地安装:
    pip install .
    

完全绕开远程Git源的构建限制,本地构建更可控。

验证

安装完成后执行以下命令确认版本:

dbt --version

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.07 18:42:28