-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Description
Some build environments (in this case Yocto for embedded Linux development) manipulate PATH by removing the standard /bin, /usr/bin etc. hierarchy, opting instead for purpose built utilities and linking to some specific host utilities. In the case of Yocto, it will create links to the host tools it actually wants to use and then add a directory of those links to the PATH. However, if python is then called and pyenv then decides to execute the "system" python (which is itself a link to the shim at this point), it will infinite loop.
I recognize this is extremely contrived (and easily worked around with a .python-version file), although I think a good solution would be to check to see if the chosen python is a link to a shim then error out if so. Or if there's logic for removing shims from the PATH, if that could be extended to also include links to shims.
Here's a small script for reproducing:
# Set up path for the failure mode
mkdir -p badpath
newpath="$(readlink -f badpath)"
for item in /bin/* /usr/bin/*;
do
ln -s $item ${newpath}/$(basename $item)
done
rm -f ${newpath}/python*
ln -s $HOME/.pyenv/shims/python ${newpath}/python
export PATH="$newpath"
# Standard pyenv install instructions
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
# Infinite loop
echo "About to execute python..."
pythonPrerequisite
- Make sure your problem is not listed in the common build problems.
- Make sure no duplicated issue has already been reported in the pyenv issues. You should look for closed issues, too.
- Make sure you are not asking us to help solving your specific issue.
- GitHub issues is opened mainly for development purposes. If you want to ask someone to help solving your problem, go to some community site like Gitter, StackOverflow, etc.
- Make sure your problem is not derived from packaging (e.g. Homebrew).
- Please refer to the package documentation for the installation issues, etc.
- Make sure your problem is not derived from plugins.
- This repository is maintaining
pyenvand the defaultpython-buildplugin only. Please refrain from reporting issues of other plugins here.
- This repository is maintaining
Description
- Platform information (e.g. Ubuntu Linux 16.04): Fedora 38
- OS architecture (e.g. amd64): amd64
- pyenv version: 2.3.17
- Python version: 3.11.3
- C Compiler information (e.g. gcc 7.3): 13.1.1
- Please attach the debug trace of the failing command as a gist:
- Run
env PYENV_DEBUG=1 <faulty command> 2>&1 | tee trace.logand attachtrace.log. E.g. if you have a problem with installing Python, runenv PYENV_DEBUG=1 pyenv install -v <version> 2>&1 | tee trace.log(note the-voption topyenv install).
- Run
- If you have a problem with installing Python, please also attach
config.logfrom the build directory- The build directory is reported after the "BUILD FAILED" message and is usually under
/tmp.
- The build directory is reported after the "BUILD FAILED" message and is usually under
- If the build succeeds but the problem is still with the build process (e.g. the resulting Python is missing a feature), please attach
- the debug trace from reinstalling the faulty version with
env PYENV_DEBUG=1 pyenv install -f -k -v <version> 2>&1 | tee trace.log config.logfrom the build directory. When usingpyenv installwith-kas per above, the build directory will be under$PYENV_ROOT/sources.
- the debug trace from reinstalling the faulty version with