microsoft / graphrag

A modular graph-based Retrieval-Augmented Generation (RAG) system
https://microsoft.github.io/graphrag/
MIT License
20.17k stars 1.97k forks source link

How to use the index_cli in pycharm #484

Closed lishaozheng closed 3 months ago

lishaozheng commented 4 months ago

Describe the issue

raise ImportError(

ImportError: Unable to import required dependencies: numpy: cannot import name 'NamedTuple' from partially initialized module 'typing' (most likely due to a circular import) (G:\LiProbject\project\graphrag\graphrag\index\typing.py)

Steps to reproduce

Copyright (c) 2024 Microsoft Corporation.

Licensed under the MIT License

"""The Indexing Engine package root."""

import argparse

from graphrag.index.cli import index_cli

from .cli import index_cli

if name == "main": parser = argparse.ArgumentParser()

Add the same arguments as shown in your provided code snippet

args = parser.parse_args([
    "--root", "./ragtest",
    # Add other arguments as needed
])

index_cli(
    root=args.root,
    verbose=args.verbose or False,
    resume=args.resume,
    memprofile=args.memprofile or False,
    nocache=args.nocache or False,
    reporter=args.reporter,
    config=args.config,
    emit=args.emit,
    dryrun=args.dryrun or False,
    init=args.init or False,
    overlay_defaults=args.overlay_defaults or False,
    cli=True,
)

GraphRAG Config Used

No response

Logs and screenshots

Traceback (most recent call last): File "G:\LiProbject\project\graphrag\graphrag\index__main__.py", line 8, in from graphrag.index.cli import index_cli File "G:\LiProbject\project\graphrag\graphrag\index__init.py", line 6, in from .cache import PipelineCache File "G:\LiProbject\project\graphrag\graphrag\index\cache\init.py", line 6, in from .json_pipeline_cache import JsonPipelineCache File "G:\LiProbject\project\graphrag\graphrag\index\cache\json_pipeline_cache.py", line 7, in from typing import Any File "G:\LiProbject\project\graphrag\graphrag\index\typing.py", line 9, in import pandas as pd File "I:\ProgramData\anaconda3\envs\grag\lib\site-packages\pandas\init__.py", line 32, in raise ImportError( ImportError: Unable to import required dependencies: numpy: cannot import name 'NamedTuple' from partially initialized module 'typing' (most likely due to a circular import) (G:\LiProbject\project\graphrag\graphrag\index\typing.py)

Additional Information

l0he1g commented 4 months ago

Unmark the graph/index directory as sources root. The typing.py is confict with the python built in typing module.

github-actions[bot] commented 4 months ago

This issue has been marked stale due to inactivity after repo maintainer or community member responses that request more information or suggest a solution. It will be closed after five additional days.

github-actions[bot] commented 3 months ago

This issue has been closed after being marked as stale for five days. Please reopen if needed.