nest-asyncio
Patch asyncio to allow nested event loops
Decision gist · record as of 2026-08-14
Yes, if you need to run asyncio code in an already-active event loop and accept the maintenance risk. The package is lightweight, has no dependencies, and solves a real problem in Jupyter, web frameworks, and GUI contexts. However, the abandoned status means no future updates—verify compatibility with your Python version and monitor for asyncio changes in future releases. Not necessary if you control your event loop lifecycle or use async-first frameworks.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.5 or higher.
- Only patches asyncio event loops; third-party loop implementations (uvloop, quamash) cannot be patched.
- Low install friction with no runtime dependencies.
License · maintenance · safety
BSD (permissive) — BSD license is permissive; you can use this package freely in commercial and private projects with minimal restrictions.
last release 2024-01-21 (936 days) · last repo commit 2024-01-31 · 753 stars · archived
0 known vulnerabilities (OSV.dev, 2026-08-14) · 103,455,115 downloads/mo, #333 on PyPI
Alternatives
Verify before relying
pip install nest_asyncio
import nest_asyncio
nest_asyncio.apply()
# Now asyncio.run() works in an already-running event loop- Whether the abandoned status and lack of recent commits pose risks for Python 3.13+ compatibility or future asyncio changes.
- Whether the patch remains compatible with all current Python versions listed in classifiers without regression.
What it is and what it does
nest_asyncio solves a fundamental asyncio limitation: by default, Python's asyncio forbids nested event loops, raising "RuntimeError: This event loop is already running" when you try to call asyncio.run() or loop.run_until_complete() from within an already-running loop. This is a practical problem in Jupyter notebooks, web frameworks, and GUI applications where the event loop is already active. The package patches asyncio to allow this nesting by applying a simple fix via nest_asyncio.apply().
The package has no runtime dependencies and installs cleanly. It supports Python 3.5 through 3.12 and is marked Production/Stable. However, the repository is archived and abandoned as of 2024-01-21, with no maintenance activity since. While the patch is narrow and unlikely to break, you should be aware that future Python or asyncio changes will not receive updates from the maintainer.
Use it for
- Running async code in Jupyter notebooks where the kernel already has an event loop active.
- Calling async functions from synchronous code in web frameworks like Flask or FastAPI during development or testing.
- Executing asyncio tasks in GUI applications (PyQt, Tkinter) that manage their own event loops.
- Testing async code that needs to call asyncio.run() from within test fixtures or runners.
- Prototyping async code interactively in environments with pre-existing event loops.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to run asyncio code in an already-active event loop and accept the maintenance risk.
The package is lightweight, has no dependencies, and solves a real problem in Jupyter, web frameworks, and GUI contexts. However, the abandoned status means no future updates—verify compatibility with your Python version and monitor for asyncio changes in future releases. Not necessary if you control your event loop lifecycle or use async-first frameworks.
Install
nest-asyncio on PyPI
Before you install
Low install friction with no runtime dependencies. Repository is archived and maintenance is abandoned; last release was 2024-01-21 with no activity since. The package is stable and widely used (top 1000 PyPI), but expect no future updates or security patches.
Requires Python 3.5 or higher. Only patches asyncio event loops; third-party loop implementations (uvloop, quamash) cannot be patched.
License in practice
BSD license is permissive; you can use this package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install nest_asyncio
import nest_asyncio
nest_asyncio.apply()
# Now asyncio.run() works in an already-running event loop
Verify before relying
- Whether the abandoned status and lack of recent commits pose risks for Python 3.13+ compatibility or future asyncio changes.
- Whether the patch remains compatible with all current Python versions listed in classifiers without regression.
Package facts
| License | BSD permissive |
| Python support | Supports the current Python release >=3.5 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Abandoned 936 days since the last release |
| Last repo commit | repository archived |
| First released | |
| Downloads | 103,455,115 / month, #333 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableFramework :: AsyncIOIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9 |
Evidence: nest_asyncio-1.6.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “nested asyncio event loops”
- nest-asyncioPatches asyncio to allow nested event loops, enabling asyncio.run()…
- nest-asyncio2Patches asyncio to allow nested event loops, enabling `asyncio.run()`…
- txaiotxaio provides a compatibility layer that lets you write async code…
Give your agent the search over MCP, or paste the wish link into any chat.
Similar packages
qasync integrates asyncio coroutines into PyQt/PySide applications by providing a PEP 3156 event loop, allowing async/await syntax directly in Qt's main thread without threading.
Install it if you're building a PyQt/PySide application and want to use async/await instead of threading.
uvloop is a drop-in replacement for Python's built-in asyncio event loop, implemented in Cython and using libuv, that accelerates async I/O operations.
Winloop is a Windows-compatible alternative to uvloop that replaces the standard asyncio event loop with a faster, libuv-based implementation optimized for Windows.
Decorator-based library that runs async functions in an ambient event loop and regular functions in thread or process pools, returning awaitable futures that combine asyncio and concurrent.futures semantics.
However, dormancy since 2021-10-21 and unspecified Python version support mean you should verify compatibility with your target Python version before committing.
Provides asyncio-compatible wrappers around multiprocessing objects (Queue, Lock, Process, Pool, etc.) so their blocking methods can be awaited in async code without freezing the event loop.
Provides the Python 3.11 asyncio.Runner context manager for Python 3.8, 3.9, and 3.10, enabling simplified management of event loop lifecycle across multiple async function calls.
See also nest-asyncio2 · aiomultiprocess · aiocop · aiofastnet