python/cpython · warning · RuntimeError

Windows 10 TH2 or later required

Error message

Windows 10 TH2 or later required

What it means

RuntimeError raised at import time of _pyrepl.main when running on Windows with a build number below 10586 (anything older than Windows 10 TH2). It is raised inside a try block and immediately caught, so it never propagates to user code; it only sets CAN_USE_PYREPL = False and FAIL_REASON to a warning string, causing Python to fall back to the classic non-pyrepl interactive console.

Source

Thrown at Lib/_pyrepl/main.py:11

import errno
import os
import sys
import types


CAN_USE_PYREPL: bool
FAIL_REASON: str
try:
    if sys.platform == "win32" and sys.getwindowsversion().build < 10586:
        raise RuntimeError("Windows 10 TH2 or later required")
    if not os.isatty(sys.stdin.fileno()):
        raise OSError(errno.ENOTTY, "tty required", "stdin")
    from .simple_interact import check
    if err := check():
        raise RuntimeError(err)
except Exception as e:
    CAN_USE_PYREPL = False
    FAIL_REASON = f"warning: can't use pyrepl: {e}"
else:
    CAN_USE_PYREPL = True
    FAIL_REASON = ""


def interactive_console(mainmodule=None, quiet=False, pythonstartup=False):
    if not CAN_USE_PYREPL:
        if not os.getenv('PYTHON_BASIC_REPL') and FAIL_REASON:
            from .trace import trace
            trace(FAIL_REASON)

View on GitHub (pinned to bc6749cc3b)

Solutions

  1. No code fix is needed; this is informational. Upgrade to Windows 10 TH2 (build 10586) or newer to get the new REPL.
  2. Suppress the warning by setting PYTHON_BASIC_REPL=1 so the classic REPL is selected without the check message.
  3. If you must stay on old Windows and the message is noisy, invoke python with -X utf8 unrelated flags will not help; use PYTHON_BASIC_REPL=1 or python -i with the basic console.

Example fix

# before: python  (prints "warning: can't use pyrepl: Windows 10 TH2 or later required")

# after
# shell:
#   set PYTHON_BASIC_REPL=1
#   python
Defensive patterns

Strategy: validation

Validate before calling

import sys
def pyrepl_supported():
    if sys.platform == 'win32':
        return sys.getwindowsversion().build >= 10586
    return True

Prevention

When it happens

Trigger: Starting the interactive REPL (python with no args) on Windows 8/8.1, Windows Server 2012, or early Windows 10 builds where sys.getwindowsversion().build < 10586, or on Wine/compatibility layers reporting old builds.

Common situations: CI containers or remote desktop sessions on legacy Windows VMs; users on Windows Server 2012/2012 R2; compat layers (Wine, Windows containers) reporting stale build numbers. Symptom is only the startup message: warning: can't use pyrepl: Windows 10 TH2 or later required.

Related errors


AI-assisted analysis of python/cpython@bc6749cc3b (2026-08-14). Data as JSON: /api/errors/2c7985fbce3fb73f. Report an issue: GitHub.