Codex 0.20.0 fails to login due to unable to find Python3.exe on Windows
What version of Codex is running?
codex-cli 0.20.0
Which model were you using?
gpt-5
What platform is your computer?
Microsoft Windows NT 10.0.19045.0 x64
What steps can reproduce the bug?
npm i -g @openai/codex codex login
What is the expected behavior?
Starting local login server on http://localhost:1455
. If your browser did not open, navigate to this URL to authenticate:
https://auth.openai.com/oauth/authorize?response_type=code&client_id=xxx&redirect_uri=http%3A%2F%2Flocalhost%3A1455%2Fauth%2Fcallback&scope=openid+profile+email+offline_access&code_challenge=xxx&code_challenge_method=S256&id_token_add_organizations=true&codex_cli_simplified_flow=true&state=xxx
Successfully logged in
What do you see instead?
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Apps > Advanced app settings > App execution aliases.
Error logging in: login_with_chatgpt subprocess failed:
If I disabled App execution alias for Python3.exe, the error will shown:
Error logging in: program not found
Additional information
It because I install Python here: C:\Python312
I only have python.exe, but Codex seems looks for python3.exe. I think look for python.exe should be accepted.
I had to install python 3 from the Windows Store for it to work, but yes, that should ideally not be necessary and it should pick up other installations
same issue - don't they test this stuff?
This works: https://github.com/openai/codex/issues/2057 basically make a copy of python.exe called python3.exe
I have the same issue:
>_ Welcome to Codex, OpenAI's command-line coding agent
> Sign in with ChatGPT to use Codex as part of your paid plan
or connect an API key for usage-based billing
> 1. Sign in with ChatGPT
Usage included with Plus, Pro, and Team plans
2. Provide your own API key
Pay for what you use
Press Enter to continue
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Apps > Advanced app settings > App execution aliases.
I have started the application without arguments and Python 3.11 is installed via the Microsoft Store.
nu> python
Python 3.11.9 (tags/v3.11.9:de54cf5, Apr 2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
Version infos:
Codex 0.20.0
Windows 11 (v 10.0.26100.4770)
Problem: codex needs python3 (not just python).
Solution:
I copied python.exe as python3.exe in C:\Users\mohgh\AppData\Local\Programs\Python\Python312
as commented by: [ lockster-at-secondskin](https://github.com/openai/codex/issues/2206#issuecomment-3177420671)
version 0.22.0 no longer uses python for this log in operation. Could you try the latest version? You can upgrade by npm -g i @openai/codex@latest.
@seratch tried again and still doesn't quite work. Even uninstalled and reinstalled again in a totally clean wsl.
@seratch I'm closing this because we fixed the Python issue. Please open a new issue with the errors you're seeing now.