nicolargo/glances · error · Exception

Missing libs required to run Docker Extension (Containers)

Error message

Missing libs required to run Docker Extension (Containers) 

What it means

Raised in the Docker engine's __init__ when the module-level import check (disable_plugin_docker) reports that required libraries are missing. Glances' containers plugin guards optional dependencies this way and refuses to instantiate the Docker engine, raising a bare Exception carrying this message.

Source

Thrown at glances/plugins/containers/engines/docker.py:248

        old_io_stats = self._old_computed_stats.get("io")
        if old_io_stats:
            stats['time_since_update'] = round(self.time_since_update)
            stats['ior'] = stats['cumulative_ior'] - old_io_stats["cumulative_ior"]
            stats['iow'] = stats['cumulative_iow'] - old_io_stats["cumulative_iow"]

        # Return the stats
        return stats


class DockerExtension:
    """Glances' Containers Plugin's Docker Extension unit"""

    CONTAINER_ACTIVE_STATUS = ['running', 'healthy', 'paused']

    def __init__(self):
        self.disable = disable_plugin_docker
        if self.disable:
            raise Exception("Missing libs required to run Docker Extension (Containers) ")

        self.display_error = True

        self.client = None
        self.ext_name = "containers (Docker)"
        self.stats_fetchers = {}

        # Issue #3559: cache the (immutable) image tags per container id to avoid
        # one inspect_image API call per container on every refresh.
        self.image_cache = {}

        self.connect()

    def connect(self) -> None:
        """Connect to the Docker server."""
        # Init the Docker API Client
        try:
            # Do not use the timeout option (see issue #1878)

View on GitHub (pinned to a240d8dfb3)

Solutions

  1. Install the optional deps: pip install 'glances[docker]' (or pip install docker)
  2. Verify with python -c 'import docker' that nothing shadows it and it imports cleanly
  3. Check for a local file/dir named docker.py on sys.path shadowing the SDK
  4. If Docker monitoring is unwanted, disable the containers plugin instead of relying on the crash

Example fix

# before
$ pip install glances
# after
$ pip install 'glances[docker]'
Defensive patterns

Strategy: validation

Validate before calling

import importlib.util
if importlib.util.find_spec('docker') is None:
    raise SystemExit('install: pip install glances[docker]')

Type guard

def docker_engine_available() -> bool:
    import importlib.util
    return importlib.util.find_spec('docker') is not None

Try / catch

try:
    from glances.plugins.containers.engines.docker import DockerGlancesContainerExtension
    ext = DockerGlancesContainerExtension()
except Exception as e:
    if 'Missing libs' in str(e):
        ext = None  # docker monitoring disabled
    else:
        raise

Prevention

When it happens

Trigger: Instantiating glances.plugins.containers.engines.docker.DockerGlancesContainerExtension without the docker SDK (or its dependencies) importable, or when a previous import of 'docker' failed and set disable_plugin_docker=True.

Common situations: pip install glances without [docker] extras; restricted/embedded environments where the docker package fails to import; dependency downgrades that shadow the docker module.

Related errors


AI-assisted analysis of nicolargo/glances@a240d8dfb3 (2026-08-27). Data as JSON: /api/errors/0bcae20f48429ce3. Report an issue: GitHub.