microsoft/autogen · error · RuntimeError

Missing dependecies for DockerCommandLineCodeExecutor. Pleas

Error message

Missing dependecies for DockerCommandLineCodeExecutor. Please ensure the autogen-ext package was installed with the 'docker' extra.

What it means

Raised at import time of autogen_ext.code_executors.docker when the optional `docker` and `asyncio_atexit` dependencies are missing. The module cannot even be imported without them, so the error appears on `from ... import DockerCommandLineCodeExecutor`, before any code runs.

Source

Thrown at python/packages/autogen-ext/src/autogen_ext/code_executors/docker/_docker_code_executor.py:49

    CommandLineCodeResult,
    build_python_functions_file,
    get_file_name_from_content,
    lang_to_cmd,
    silence_pip,
)

if sys.version_info >= (3, 11):
    from typing import Self
else:
    from typing_extensions import Self

try:
    import asyncio_atexit
    import docker
    from docker.errors import DockerException, ImageNotFound, NotFound
    from docker.models.containers import Container
except ImportError as e:
    raise RuntimeError(
        "Missing dependecies for DockerCommandLineCodeExecutor. Please ensure the autogen-ext package was installed with the 'docker' extra."
    ) from e


async def _wait_for_ready(container: Any, timeout: int = 60, stop_time: float = 0.1) -> None:
    elapsed_time = 0.0
    while container.status != "running" and elapsed_time < timeout:
        await asyncio.sleep(stop_time)
        elapsed_time += stop_time
        await asyncio.to_thread(container.reload)
        continue
    if container.status != "running":
        raise ValueError("Container failed to start")


A = ParamSpec("A")

View on GitHub (pinned to 027ecf0a37)

Solutions

  1. Install the extra: pip install "autogen-ext[docker]"
  2. Add the extra to requirements.txt/pyproject: autogen-ext[docker]>=<version>
  3. Verify with: python -c "import docker, asyncio_atexit" and that the Docker CLI works
  4. Note the typo 'dependecies' in the message is upstream; match on the class name or 'docker' extra when grepping logs

Example fix

# before: pip install autogen-ext
# after:  pip install 'autogen-ext[docker]'
Defensive patterns

Strategy: validation

Validate before calling

# probe before importing the executor
def docker_extra_available() -> bool:
    try:
        import docker  # noqa
        import asyncio_atexit  # noqa
        return True
    except ImportError:
        return False

if not docker_extra_available():
    raise SystemExit("pip install 'autogen-ext[docker]' before using the Docker executor")

Type guard

null

Try / catch

try:
    from autogen_ext.code_executors.docker import DockerCommandLineCodeExecutor
except RuntimeError as e:
    if "docker" in str(e):
        subprocess.check_call([sys.executable, "-m", "pip", "install", "autogen-ext[docker]"])
        from autogen_ext.code_executors.docker import DockerCommandLineCodeExecutor

Prevention

When it happens

Trigger: Importing DockerCommandLineCodeExecutor (or the config/model modules that pull it in, e.g. via autogen-ext's code_executor backends) in an environment where `pip install autogen-ext` was done without the [docker] extra and the docker/asyncio_atexit packages are absent.

Common situations: Fresh environments where autogen-ext was installed plain or with a different extra (e.g. [websockets]); CI images that strip optional deps; installing from a requirements.txt that lists autogen-ext without extras.

Related errors


AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15). Data as JSON: /api/errors/b019943d9371a9bf. Report an issue: GitHub.