{"record":{"id":"4480fd69b0155392","repo":"pola-rs/polars","slug":"pfx-name-requires-module-name-module-to-be","errorCode":null,"errorMessage":"{pfx}{name} requires '{module_name}' module to be installed","messagePattern":"(.+?)(.+?) requires '(.+?)' module to be installed","errorType":"exception","errorClass":"ModuleNotFoundError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/_dependencies.py","lineNumber":104,"sourceCode":"\n        # accessing the proxy module's attributes triggers import of the real thing\n        if self._module_available:\n            # import the module and return the requested attribute\n            module = self._import()\n            return getattr(module, name)\n\n        # user has not installed the proxied/lazy module\n        elif name == \"__name__\":\n            return self._module_name\n        elif re.match(r\"^__\\w+__$\", name) and name != \"__version__\":\n            # allow some minimal introspection on private module\n            # attrs to avoid unnecessary error-handling elsewhere\n            return None\n        else:\n            # all other attribute access raises a helpful exception\n            pfx = self._mod_pfx.get(self._module_name, \"\")\n            msg = f\"{pfx}{name} requires {self._module_name!r} module to be installed\"\n            raise ModuleNotFoundError(msg) from None\n\n\ndef _lazy_import(module_name: str) -> tuple[ModuleType, bool]:\n    \"\"\"\n    Lazy import the given module; avoids up-front import costs.\n\n    Parameters\n    ----------\n    module_name : str\n        name of the module to import, eg: \"pyarrow\".\n\n    Notes\n    -----\n    If the requested module is not available (eg: has not been installed), a proxy\n    module is created in its place, which raises an exception on any attribute\n    access. This allows for import and use as normal, without requiring explicit\n    guard conditions - if the module is never used, no exception occurs; if it\n    is, then a helpful exception is raised.","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/pola-rs/polars/blob/9b5d73fd00236295624374b075d16b1fe6ec6df9/py-polars/src/polars/_dependencies.py#L86-L122","documentation":"ImportError raised by a lazy module proxy (__getattr__ on the proxy class) in _dependencies.py: user code accessed attribute {name} of an optional dependency (e.g. polars.delimited, polars.string_cache) whose backing module {module_name} is not installed. Accessing any real attribute triggers the import; only dunder introspection attributes are allowed through.","triggerScenarios":"Calling a function guarded by an optional dependency that is not installed.","commonSituations":"See trigger scenarios.","solutions":["Install the missing module: pip install <module_name> (or the extra, e.g. pip install 'polars[extra]')."],"exampleFix":"pip install pandas pyarrow","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9b5d73fd00236295624374b075d16b1fe6ec6df9","analyzedAt":"2026-08-19T12:15:06.350Z","contentChangedAt":"2026-08-19T12:15:06.350Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}