Windows: Python available in interactive PowerShell but unavailable during Codex task execution
What version of Codex CLI is running?
0.146.0
What subscription do you have?
ChatGPT Plus
Which model were you using?
GPT-5.4 (Codex CLI)
What platform is your computer?
Windows 11 Professional Version 10.0.26200 64-bit
What terminal emulator and version are you using (if applicable)?
Windows Terminal running Windows PowerShell 5.1. Codex CLI launched directly from PowerShell. No VS Code. No WSL.
Codex doctor report
PS C:\Users\jeff_> codex doctor --json
{
"schemaVersion": 1,
"generatedAt": "1785344236s since unix epoch",
"overallStatus": "ok",
"codexVersion": "0.146.0",
"checks": {
"app_server.status": {
"id": "app_server.status",
"category": "app-server",
"status": "ok",
"summary": "background server is not running",
"details": {
"control socket": "C:\\Users\\jeff_\\.codex\\app-server-control\\app-server-control.sock",
"daemon state dir": "C:\\Users\\jeff_\\.codex\\app-server-daemon",
"mode": "ephemeral",
"pid file": "C:\\Users\\jeff_\\.codex\\app-server-daemon\\app-server.pid (missing)",
"settings": "C:\\Users\\jeff_\\.codex\\app-server-daemon\\settings.json (missing)",
"status": "not running",
"update-loop pid file": "C:\\Users\\jeff_\\.codex\\app-server-daemon\\app-server-updater.pid (missing)"
},
"remediation": null,
"durationMs": 0
},
"auth.credentials": {
"id": "auth.credentials",
"category": "auth",
"status": "ok",
"summary": "auth is configured",
"details": {
"auth file": "C:\\Users\\jeff_\\.codex\\auth.json",
"auth storage mode": "File",
"stored API key": "false",
"stored ChatGPT tokens": "true",
"stored agent identity": "false",
"stored auth mode": "chatgpt"
},
"remediation": null,
"durationMs": 0
},
"config.load": {
"id": "config.load",
"category": "config",
"status": "ok",
"summary": "config loaded",
"details": {
"CODEX_HOME": "C:\\Users\\jeff_\\.codex",
"config.toml": "C:\\Users\\jeff_\\.codex\\config.toml",
"config.toml parse": "ok",
"cwd": "C:\\Users\\jeff_",
"enabled feature flags": "<redacted>",
"feature flag overrides": "none",
"feature flags enabled": "38",
"log dir": "C:\\Users\\jeff_\\.codex\\log",
"mcp servers": "1",
"model": "gpt-5.4",
"model provider": "openai",
"sqlite home": "C:\\Users\\jeff_\\.codex"
},
"remediation": null,
"durationMs": 0
},
"git.environment": {
"id": "git.environment",
"category": "git",
"status": "ok",
"summary": "git version 2.55.0.windows.3",
"details": {
".git entry": "directory",
"PATH git #1": "C:\\Program Files\\Git\\cmd\\git.exe",
"PATH git entries": "1",
"git build options": "git version 2.55.0.windows.3; cpu: x86_64; built from commit: 52ca1113d651127f89477a8763f86ab20f645e1d; sizeof-long: 4; sizeof-size_t: 8; shell-path: D:/git-sdk-64/usr/bin/sh; rust: disabled; feature: fsmonitor--daemon; gettext: enabled; libcurl: 8.21.0; OpenSSL: OpenSSL 3.5.7 9 Jun 2026; zlib: 1.3.2; SHA-1: SHA1_DC; SHA-256: SHA256_BLK; default-ref-format: files; default-hash: sha1",
"git exec path": "C:/Program Files/Git/mingw64/libexec/git-core",
"git version": "git version 2.55.0.windows.3",
"repo detected": "true",
"repo root": "C:\\Users\\jeff_",
"selected git": "C:\\Program Files\\Git\\cmd\\git.exe"
},
"remediation": null,
"durationMs": 85
},
"installation": {
"id": "installation",
"category": "install",
"status": "ok",
"summary": "installation looks consistent",
"details": {
"PATH codex #1": "C:\\Users\\jeff_\\AppData\\Roaming\\npm\\codex",
"PATH codex #2": "C:\\Users\\jeff_\\AppData\\Roaming\\npm\\codex.cmd",
"PATH codex entries": "2",
"current executable": "C:\\Users\\jeff_\\AppData\\Roaming\\npm\\node_modules\\@openai\\codex\\node_modules\\@openai\\codex-win32-x64\\vendor\\x86_64-pc-windows-msvc\\bin\\codex.exe",
"install context": "npm (package C:\\Users\\jeff_\\AppData\\Roaming\\npm\\node_modules\\@openai\\codex\\node_modules\\@openai\\codex-win32-x64\\vendor\\x86_64-pc-windows-msvc, bin C:\\Users\\jeff_\\AppData\\Roaming\\npm\\node_modules\\@openai\\codex\\node_modules\\@openai\\codex-win32-x64\\vendor\\x86_64-pc-windows-msvc\\bin, resources C:\\Users\\jeff_\\AppData\\Roaming\\npm\\node_modules\\@openai\\codex\\node_modules\\@openai\\codex-win32-x64\\vendor\\x86_64-pc-windows-msvc\\codex-resources, path C:\\Users\\jeff_\\AppData\\Roaming\\npm\\node_modules\\@openai\\codex\\node_modules\\@openai\\codex-win32-x64\\vendor\\x86_64-pc-windows-msvc\\codex-path)",
"managed by bun": "false",
"managed by npm": "true",
"managed by pnpm": "false",
"managed package root": "C:\\Users\\jeff_\\AppData\\Roaming\\npm\\node_modules\\@openai\\codex",
"npm update target": "C:\\Users\\jeff_\\AppData\\Roaming\\npm\\node_modules\\@openai\\codex"
},
"remediation": null,
"durationMs": 372
},
"mcp.config": {
"id": "mcp.config",
"category": "mcp",
"status": "ok",
"summary": "MCP configuration is locally consistent",
"details": {
"configured servers": "1",
"disabled servers": "0",
"stdio servers": "1"
},
"remediation": null,
"durationMs": 0
},
"network.env": {
"id": "network.env",
"category": "network",
"status": "ok",
"summary": "network-related environment looks readable",
"details": {
"proxy env vars": "none"
},
"remediation": null,
"durationMs": 0
},
"network.provider_reachability": {
"id": "network.provider_reachability",
"category": "reachability",
"status": "ok",
"summary": "active provider endpoints are reachable over HTTP",
"details": {
"ChatGPT base URL": "https://chatgpt.com/backend-api/ reachable (HTTP 403)",
"reachability mode": "ChatGPT auth"
},
"remediation": null,
"durationMs": 87
},
"network.websocket_reachability": {
"id": "network.websocket_reachability",
"category": "websocket",
"status": "ok",
"summary": "Responses WebSocket handshake succeeded",
"details": {
"DNS": "2 IPv4, 2 IPv6, first IPv6",
"auth mode": "chatgpt",
"connect timeout": "15000 ms",
"endpoint": "wss://chatgpt.com/backend-api/<redacted>",
"handshake result": "HTTP 101 Switching Protocols",
"model provider": "openai",
"models etag present": "true",
"provider name": "OpenAI",
"proxy env vars": "none",
"reasoning header": "false",
"server model present": "false",
"supports websockets": "true",
"wire API": "responses"
},
"remediation": null,
"durationMs": 517
},
"runtime.provenance": {
"id": "runtime.provenance",
"category": "runtime",
"status": "ok",
"summary": "running npm on windows-x86_64",
"details": {
"commit": "unknown",
"current executable": "C:\\Users\\jeff_\\AppData\\Roaming\\npm\\node_modules\\@openai\\codex\\node_modules\\@openai\\codex-win32-x64\\vendor\\x86_64-pc-windows-msvc\\bin\\codex.exe",
"install method": "npm (package C:\\Users\\jeff_\\AppData\\Roaming\\npm\\node_modules\\@openai\\codex\\node_modules\\@openai\\codex-win32-x64\\vendor\\x86_64-pc-windows-msvc, bin C:\\Users\\jeff_\\AppData\\Roaming\\npm\\node_modules\\@openai\\codex\\node_modules\\@openai\\codex-win32-x64\\vendor\\x86_64-pc-windows-msvc\\bin, resources C:\\Users\\jeff_\\AppData\\Roaming\\npm\\node_modules\\@openai\\codex\\node_modules\\@openai\\codex-win32-x64\\vendor\\x86_64-pc-windows-msvc\\codex-resources, path C:\\Users\\jeff_\\AppData\\Roaming\\npm\\node_modules\\@openai\\codex\\node_modules\\@openai\\codex-win32-x64\\vendor\\x86_64-pc-windows-msvc\\codex-path)",
"platform": "windows-x86_64",
"version": "0.146.0"
},
"remediation": null,
"durationMs": 0
},
"runtime.search": {
"id": "runtime.search",
"category": "search",
"status": "ok",
"summary": "search is OK (bundled)",
"details": {
"search command": "C:\\Users\\jeff_\\AppData\\Roaming\\npm\\node_modules\\@openai\\codex\\node_modules\\@openai\\codex-win32-x64\\vendor\\x86_64-pc-windows-msvc\\codex-path\\rg.exe",
"search command readiness": "file exists",
"search provider": "bundled"
},
"remediation": null,
"durationMs": 0
},
"sandbox.helpers": {
"id": "sandbox.helpers",
"category": "sandbox",
"status": "ok",
"summary": "sandbox configuration is readable",
"details": {
"approval policy": "OnRequest",
"codex-linux-sandbox helper": "none",
"execve wrapper helper": "none",
"filesystem sandbox": "restricted",
"network sandbox": "restricted"
},
"remediation": null,
"durationMs": 0
},
"state.paths": {
"id": "state.paths",
"category": "state",
"status": "ok",
"summary": "state paths and databases are inspectable",
"details": {
"CODEX_HOME": "C:\\Users\\jeff_\\.codex (dir)",
"active rollout files": "64 files, 181118756 total bytes, 2829980 average bytes",
"archived rollout files": "0 files, 0 total bytes, 0 average bytes",
"goals DB": "C:\\Users\\jeff_\\.codex\\goals_1.sqlite (file)",
"goals DB integrity": "ok",
"log DB": "C:\\Users\\jeff_\\.codex\\logs_2.sqlite (file)",
"log DB integrity": "ok",
"log dir": "C:\\Users\\jeff_\\.codex\\log (missing)",
"memories DB": "C:\\Users\\jeff_\\.codex\\memories_1.sqlite (file)",
"memories DB integrity": "ok",
"sqlite home": "C:\\Users\\jeff_\\.codex (dir)",
"state DB": "C:\\Users\\jeff_\\.codex\\state_5.sqlite (file)",
"state DB integrity": "ok",
"thread history DB": "C:\\Users\\jeff_\\.codex\\thread_history_1.sqlite (missing)",
"thread history DB integrity": "skipped (missing)"
},
"remediation": null,
"durationMs": 1365
},
"state.rollout_db_parity": {
"id": "state.rollout_db_parity",
"category": "threads",
"status": "ok",
"summary": "rollout files and state DB thread inventory agree",
"details": {
"default model provider": "openai",
"rollout DB active files": "64",
"rollout DB active rows": "64",
"rollout DB archive mismatches": "0",
"rollout DB archived files": "0",
"rollout DB archived rows": "0",
"rollout DB duplicate DB paths": "0",
"rollout DB duplicate rollout thread ids": "0",
"rollout DB malformed file names": "0",
"rollout DB missing active rows": "0",
"rollout DB missing archived rows": "0",
"rollout DB model providers": "openai=64",
"rollout DB rows": "64",
"rollout DB scan cap reached": "false",
"rollout DB scan errors": "0",
"rollout DB sources": "vscode=41, cli=20, subagent:other=3",
"rollout DB stale rows": "0"
},
"remediation": null,
"durationMs": 1340
},
"system.environment": {
"id": "system.environment",
"category": "system",
"status": "ok",
"summary": "OS language pt-BR",
"details": {
"EDITOR": "not set",
"VISUAL": "not set",
"os": "Windows 10.0.26200 (Windows 11 Professional) [64-bit]",
"os language": "pt-BR",
"os type": "Windows",
"os version": "10.0.26200"
},
"remediation": null,
"durationMs": 0
},
"terminal.env": {
"id": "terminal.env",
"category": "terminal",
"status": "ok",
"summary": "terminal metadata was detected",
"details": {
"WT_SESSION": "present",
"color output": "enabled",
"console input code page": "850",
"console output code page": "850",
"stderr console mode": "0x00000007 (VT processing: true)",
"stderr is terminal": "true",
"stdin is terminal": "true",
"stdout console mode": "0x00000007 (VT processing: true)",
"stdout is terminal": "true",
"terminal": "Windows Terminal",
"terminal size": "120x30"
},
"remediation": null,
"durationMs": 0
},
"terminal.title": {
"id": "terminal.title",
"category": "title",
"status": "ok",
"summary": "terminal title default",
"details": {
"terminal title activity": "true",
"terminal title items": "activity, project-name",
"terminal title project source": "git repo root",
"terminal title project value": "jeff_",
"terminal title source": "default"
},
"remediation": null,
"durationMs": 0
},
"updates.status": {
"id": "updates.status",
"category": "updates",
"status": "ok",
"summary": "update configuration is locally consistent",
"details": {
"cached latest version": "0.146.0",
"check for update on startup": "true",
"last checked at": "2026-07-29T15:38:28.682811600Z",
"latest version": "0.146.0",
"latest version status": "current version is not older",
"npm update target": "C:\\Users\\jeff_\\AppData\\Roaming\\npm\\node_modules\\@openai\\codex",
"update action": "npm install -g @openai/codex",
"version cache": "C:\\Users\\jeff_\\.codex\\version.json"
},
"remediation": null,
"durationMs": 416
}
}
}
What issue are you seeing?
Summary
Python is correctly installed and available in the interactive shell that launches Codex.
However, when Codex executes commands during a task, Python is no longer available.
This prevents Python validation, pytest execution and existing virtual environments from working correctly.
---
Environment
- Windows 11 Professional
- Windows Terminal
- Windows PowerShell 5.1
- Codex CLI 0.146.0
- Python 3.12.10 (per-user installation)
---
Interactive PowerShell
These commands work correctly before starting Codex:
python --version
Output:
Python 3.12.10
py -0p
Output:
3.14
3.12
3.9
Python is correctly registered under:
HKCU\Software\Python\PythonCore
and PATH also contains:
C:\Users\<user>\AppData\Local\Programs\Python\Python312\
---
During Codex task execution
Running the same commands inside a Codex task produces different results.
python --version
returns
python : The term 'python' is not recognized...
py -3.12 --version
returns
No suitable Python runtime found
where.exe python
returns
INFO: Could not find files matching the pattern.
Existing virtual environments also fail with:
No Python at
"C:\Users\<user>\AppData\Local\Programs\Python\Python312\python.exe"
even though that interpreter exists and works correctly outside Codex.
---
Expected behavior
Commands executed during Codex task execution should observe the same Python installation available from the interactive shell that launched Codex.
---
Actual behavior
The environment used to execute commands during a Codex task cannot locate the installed Python interpreter, even though the same shell can locate and execute it normally before launching Codex..
I spent time comparing the interactive shell and the environment used during Codex task execution. The issue seems specific to command execution inside tasks, since the interactive shell detects Python normally while task execution does not.
What steps can reproduce the bug?
- Install Python 3.12 for the current user.
- Verify that Python works normally from PowerShell.
python --version
py -0p
Example output:
Python 3.12.10
- Launch Codex CLI from the same PowerShell session.
- Ask Codex to execute:
python --version
python -c "import sys; print(sys.executable)"
where.exe python
py -3.12 --version
.venv\Scripts\python.exe --version
- Observe that the commands executed by Codex fail, even though the same commands work correctly in the interactive PowerShell session before launching Codex.
In my case the errors include:
python : The term 'python' is not recognized...
No suitable Python runtime found
No Python at
"C:\Users\<user>\AppData\Local\Programs\Python\Python312\python.exe"
What is the expected behavior?
Commands executed by Codex should observe the same Python environment as the interactive PowerShell session that launched Codex.
Specifically:
python --versionshould return the installed Python version.py -3.12should detect the installed interpreter.- Existing virtual environments should execute normally.
- Validation commands such as
pytestshould run successfully when the environment is correctly configured.
In other words, commands executed inside a Codex task should behave consistently with the shell that launched Codex.
Additional information
I spent a significant amount of time isolating this issue before opening this report.
The behavior is fully reproducible on my machine.
The interactive PowerShell session correctly detects Python 3.12 and existing virtual environments.
The issue only occurs when Codex executes commands during a task.
codex doctor --json reports a healthy installation with no detected problems.
This report includes the exact commands, outputs, and environment information collected during the investigation.
If there is any additional diagnostic command or debug build that would help reproduce this issue, I would be happy to test it.