Codex VSCode extension: `pyenv: cannot rehash: /home/username/.pyenv/shims/.pyenv-shim exists`

Context: I am on Ubuntu 24.04.3 LTS and using Codex via the VSCode extension.

I am using pyenv to manage Python versions. Whenever Codex tries to run a shell script with bash -lc, it tries to initialize pyenv again.

As a result, the command fails after one minute with the following error:

pyenv: cannot rehash: /home/username/.pyenv/shims/.pyenv-shim exists

I also tried with the Codex CLI. It can run scripts successfully, but when running Python on the terminal, it gets a one-minute delay + error (but the command still runs… :upside_down_face: )

$ cat <<‘EOF’ >/tmp/simple_python.py
print(‘Hello from Python’)
EOF
cat <<‘EOF’ >/tmp/run_simple_python.sh
#!/usr/bin/env bash
python3 /tmp/simple_python.py
EOF
chmod +x /tmp/run_simple_python.sh
/tmp/run_simple_python.sh
pyenv: cannot rehash: /home/andras/.pyenv/shims/.pyenv-shim exists
Hello from Python

Is there a way to use Codex with pyenv?