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_246646192 小时前
openclaw快速安装-windows版
windows·stm32·单片机
sonrisa_2 小时前
Python同一类不同方法中变量值的传递
开发语言·windows·python
玖釉-3 小时前
探索连续细节层次(Continuous LOD):深入解析 NVIDIA 的 nv_cluster_lod_builder
c++·windows·图形渲染
MyY_DO3 小时前
第九课ida与花指令
windows·od
多多*4 小时前
Mysql数据库相关 事务 MVCC与锁的爱恨情仇 锁的层次架构 InnoDB锁分析
java·数据库·windows·sql·oracle·面试·哈希算法
LateFrames4 小时前
“蚯蚓涌动” 的屏保: DirectX 12 + ComputeSharp + Win32
windows·ui·gpu算力
最懒的菜鸟5 小时前
Windows系统安装Hyperf 3.X完整版
windows
玖釉-6 小时前
核心解构:Cluster LOD 与 DAG 架构深度剖析
c++·windows·架构·图形渲染
水饺编程7 小时前
第4章,[标签 Win32] :文本尺寸的度量
c语言·c++·windows·visual studio
h7ml7 小时前
于 CompletableFuture 的异步编排优化企业微信通知发送性能
android·windows·企业微信