pypa/pip · error · RuntimeError

Keyring util is outdated; must be at least version 25.2.1, p

Error message

Keyring util is outdated; must be at least version 25.2.1, please upgrade it

What it means

Error "Keyring util is outdated; must be at least version 25.2.1, please upgrade it" thrown in pypa/pip.

Source

Thrown at src/pip/_internal/network/auth.py:154

        env = os.environ.copy()
        env["PYTHONIOENCODING"] = "utf-8"
        res = subprocess.run(  # noqa: UP022
            cmd,
            stdin=subprocess.DEVNULL,
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            env=env,
        )

        # Detect if the user is running an outdated version of keyring without support
        # for querying credentials without username
        errs = res.stderr.decode("utf-8")
        if (
            res.returncode == 2
            and "unrecognized arguments" in errs
            and "--mode=creds" in errs
        ):
            raise RuntimeError(
                "Keyring util is outdated; must be at least version 25.2.1, "
                "please upgrade it"
            )

        if res.returncode:
            return None

        data = json.loads(res.stdout.decode("utf-8"))
        return (data["username"], data["password"])

    def _set_password(self, service_name: str, username: str, password: str) -> None:
        """Mirror the implementation of keyring.set_password using cli"""
        if self.keyring is None:
            return None
        env = os.environ.copy()
        env["PYTHONIOENCODING"] = "utf-8"
        subprocess.run(
            [self.keyring, "set", service_name, username],

View on GitHub (pinned to d7d0d0a394)

When it happens

Trigger: Thrown at src/pip/_internal/network/auth.py:154 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of pypa/pip@d7d0d0a394 (2026-08-04). Data as JSON: /data/errors/0788389da16e8e24.json. Report an issue: GitHub.