There is a closed issue, but it was closed without explanation or resolution: https://github.com/pyenv/pyenv/issues/622
pyenv and the default python-build plugin only. Please refrain from reporting issues of other plugins here.I believe my issue is identical to a closed issue, but the issue was closed without explanation, reason, or resolution: https://github.com/pyenv/pyenv/issues/622
On a fresh install of Arch and Pyenv:
>python --version
Python 3.7.2
> /usr/sbin/python
Python 3.7.2 (default, Jan 10 2019, 23:51:51)
[GCC 8.2.1 20181127] on linux
Type "help", "copyright", "credits" or "license" for more information.
>pyenv versions
* system (set by /home/tommy/.pyenv/version)
>pyenv global system
pyenv: version `system' not installed
why?
Same here...
Is there a workaround for switching to system until the bug is fixed?
I've switched to an anaconda version and now I cannot switch back to the system version. I cannot open Calibre and i3 status bar shows an error because of this issue. Please provide a workaround or fix the bug.
In .pyenv/versionI've replaced the current python version with system and now I can open Calibre and my i3 status bar looks normal again.
Pyenv assume that the parent directory of python executable is always named as bin.
https://github.com/pyenv/pyenv/blob/7097f8204e26c63a6ae9699255caa75e7c3ef084/libexec/pyenv-prefix#L34
Walkaround is to place /usr/bin ahead of /usr/sbin . I add the following lines to my .zshrc.
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
if ! pyenv prefix system 1>/dev/null 2>&1; then
typeset -U PATH path
local usr_sbin_index=${path[(ie)/usr/sbin]}
local usr_bin_index=${path[(ie)/usr/bin]}
if [ ${usr_sbin_index} -lt ${usr_bin_index]} ]; then
echo "Reorder path because the pyenv bug"
echo "https://github.com/pyenv/pyenv/issues/1301"
path[${usr_sbin_index}]="/usr/bin"
path[${usr_bin_index}]="/usr/sbin"
export PATH
fi
fi
fi
Maybe it can be fix with place a question symbol ? before bin? @chrahunt
PYENV_PREFIX_PATH="${PYTHON_PATH%/?bin/*}"
I put this in my .zshrc/.bashrc to fix this. It just puts all path entries ending in sbin at the end of PATH.
# move all paths ending in 'sbin' to the back of PATH
# This is needed because pyenv fails to find the system python otherwise
for SB in $(echo "$PATH" | grep ':*/[^:]*sbin' -o)
do
export PATH="${PATH/$SB}:${SB#:}"
done
Most helpful comment
Pyenv assume that the parent directory of
pythonexecutable is always named asbin.https://github.com/pyenv/pyenv/blob/7097f8204e26c63a6ae9699255caa75e7c3ef084/libexec/pyenv-prefix#L34
Walkaround is to place
/usr/binahead of/usr/sbin. I add the following lines to my.zshrc.Maybe it can be fix with place a question symbol
?beforebin? @chrahunt