{"record":{"id":"ea97119e481a2eb9","repo":"pola-rs/polars","slug":"could-not-find-polars-rust-module-skipped-versions-version","errorCode":null,"errorMessage":"could not find Polars' Rust module. Skipped versions {version_warnings} which don't match Python package version","messagePattern":"could not find Polars' Rust module\\. Skipped versions (.+?) which don't match Python package version","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"critical","filePath":"py-polars/src/polars/_plr.py","lineNumber":98,"sourceCode":"                if sys.modules[__name__].__version__ != PKG_VERSION:\n                    import warnings\n\n                    version_warnings += [sys.modules[__name__].__version__]\n                    warnings.warn(\n                        f\"Skipping Polars' Rust module version '{sys.modules[__name__].__version__}' did not match version of Python package '{PKG_VERSION}'.\",\n                        ImportWarning,\n                        stacklevel=2,\n                    )\n                    continue\n\n                break\n            except ImportError:\n                pass\n        else:\n            msg = \"could not find Polars' Rust module\"\n            if len(version_warnings) > 0:\n                msg += f\". Skipped versions {version_warnings} which don't match Python package version\"\n            raise ImportError(msg)\n\n\n# The version at the top here should match the version specified by the PLR.\nassert sys.modules[__name__].__version__ == PKG_VERSION\n","sourceCodeStart":80,"sourceCodeEnd":103,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/py-polars/src/polars/_plr.py#L80-L103","documentation":"Polars tried every Rust extension package in its preference order and none could be imported. Each candidate whose version did not match the Python package version was recorded in version_warnings and skipped; if no import succeeded, ImportError is raised, appending the skipped versions when any exist.","triggerScenarios":"Importing polars when: no Rust wheel matching the Python package version is installed (e.g. only polars-lts-cpu present at a different version); all candidates were skipped due to version mismatch; or the compiled module is unusable on the platform.","commonSituations":"Broken upgrades where Python polars is new but companion wheels are old; unsupported/odd platforms where only mismatched wheels resolved; corrupted site-packages after interrupted installs.","solutions":["Reinstall the whole Polars set at one version: `pip install --force-reinstall -U polars` (plus any -lts-cpu/-u64-idx variant you use)","Ensure exactly the compatible wheel variant for your platform is installed and version-matched","Check for shadowing: run `pip show polars` and confirm the import path points at your intended site-packages","If a custom variant is required, set POLARS_FORCE_PKG to a valid name and match its version to polars"],"exampleFix":"// before\nimport polars as pl  # ImportError: could not find Polars' Rust module. Skipped versions [...] \n// after\n$ pip install --force-reinstall -U polars polars-lts-cpu\nimport polars as pl  # works","handlingStrategy":"try-catch","validationCode":"import importlib.metadata as md\nvers = {p: md.version(p) for p in md.packages_distributions().get('polars', [])}\nassert len(set(vers.values())) == 1, f'mismatched polars installs: {vers}'","typeGuard":null,"tryCatchPattern":"try:\n    import polars as pl\nexcept ImportError as e:\n    raise RuntimeError('Reinstall polars: pip install --force-reinstall -U polars') from e","preventionTips":["Install polars and all variants together in one pip/uv command","Never mix polars versions within one environment (check with pip list)","Rebuild images from lockfiles after upgrades; avoid partial installs","Test `import polars` as a smoke test in CI before heavier jobs"],"tags":["python","installation","version-conflict","import-error"],"backgroundTag":"module-init-failed","analyzedSha":"fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e","analyzedAt":"2026-09-18T22:14:11.667Z","contentChangedAt":"2026-09-18T22:14:11.667Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}