Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: asyncio.run() cannot be called from a running event loop #1377

Open
3 tasks
bhupender101 opened this issue Nov 7, 2024 · 1 comment
Open
3 tasks
Labels
bug Something isn't working triage Default label assignment, indicates new issue needs reviewed by a maintainer

Comments

@bhupender101
Copy link

Do you need to file an issue?

  • I have searched the existing issues and this bug is not already filed.
  • My model is hosted on OpenAI or Azure. If not, please look at the "model providers" issue and don't file a new one here.
  • I believe this is a legitimate bug, not just a question. If this is a question, please use the Discussions area.

Describe the bug

Cell In[11], line 1 ----> 1 search_engine.search(query="whatr is thre summary of the Document") File ~/miniconda3/envs/graphrag/lib/python3.10/site-packages/graphrag/query/structured_search/global_search/search.py:195, in GlobalSearch.search(self, query, conversation_history, kwargs) 188 def search( 189 self, 190 query: str, 191 conversation_history: ConversationHistory | None = None, 192 kwargs: Any, 193 ) -> GlobalSearchResult: 194 """Perform a global search synchronously.""" --> 195 return asyncio.run(self.asearch(query, conversation_history)) File ~/miniconda3/envs/graphrag/lib/python3.10/asyncio/runners.py:33, in run(main, debug) 9 """Execute the coroutine and return the result. 10 11 This function runs the passed coroutine, taking care of (...) 30 asyncio.run(main()) 31 """ 32 if events._get_running_loop() is not None: ---> 33 raise RuntimeError( 34 "asyncio.run() cannot be called from a running event loop") 36 if not coroutines.iscoroutine(main): 37 raise ValueError("a coroutine was expected, got {!r}".format(main)) RuntimeError: asyncio.run() cannot be called from a running event loop

Steps to reproduce

i am getting error in the Starter Code OF the Graph Rag

Expected Behavior

No response

GraphRAG Config Used

# Paste your config here

Logs and screenshots

No response

Additional Information

  • GraphRAG Version:
  • Operating System:
  • Python Version:
  • Related Issues:
@bhupender101 bhupender101 added bug Something isn't working triage Default label assignment, indicates new issue needs reviewed by a maintainer labels Nov 7, 2024
@bhupender101 bhupender101 changed the title [Bug]: <title> RuntimeError: asyncio.run() cannot be called from a running event loop Nov 7, 2024
@JordiPG05
Copy link

JordiPG05 commented Nov 11, 2024

I give more information on where the problem lies:
/home/.local/lib/python3.11/site-packages/graphrag/cli/main.py:117 in
│ _index_cli

│ 114 │ ] = None,
│ 115 ):
│ 116 │ """Build a knowledge graph index."""
│ ❱ 117 │ index_cli(
│ 118 │ │ root_dir=root,
│ 119 │ │ verbose=verbose,
│ 120 │ │ resume=resume,

/home/.local/lib/python3.11/site-packages/graphrag/cli/index.py:120 in
│ index_cli

│ 117 │
│ 118 │ _register_signal_handlers(progress_reporter)
│ 119 │
│ ❱ 120 │ outputs = asyncio.run(
│ 121 │ │ api.build_index(
│ 122 │ │ │ config=config,
│ 123 │ │ │ run_id=run_id,

/usr/local/lib/python3.11/asyncio/runners.py:190 in run

│ 187 │ │ │ "asyncio.run() cannot be called from a running event loop"
│ 188 │
│ 189 │ with Runner(debug=debug) as runner:
│ ❱ 190 │ │ return runner.run(main)
│ 191
│ 192
│ 193 def _cancel_all_tasks(loop):

│ /usr/local/lib/python3.11/asyncio/runners.py:118 in run

│ 115 │ │
│ 116 │ │ self._interrupt_count = 0
│ 117 │ │ try:
│ ❱ 118 │ │ │ return self._loop.run_until_complete(task)
│ 119 │ │ except exceptions.CancelledError:
│ 120 │ │ │ if self._interrupt_count > 0:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage Default label assignment, indicates new issue needs reviewed by a maintainer
Projects
None yet
Development

No branches or pull requests

2 participants