{"record":{"id":"fd0787eb73112e6e","repo":"nicolargo/glances","slug":"missing-libs-required-to-run-lxd-extension-contai","errorCode":null,"errorMessage":"Missing libs required to run LXD Extension (Containers)","messagePattern":"Missing libs required to run LXD Extension \\(Containers\\)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"glances/plugins/containers/engines/lxd.py","lineNumber":202,"sourceCode":"                old_net = self._old_computed_stats.get(\"network\", {})\n                if \"cumulative_rx\" in old_net:\n                    stats[\"time_since_update\"] = round(self.time_since_update)\n                    stats[\"rx\"] = max(0, cumulative_rx - old_net[\"cumulative_rx\"])\n                    stats[\"tx\"] = max(0, cumulative_tx - old_net[\"cumulative_tx\"])\n        except (KeyError, TypeError) as e:\n            logger.debug(f\"containers (LXD) Instance({self._instance.name}): Can't grab NET stats ({e})\")\n        return stats\n\n\nclass LxdExtension:\n    \"\"\"Glances' Containers Plugin's LXD Extension unit\"\"\"\n\n    CONTAINER_ACTIVE_STATUS = ['Running']\n\n    def __init__(self, endpoint=None, poll_interval=2):\n        self.disable = disable_plugin_lxd\n        if self.disable:\n            raise Exception(\"Missing libs required to run LXD Extension (Containers)\")\n\n        self.display_error = True\n        self.client = None\n        self.ext_name = \"containers (LXD)\"\n        self.endpoint = endpoint\n        self.poll_interval = poll_interval\n        self.stats_fetchers = {}\n        self.local_node = None\n\n        self.connect()\n\n    def connect(self) -> None:\n        \"\"\"Connect to the LXD server.\"\"\"\n        try:\n            if self.endpoint:\n                self.client = LxdClient(endpoint=self.endpoint)\n            else:\n                self.client = LxdClient()","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/nicolargo/glances/blob/a240d8dfb3105a38b5964357ec21768594b0e83e/glances/plugins/containers/engines/lxd.py#L184-L220","documentation":"Raised in the LXD engine's __init__ when disable_plugin_lxd indicates the LXD client libraries could not be imported. Like the other container engines, LXD support is optional and the engine refuses construction with a plain Exception when its imports failed at module load time.","triggerScenarios":"Constructing LxdGlancesContainerExtension (directly or via the containers plugin) without the LXD client package installed/importable, or on platforms where the import raises (e.g. missing OpenSSL bindings used by the LXD client).","commonSituations":"Base glances install without LXD extras; minimal containers/alpine images lacking crypto libs the LXD SDK needs; stale virtualenvs after a package removal.","solutions":["Install the LXD extra: pip install 'glances[lxd]' or the required lxd client package","Run python -c 'import glances.plugins.containers.engines.lxd' to see the underlying ImportError","On slim images, install the OpenSSL/libssl packages the LXD client links against","Disable the LXD engine in config if it is not needed"],"exampleFix":"# before\n$ pip install glances\n# after\n$ pip install 'glances[lxd]'","handlingStrategy":"validation","validationCode":"import importlib.util\nif importlib.util.find_spec('glances.plugins.containers.engines.lxd') is None:\n    # check underlying client lib presence before use\n    raise SystemExit('LXD engine unavailable')","typeGuard":"def lxd_engine_available() -> bool:\n    try:\n        import glances.plugins.containers.engines.lxd as m  # noqa\n        return not m.disable_plugin_lxd\n    except Exception:\n        return False","tryCatchPattern":"try:\n    engine = LxdGlancesContainerExtension(endpoint=...)\nexcept Exception as e:\n    if 'Missing libs' in str(e):\n        engine = None\n    else:\n        raise","preventionTips":["pip install 'glances[lxd]'","On slim images ensure OpenSSL libs are present","Disable the LXD engine in config when unused"],"tags":["glances","lxd","containers","missing-dependency","import-error"],"backgroundTag":"missing-dependency","analyzedSha":"a240d8dfb3105a38b5964357ec21768594b0e83e","analyzedAt":"2026-08-27T19:15:19.178Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}