Windows下使用源码和Conda搭建GraphRAG指南

Windows下使用源码和Conda搭建GraphRAG指南

点击查看【GraphRAG的使用

1. 创建和激活conda环境

bash 复制代码
conda create --name=graphrag_env
conda activate graphrag_env

2. 安装系统依赖

GraphRAG需要一些系统级依赖:

1)安装 CMake (如果尚未安装)

从【这个地址】下载并安装CMake,执行以下命令并看到以下信息表示安装成功:

bash 复制代码
C:\Users\Administrator>cmake --version
cmake version 3.31.10
CMake suite maintained and supported by Kitware (kitware.com/cmake).
C:\Users\Administrator>

2)安装Microsoft C++ Build Tools

从【这个地址】下载并安装 Visual Studio Build Tools(或 Visual Studio Community)。

下载后,双击运行【vs_BuildTools.exe】,该程序执行完下载后进入到安装界面,此时,选择【单个组件】选项卡,在筛选框中输入【C++ Build Tools】关键字进行筛选,勾选后点击【安装】按钮完成安装。

3. 安装PyTorch

bash 复制代码
# 根据您的CUDA版本选择合适的PyTorch安装命令
# 如果没有GPU,使用CPU版本

# CPU版本
conda install pytorch torchvision torchaudio cpuonly -c pytorch

# 或者使用pip
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu

4. 克隆GraphRAG源码

bash 复制代码
# 克隆GraphRAG仓库
git clone https://github.com/microsoft/graphrag.git
cd graphrag

5. 安装GraphRAG

这里使用 pyproject.toml 进行安装,需要进入到 graphrag 目录,运行以下命令:

bash 复制代码
# 从源码安装
pip install -e .

# 或者直接使用pip安装(如果已发布到PyPI)
# pip install graphrag

6. 验证安装

graphrag 目录的同级,创建名为 graphrag_test 目录,并在该目录下创建测试脚本 test_installation.py 文件,内容如下:

python 复制代码
import sys
try:
    import graphrag
    print("✓ GraphRAG导入成功")
    
    import torch
    print(f"✓ PyTorch版本: {torch.__version__}")
    
    import networkx as nx
    print(f"✓ NetworkX版本: {nx.__version__}")
    
    print("✓ 所有依赖安装成功!")
    
except ImportError as e:
    print(f"✗ 导入错误: {e}")
    sys.exit(1)

运行测试:

bash 复制代码
cd ../graphrag_test/
python test_installation.py
相关推荐
qq_3692243313 天前
Windows全系通用!ntdll.dll文件丢失、报错、闪退问题的完整排查与修复教程
windows·dll·dll修复·dll丢失·dll错误
阿米亚波13 天前
【Windows】QEMU 启动 openEuler aarch64/arm64 架构系统 + 离线软件源
linux·windows·经验分享·笔记·架构·arm
caimouse13 天前
Reactos 第 10 章 网络操作 — 10.3.1 NIC驱动
网络·windows
初圣魔门首席弟子13 天前
Node.js 详细介绍(知识库版)
windows·qt·node.js·知识库
CHENG-JustDoIt13 天前
AI工具 | 爆火开源项目Odysseus AI 工作台:从项目介绍、部署情况及其使用等多方位分析指南(含详细步骤)
大数据·人工智能·windows·python·ai·开源·github
kingbal13 天前
Windows:flutter环境搭建
windows·flutter
砍材农夫13 天前
python环境|conda安装和使用(1)
开发语言·后端·python·conda
未若君雅裁13 天前
Python 数据容器详解,list、tuple、str、set、dict 到底怎么选
windows·python·list
CodeKwang13 天前
Windows 环境 OCCT 8.0 编译构建及与 Qt6 项目集成
windows·qt·opencascade
我是伪码农13 天前
小兔鲜1-25
linux·服务器·windows