AI知识库Ragflow

39 阅读2分钟

一、部署环境准备

(一)硬件:

  1. 双AMD CPU,128G内存, N卡A5000(24G显存)X2 工作站
  2. 安装有nvida 驱动, cuda 13.1+ (二)软件
  3. 操作系统: Debian 12.1  (也可以Ubuntu Server 24.04 +)
  4. 包管理器 miniconda, conda -V  conda 25.7.0
  5. 采用内置的python 3.13

(三)确保 vm.max_map_count 不小于 262144:

# 这里我们设为 262144:
sudo sysctl -w vm.max_map_count=262144

二、安装ragflow

采用pip安装的方式, 步骤多,耗时长。。

#!/bin/bash 
# Update package lists and upgrade existing packages 
sudo apt update && sudo apt upgrade -y 

# Install Python3, pip, and other tools 
sudo apt install python3 python3-pip python3-venv build-essential libssl-dev libffi-dev zlib1g-dev -y 

# Create project directory and set up virtual environment 
cd ~
mkdir ragflow 
cd ragflow 
python3 -m venv venv source venv/bin/activate 

# Clone Ragflow repository and install dependencies 
# Replace the URL below with the actual Ragflow GitHub repository URL 
# git clone https://github.com/example/ragflow.git
git clone https://gitee.com/phpmvcv2/ragflow.git
cd ~/ragflow 
pip install --upgrade pip 

## ragflow的包依赖文件在 pyproject.toml中,不是requirements.txt中,
# pip install -r requirements.txt
pip install -e . \
     -i https://mirrors.aliyun.com/pypi/simple/

# Run Ragflow application
# Adjust the command according to Ragflow's specific startup method
# python app.py

三、遇到的问题

(一)github下载不稳定 在git clone https://github.com/example/ragflow.git 步骤中,网络时断时连,考虑国内镜像 在gitee中,克隆、导入 github的项目, 从国内的gitee克隆,速度有保障。但下载发布版还是会连接到github

(二)pip 安装 graspologic 出错

手动解决 APT 依赖(适用于纯 pip 环境)

若必须使用 pip,需先安装系统依赖:

apt update
apt install -y build-essential python3-dev libopenblas-dev libomp-dev

# 升级 pip 并安装 wheel
pip install --upgrade pip wheel

# 强制指定 numba 版本(避免 LLVM 冲突)
pip install "numba<0.57" "scikit-learn<1.3" graspologic

如果失败,可尝试源码安装:

下载源码,编译

## 导入github项目源码到gitee仓库
## git clone https://github.com/microsoft/graspologic.git
git clone https://gitee.com/7n/graspologic.git
cd graspologic
pip install -e . \
   -i https://mirrors.aliyun.com/pypi/simple/
   
## 之后继续安装ragflow, 重复多次,直到成功。。。
cd ~/ragflow
pip install -e . \
     -i https://mirrors.aliyun.com/pypi/simple/
     

(三)配置工具错误 提示消息: (1)Please install pkg-config on your system or set the ICU_VERSION environment, (2)Failed to build 'pyicu' when getting requirements to build wheel 核心原因分析 根据错误日志,构建失败的关键点在于: 缺少 pkg-config 工具:系统无法定位 ICU 库的配置信息。 未设置 ICU_VERSION 环境变量:构建脚本无法确定已安装的 ICU 版本。 缺少 ICU 开发文件:如 unicode/utypes.h 等头文件未安装。

安装系统依赖(推荐) 通过系统包管理器安装 pkg-config 和 ICU 开发库:

sudo apt install -y pkg-config libicu-dev

# 验证 ICU 版本
pkg-config --modversion icu-uc  # 应输出版本号如 72.1

或者用conda 预编译的包

使用 Conda 安装(绕过编译)

Conda 提供预编译的 pyicu 包,无需构建:

bash
# 安装 Miniconda(若未安装)
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh

# 创建环境并安装
conda create -n ragflow python=3.10
conda activate ragflow
conda install -c conda-forge pyicu