Skip to content

[BUG] [安装/兼容性问题] Trinity-RFT v0.6.0 在 Python 3.12 + CUDA 12.8 环境下与 vLLM / verl / opencv / numpy 存在多处版本兼容问题 #598

Description

@lsh-forge

问题描述

我在 GPU 服务器上源码安装并运行 Trinity-RFT v0.6.0,目标是使用本地模型 Qwen2.5-3B-Instruct 启动 mode: serve,让外部 Java Agent 通过 OpenAI-compatible endpoint 调用模型并回传训练数据。

但在安装和启动过程中遇到了多处版本兼容问题,主要涉及:

  • Python
  • CUDA
  • torch
  • vLLM
  • verl
  • numpy
  • opencv-python-headless
  • Trinity-RFT 与 vLLM weight_transfer 接口

希望官方能确认推荐的稳定版本组合,或者在文档中给出更明确的安装约束。


环境信息

服务器配置:

OS: Ubuntu 22.04.5 LTS
GPU: NVIDIA RTX 5880 Ada Generation, 49140 MiB
Driver Version: 570.133.20
nvidia-smi CUDA Version: 12.8
Python: 3.12
Trinity-RFT: v0.6.0, source install
Model: Qwen2.5-3B-Instruct

当前关键包版本:
torch: 2.10.0+cu128
torch cuda: 12.8
vllm: 0.19.1
verl: 0.8.0
numpy: 1.26.4
opencv-python-headless: 4.9.0.80

Trinity-RFT 代码版本:
git tag: v0.6.0
commit: f39a4d8 Release v0.6.0

配置文件中使用:
mode: serve

model:
model_path: /mnt/share/lishaohui/models/Qwen2.5-3B-Instruct

cluster:
node_num: 1
gpu_per_node: 1

explorer:
rollout_model:
engine_num: 1
enable_openai_api: true
gpu_memory_utilization: 0.60

synchronizer:
sync_method: nccl

启动命令:
ray start --head
trinity run -c my_configs/server_recovery_qwen3b.yaml

问题 1:vLLM / mistral-common 依赖解析冲突
根据 Trinity-RFT v0.6.0 的依赖,安装过程中 vLLM 范围为:
vllm>=0.19.1,<=0.23.0
但安装时出现:
ERROR: Cannot install mistral-common[image]==1.11.5 and trinity-rft because these package versions have conflicting dependencies.

The conflict is caused by:
vllm 0.19.1 depends on mistral_common>=1.10.0
mistral-common[image] 1.11.5 depends on mistral-common 1.11.5
这个错误比较困惑,因为从语义上看 mistral_common>=1.10.0 应该兼容 1.11.5,但 pip 解析失败。

问题 2:vLLM / verl / numpy / opencv-python-headless 版本互相冲突
安装完成后,pip check 出现类似问题:
verl 0.8.0 has requirement numpy<2.0.0, but you have numpy 2.2.6.
如果把 numpy 降级为:pip install numpy==1.26.4
又会出现:
opencv-python-headless 4.13.0.92 has requirement numpy>=2; python_version >= "3.9", but you have numpy 1.26.4.
如果把 opencv-python-headless 降级为:pip install opencv-python-headless==4.9.0.80
vllm 0.19.1 has requirement opencv-python-headless>=4.13.0, but you have opencv-python-headless 4.9.0.80.

也就是说:
verl 0.8.0 需要 numpy < 2
opencv 4.13+ 需要 numpy >= 2
vllm 0.19.1 需要 opencv-python-headless >= 4.13

这三者之间存在明显依赖冲突。
目前只能通过牺牲 pip check 干净性,让实际运行优先:
numpy==1.26.4
opencv-python-headless==4.9.0.80
vllm==0.19.1
verl==0.8.0
此时基础 import 和 vLLM 单独推理可以工作,但 pip check 仍然不完全干净。

问题 3:vLLM 0.20.1 会依赖 CUDA 13 运行库
尝试升级到:
pip install --force-reinstall --no-deps vllm==0.20.1
安装成功,但导入时报错:
ImportError: libcudart.so.13: cannot open shared object file: No such file or directory
当前服务器是 CUDA 12.8 / torch cu128 环境,因此 vLLM 0.20.1 的 wheel 似乎不适配 CUDA 12.8。

问题 4:Trinity-RFT serve mode 会把 sync_method 从 nccl 改成 checkpoint,但 vLLM WeightTransferConfig 不接受 checkpoint
配置中写的是:
synchronizer:
sync_method: nccl

但 Trinity-RFT 在 check_and_update() 后会自动改为:SyncMethod.CHECKPOINT
日志中也有提示:serve mode does not support NCCL synchronization, set synchronizer.sync_method to checkpoint
随后启动时报错:
pydantic_core._pydantic_core.ValidationError: 1 validation error for WeightTransferConfig
backend
Input should be 'nccl' or 'ipc' [type=literal_error, input_value='checkpoint', input_type=str]

我检查当前环境中的 vLLM:
from vllm.config import WeightTransferConfig
print(WeightTransferConfig.annotations)
输出类似:{'backend': typing.Literal['nccl', 'ipc']}
也就是说当前 vLLM 版本中 WeightTransferConfig.backend 只接受:nccl、ipc
但 Trinity-RFT 传入的是:checkpoint
相关 Trinity-RFT 代码位于:trinity/common/models/vllm_model.py
对应逻辑类似:
WeightTransferConfig(
backend="nccl" if self.config.sync_method == SyncMethod.NCCL else "checkpoint"
)
这导致启动失败。

问题 5:修改 checkpoint 为 ipc 后,又遇到 Trinity-RFT 依赖 vLLM 内部 API 缺失
为了继续验证,我临时将:
backend="checkpoint"改成backend="ipc"后,前一个错误消失,但又出现新的错误:
ImportError: cannot import name 'pack_tensors' from 'vllm.distributed.weight_transfer.packed_tensor'
完整关键日志:
File "/mnt/share/lishaohui/Trinity-RFT/trinity/common/models/vllm_worker.py", line 34, in load_model
from trinity.common.models.vllm_extension import (

File "/mnt/share/lishaohui/Trinity-RFT/trinity/common/models/vllm_extension.py", line 21, in
from vllm.distributed.weight_transfer.packed_tensor import (
pack_tensors,
unpack_tensor,
)

ImportError: cannot import name 'pack_tensors' from 'vllm.distributed.weight_transfer.packed_tensor'
说明 Trinity-RFT v0.6.0 当前源码依赖 vLLM 内部 weight_transfer API,但 vllm==0.19.1 中没有这个函数。

目前看起来存在几个互相冲突的问题:
vllm==0.19.1 能在 CUDA 12.8 下 import 和单独推理,但缺少 Trinity-RFT 需要的 pack_tensors
vllm==0.20.1 可能接口更接近 Trinity-RFT,但当前 wheel 依赖 libcudart.so.13,不适合 CUDA 12.8
verl==0.8.0 要求 numpy<2
vllm==0.19.1 要求 opencv-python-headless>=4.13
opencv-python-headless>=4.13 在 Python 3.12 下要求 numpy>=2
Trinity-RFT serve 模式下会把 sync_method 改成 checkpoint,但当前 vLLM WeightTransferConfig 只接受 nccl 或 ipc
这些问题不是单个包安装失败,而是多个官方依赖范围之间互相不兼容,导致我很难根据当前文档得到一套可运行环境。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions