{"record":{"id":"d89d947706168166","repo":"pola-rs/polars","slug":"polars-rust-module-for-force-version-did","errorCode":null,"errorMessage":"Polars Rust module for '{_force}' ({version}) did not match version of Python package '{PKG_VERSION}'","messagePattern":"Polars Rust module for '(.+?)' \\((.+?)\\) did not match version of Python package '(.+?)'","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/_plr.py","lineNumber":62,"sourceCode":"if hasattr(builtins, \"__POLARS_PLR\"):\n    sys.modules[__name__] = builtins.__POLARS_PLR\nelse:\n    # Each of the Polars variants registers a `_polars...` package that we can import\n    # the PLR from.\n\n    _force = os.environ.get(\"POLARS_FORCE_PKG\")\n    _prefer = os.environ.get(\"POLARS_PREFER_PKG\")\n\n    pkgs = {\"compat\": rt_compat, \"64\": rt_64, \"32\": rt_32}\n    default_prefer = [rt_compat, rt_64, rt_32]\n\n    if _force is not None:\n        try:\n            pkgs[_force]()\n\n            if sys.modules[__name__].__version__ != PKG_VERSION:\n                msg = f\"Polars Rust module for '{_force}' ({sys.modules[__name__].__version__}) did not match version of Python package '{PKG_VERSION}'\"\n                raise ImportError(msg)\n        except KeyError:\n            msg = f\"Invalid value for `POLARS_FORCE_PKG` variable: '{_force}'\"\n            raise ValueError(msg) from None\n    else:\n        preference = default_prefer\n        if _prefer is not None:\n            try:\n                preference.insert(0, pkgs[_prefer])\n            except KeyError:\n                msg = f\"Invalid value for `POLARS_PREFER_PKG` variable: '{_prefer}'\"\n                raise ValueError(msg) from None\n\n        version_warnings = []\n        for pkg in preference:\n            try:\n                pkg()\n\n                if sys.modules[__name__].__version__ != PKG_VERSION:","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/pola-rs/polars/blob/5d8ebabf11caea54a5c29178a64a058762f49766/py-polars/src/polars/_plr.py#L44-L80","documentation":"Version-consistency check when POLARS_FORCE_PKG pins a specific Polars binary variant: the forced Rust module (compat/64/32) loaded successfully but its __version__ differs from the Python package's PKG_VERSION, meaning mismatched polars and polars-*-variants installs. Reinstalling matching versions fixes it.","triggerScenarios":"The loaded Polars Rust module version differs from the Python package version.","commonSituations":"See trigger scenarios.","solutions":["Reinstall polars so the Rust module matches the Python package version: pip install -U --force-reinstall polars. Avoid mixing polars and polars-runtime-32 builds."],"exampleFix":"pip install -U --force-reinstall polars","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5d8ebabf11caea54a5c29178a64a058762f49766","analyzedAt":"2026-08-19T12:15:06.350Z","contentChangedAt":"2026-08-19T12:15:06.350Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}