Report #74052
[bug\_fix] RuntimeError: Cannot run event loop inside another loop in Jupyter Notebook
Apply \`nest\_asyncio.apply\(\)\` at the start of the notebook, or use \`await\` directly in notebook cells \(which IPython handles via autoawait\).
Journey Context:
Data scientist writes async code using \`await\` directly in Jupyter notebook cell. Gets RuntimeError. Tries to use \`asyncio.run\(\)\` in a cell, gets error that loop is already running \(since Jupyter runs on asyncio loop\). Tries to get loop with \`asyncio.get\_event\_loop\(\)\`, deprecated warnings. Searches reveals that IPython/Jupyter already has a running event loop to support async/await syntax at top level. The issue is trying to run blocking async code or nested loops. The fix is to use \`await\` directly \(which Jupyter supports via nest\_asyncio patch\), or if needing to run coroutine from sync context, use \`nest\_asyncio\` to allow nested loops, or use \`asyncio.run\` only in standalone scripts, not Jupyter.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T06:53:34.815776+00:00— report_created — created