Pyenv shim already exists. Commands constantly timeout in WSL2 environment
Resolved 💬 12 comments Opened Sep 19, 2025 by samargy Closed Mar 29, 2026
💡 Likely answer: A maintainer (etraut-openai, contributor)
responded on this thread — see the highlighted reply below.
What version of Codex is running?
codex-cli 0.36.0
Which model were you using?
gpt-5-codex-medium
What platform is your computer?
Linux 6.6.87.2-microsoft-standard-WSL2 x86_64 x86_64
What steps can reproduce the bug?
Get codex to attempt to run any command.
What is the expected behavior?
Command runs fine.
What do you see instead?
$ rg "class Post" -n my_repo/models -g"*.py"
command timed out after 60285 milliseconds
pyenv: cannot rehash: /home/MY_USER/.pyenv/shims/.pyenv-shim exists
✗ (124) • 1m 00s
Additional information
I have made attempts of deleting pyenv, reinstalling. Rehashing etc.
12 Comments
There is the same issue here. However, I noticed that it only gets triggered when running node or python scripts. It always times out and throws an error after one minute:
Yep this is exactly my experience. Anything that you found that fixes this issue?
Still occuring with codex 0.41.0
The solution is to uninstall pyenv. In fact, codex does not depend on pyenv; it simply cannot work in an environment configured with pyenv. If you remove all pyenv-related lines from your ~/.bashrc (or possibly ~/.zshrc), you should be able to bypass this issue.
Uninstalling pyenv was a bit overkill for me (I still need it for my python stuff), but I added a command to my project Makefile to launch codex without pyenv.
Sometimes, codex calls
bash -lc, so I also added a guard to my ``.profile`` to avoid enabling pyenv for non interactive shells :I met same issue and fixed (validated by prompting codex to search certain lines in codebase) by deleting duplicated pyenv initializing scripts in ~/.bashrc ~/.profile
Environment
cat /etc/os-release)pyenv --version)~/.zshrc + ~/.bashrc + ~/.profileScript to detect duplication
Yes, keeping only one pyenv configuration in ~/.bashrc will fix this issue.
````
~/.bashrcby running the following in your terminal:``
bash
``echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init - bash)"' >> ~/.bashrc
````
Met the same issue. Codex was way too slow until I removed pyenv initialization from the ~/.profile. Thx a lot!
The timeout issue has been fixed in pyenv 2.6.16:
https://github.com/pyenv/pyenv/releases/tag/v2.6.16
Easiest way to update pyenv to the latest version is to run the following command from your terminal window:
pyenv updateFor more information on the cause and resolution of the issue, see:
This bug report hasn't received any upvotes or additional posts in four months. Closing.
Could this be reopened? Unfortunately it's still happening on to me on MacOS w/ 2.6.20 :/
@HeroCC, this bug report is very outdated at this point. If you're seeing similar symptoms with the latest release, please open a new bug report and provide all of the information in the bug template. For a bug like this,
/feedbackis also useful.Will do, ty!