参考官方文档:https://microsoft.github.io/graphrag/get_started/,本次在 Linux 环境下进行安装测试,环境说明:
# 系统
NAME="openEuler"
VERSION="22.03 (LTS-SP3)"
# conda 版本
conda 23.7.2
服务器上没有 GPU 导致创建索引的时候不是超时就是报错,配置信息反复修改多次才创建成功。
1.环境搭建
1.1 创建虚拟环境
官网的步骤是:create a project space and python virtual environment to install graphrag。
# 1.Create Project Space
mkdir graphrag_quickstart
cd graphrag_quickstart
python -m venv .venv
# 2.Activate Python Virtual Environment - Unix/MacOS
source .venv/bin/activate
# 3.Activate Python Virtual Environment - Windows
.venv\Scripts\activate
我使用的是 Anaconda,部署文件提示 GraphRAG requires Python 3.10 - 3.12。本次使用之前创建的虚拟环境 AutoGenStudio。
# 创建虚拟环境
conda create -n AutoGenStudio python=3.10
1.2 安装
python -m pip install graphrag
# 安装成功的版本 autograd 1.8.0 pypi_0 pypi
1.3 初始化
graphrag init
官网的说明信息已经过时了:
This will create two files,
.envandsettings.yaml, and a directoryinput, in the current directory.inputLocation of text files to process withgraphrag..envcontains the environment variables required to run the GraphRAG pipeline. If you inspect the file, you'll see a single environment variable defined,GRAPHRAG_API_KEY=<API_KEY>. Replace<API_KEY>with your own OpenAI or Azure API key.settings.yamlcontains the settings for the pipeline. You can modify this file to change the settings for the pipeline.

