Install & Compatibility
Where this runs
tested against v0.13.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.240s · 18MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 1.7s · import 0.200s · 19MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
iter
✓ from aioitertools import iter
✗ from aioitertools.builtins import iter
Aioitertools shadows standard library builtins directly at the top level for convenience.
map
✓ from aioitertools import map
✗ from aioitertools.builtins import map
Aioitertools shadows standard library builtins directly at the top level for convenience.
chain
✓ from aioitertools import chain
✗ from aioitertools.itertools import chain
Aioitertools shadows standard library itertools directly at the top level for convenience.
as_completed
✓ from aioitertools.asyncio import as_completed
✗ from aioitertools import as_completed
Asynchronous specific utilities are found under the `aioitertools.asyncio` submodule.
This quickstart demonstrates how to use `aioitertools.iter` to get an async iterator from both synchronous and asynchronous iterables, `aioitertools.next` to retrieve the next item, and `aioitertools.map` to apply an asynchronous function concurrently over an iterable.
import asyncio
from aioitertools import iter, next, map
async def async_generator():
for i in range(3):
yield i
await asyncio.sleep(0.01)
async def process_item(item):
# Simulate an async operation
await asyncio.sleep(0.005)
return item * 2
async def main():
# Using aioitertools.iter with a standard iterable
it_sync = iter([1, 2, 3])
first_item = await next(it_sync)
print(f"First item from sync: {first_item}")
# Using aioitertools.iter with an async iterable
it_async = iter(async_generator())
print("Items from async generator:")
async for item in it_async:
print(f" {item}")
# Using aioitertools.map for concurrent async operations
urls = ["url1", "url2", "url3"]
async def fetch_url(url):
# Replace with actual async HTTP request
await asyncio.sleep(0.01)
return f"Processed {url}"
print("\nMapping async functions:")
async for result in map(fetch_url, urls):
print(f" {result}")
if __name__ == "__main__":
asyncio.run(main())
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'aioitertools'
The 'aioitertools' package is not installed in the Python environment.
fixInstall the package using pip: 'pip install aioitertools'.
ImportError: cannot import name 'iter' from 'aioitertools'
The 'iter' function is not available in the 'aioitertools' module.
fixUse the standard 'iter' function from Python's built-in library instead.
TypeError: 'async for' requires an object with an __aiter__ method, got 'list'
Attempting to use 'async for' on a standard list, which is not an asynchronous iterable.
fixConvert the list to an asynchronous iterable using 'aioitertools.iter()' before iterating.
TypeError: 'async_generator' object is not callable
You are attempting to call an aioitertools asynchronous generator function as if it were a regular synchronous function, or trying to retrieve a single item from an async iterator without using 'await'.
fixEnsure you use 'await' when retrieving single items from async iterators (e.g., `await ait.next(it)`) and ensure the function itself is awaited if it returns a single awaitable result. If it's an async generator, use 'async for' to iterate over it.
TypeError: 'async_generator' object is not iterable
You are trying to iterate over an asynchronous generator returned by an aioitertools function using a standard (synchronous) 'for' loop, instead of an 'async for' loop.
fixUse 'async for' to iterate over the asynchronous generator within an 'async def' function. For example, `async for item in ait.map(func, data):`.
Upgrade
Version history
0.13.0latest on PyPI · released Nov 6, 2025
Audit
Dependencies
No dependency data recorded yet.