codex icon indicating copy to clipboard operation
codex copied to clipboard

Codex 0.20.0 fails to login due to unable to find Python3.exe on Windows

Open doggy8088 opened this issue 1 year ago • 8 comments

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.

doggy8088 avatar Aug 12 '25 01:08 doggy8088

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

Alb-O avatar Aug 12 '25 01:08 Alb-O

same issue - don't they test this stuff?

lockster-at-secondskin avatar Aug 12 '25 01:08 lockster-at-secondskin

This works: https://github.com/openai/codex/issues/2057 basically make a copy of python.exe called python3.exe

lockster-at-secondskin avatar Aug 12 '25 01:08 lockster-at-secondskin

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)

MovGP0 avatar Aug 13 '25 14:08 MovGP0

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)

mohghaderi avatar Aug 14 '25 05:08 mohghaderi

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 avatar Aug 18 '25 09:08 seratch

@seratch tried again and still doesn't quite work. Even uninstalled and reinstalled again in a totally clean wsl.

fabiogaliano avatar Aug 19 '25 13:08 fabiogaliano

@seratch I'm closing this because we fixed the Python issue. Please open a new issue with the errors you're seeing now.

ae-openai avatar Aug 20 '25 17:08 ae-openai