{"record":{"id":"2c7985fbce3fb73f","repo":"python/cpython","slug":"windows-10-th2-or-later-required","errorCode":null,"errorMessage":"Windows 10 TH2 or later required","messagePattern":"Windows 10 TH2 or later required","errorType":"console","errorClass":"RuntimeError","httpStatus":null,"severity":"warning","filePath":"Lib/_pyrepl/main.py","lineNumber":11,"sourceCode":"import errno\nimport os\nimport sys\nimport types\n\n\nCAN_USE_PYREPL: bool\nFAIL_REASON: str\ntry:\n    if sys.platform == \"win32\" and sys.getwindowsversion().build < 10586:\n        raise RuntimeError(\"Windows 10 TH2 or later required\")\n    if not os.isatty(sys.stdin.fileno()):\n        raise OSError(errno.ENOTTY, \"tty required\", \"stdin\")\n    from .simple_interact import check\n    if err := check():\n        raise RuntimeError(err)\nexcept Exception as e:\n    CAN_USE_PYREPL = False\n    FAIL_REASON = f\"warning: can't use pyrepl: {e}\"\nelse:\n    CAN_USE_PYREPL = True\n    FAIL_REASON = \"\"\n\n\ndef interactive_console(mainmodule=None, quiet=False, pythonstartup=False):\n    if not CAN_USE_PYREPL:\n        if not os.getenv('PYTHON_BASIC_REPL') and FAIL_REASON:\n            from .trace import trace\n            trace(FAIL_REASON)","sourceCodeStart":1,"sourceCodeEnd":29,"githubUrl":"https://github.com/python/cpython/blob/bc6749cc3b5ae4a5e88a6cc2d5b3bebbe354eae6/Lib/_pyrepl/main.py#L1-L29","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["No code fix is needed; this is informational. Upgrade to Windows 10 TH2 (build 10586) or newer to get the new REPL.","Suppress the warning by setting PYTHON_BASIC_REPL=1 so the classic REPL is selected without the check message.","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."],"exampleFix":"# before: python  (prints \"warning: can't use pyrepl: Windows 10 TH2 or later required\")\n\n# after\n# shell:\n#   set PYTHON_BASIC_REPL=1\n#   python","handlingStrategy":"validation","validationCode":"import sys\ndef pyrepl_supported():\n    if sys.platform == 'win32':\n        return sys.getwindowsversion().build >= 10586\n    return True","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check sys.getwindowsversion().build >= 10586 before enabling pyrepl-dependent tooling on Windows.","Set PYTHON_BASIC_REPL=1 in batch/CI environments to bypass the check deterministically.","Treat this as an informational fallback; never parse the startup warning as an error."],"tags":["python","repl","pyrepl","windows","platform","startup"],"backgroundTag":null,"analyzedSha":"bc6749cc3b5ae4a5e88a6cc2d5b3bebbe354eae6","analyzedAt":"2026-08-14T22:01:13.976Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}