mirror of
https://github.com/kvcache-ai/ktransformers.git
synced 2026-11-05 01:07:28 +00:00
[GH-ISSUE #1092] [Bug] 编译失败:cmake --build . 在 Ubuntu + CUDA12.6 + PyTorch2.6 环境中返回非零退出码 #767
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/ktransformers#767
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @xuhaodegithub on GitHub (Apr 9, 2025).
Original GitHub issue: https://github.com/kvcache-ai/ktransformers/issues/1092
Checklist
Describe the bug
我在尝试从源码安装 ktransformers(使用 CUDA 编译)时遇到了构建失败的问题,pip 调用 CMake 编译时报错:
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--verbose', '--parallel=112']' returned non-zero exit status 1.
error: subprocess-exited-with-error
× Building wheel for ktransformers (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> See above for output.
我已尝试使用 KTRANSFORMERS_FORCE_BUILD=TRUE pip install -v . --no-build-isolation 并开启详细日志查看,但编译失败的位置仍然不明确。
🔁 复现步骤
克隆源码并进入目录
更新子模块:git submodule update --init --recursive
确保 CUDA 环境变量已配置
安装依赖后执行:USE_BALANCE_SERVE=1 USE_NUMA=1 bash ./install.sh
Reproduction
USE_BALANCE_SERVE=1 USE_NUMA=1 bash ./install.sh
Environment
操作系统 | Ubuntu 22.04 / Linux Kernel 5.15.0-136-generic
Python 版本 | 3.11.11
Python 路径 | /mnt/data/py311/bin/python
PyTorch 版本 | 2.6.0+cu124
CUDA Available | ✅ 是
PyTorch 用的 CUDA 版本 | 12.4
系统安装的 CUDA 版本 (nvcc) | 12.6 (V12.6.20)
CUDA_HOME | /usr/local/cuda
PATH 中的 CUDA 路径 | /usr/local/cuda/bin(已设置)
GCC / G++ | 11.4.0
CMake 版本 | 3.22.1
@yeungtuzi commented on GitHub (Apr 9, 2025):
问题太多,不知道如何定位,看各种说法都有,包括
好像比较看脸
@Zzzer0o commented on GitHub (Apr 10, 2025):
遇到一样的问题,使用的docker 镜像pytorch/pytorch:2.6.0-cuda12.6-cudnn9-devel,报错根本看不出原因。
@Zhiwei-Dai commented on GitHub (Apr 10, 2025):
也遇到了这个问题,0.2.3正常,升级到0.2.4报出一堆异常,也定位不到原因。我做了两点尝试,通过了,供参考:
1、cmake可使用pip安装升级到最新4.0
2、看了B站的视频之后,参考脚本执行正常:env USE_BALANCE_SERVE=1 USE_NUMA=1 PYTHONPATH="$(which python)" PATH="$(dirname $(which python)):$PATH" bash ./install.sh。(参考官方的就是不行:USE_BALANCE_SERVE=1 USE_NUMA=1 bash ./install.sh)
@yeungtuzi commented on GitHub (Apr 10, 2025):
再补充一些内容,编译前执行
export CUDA_HOME=/usr/local/cuda
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
export CUDA_PATH=/usr/local/cuda
export TORCH_CUDA_ARCH_LIST="8.9" #"8.9" for 4090, "8.0" for A100
pip install cmake --upgrade
@QThans commented on GitHub (Apr 10, 2025):
这样 ok 了。cmake 4.0 很重要
@CYSTEV-chn commented on GitHub (Apr 16, 2025):
铲掉克隆的kt文件下,重新克隆一遍,应该可以跑通