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

安装FARM-Haystack导致PyTorch降级引发CUDA兼容性问题

GPU运行Haystack的CUDA兼容性问题

问题概述

安装farm-haystack[docstores-gpu,faiss-gpu]时,PyTorch会被强制降级到torch<1.13,>1.9版本,导致其配套的CUDA版本(10.2)无法兼容RTX 3060的sm_86算力,触发兼容性错误。

错误信息

NVIDIA GeForce RTX 3060 with CUDA capability sm_86 is not compatible with the current PyTorch installation. The current PyTorch install supports CUDA capabilities sm_37 sm_50 sm_60 sm_70. If you want to use the NVIDIA GeForce RTX 3060 GPU with PyTorch, please check the instructions at

复现步骤

  • 用conda创建全新虚拟环境
  • 安装PyTorch 1.13:
    pip3 install torch torchvision torchaudio
    
    此时版本验证:
    >>> torch.__version__
    '1.13.0'
    >>> torch.version.cuda
    '11.7'
    
  • 安装带GPU支持的Haystack:
    pip3 install 'farm-haystack[docstores-gpu,faiss-gpu]'
    
    安装过程中会自动下载torch-1.12.1-cp38-cp38-manylinux1_x86_64.whl,强制降级PyTorch
  • 再次验证版本:
    >>> torch.__version__
    '1.12.1+cu102'
    >>> torch.version.cuda
    '10.2'
    

解决方法

方法1:拆分安装,避免自动降级

先安装不带GPU依赖的Haystack核心包,再手动安装兼容的FAISS-GPU:

# 先安装Haystack核心
pip3 install farm-haystack
# 单独安装FAISS-GPU,跳过依赖检查
pip3 install faiss-gpu --no-deps

这种方式不会触发PyTorch版本降级,同时保留GPU加速能力。

方法2:强制指定PyTorch版本安装

安装Haystack时明确指定要保留的PyTorch版本,让pip优先满足版本约束:

pip3 install 'farm-haystack[docstores-gpu,faiss-gpu]' torch==1.13.0 torchvision torchaudio

方法3:修改源码约束后本地安装

如果前两种方法无效,可克隆Haystack源码,修改版本约束后本地安装:

git clone Haystack官方源码仓库
cd haystack

编辑setup.py文件,将PyTorch的版本限制从torch<1.13,>=1.9改为torch>=1.9,然后执行:

pip3 install -e '.[docstores-gpu,faiss-gpu]'

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.10 13:35:22