I've been using pyenv for almost two years with no problems on my system running RHEL 8.3 (Linux kernel 4.18) with Gnome 3.32.2 in X11 mode. I primarily use the fish shell but also occasionally bash, both worked fine with pyenv until now. However, after running pyenv update
about 24 hours ago, using the pyenv activate
command to activate one of my created virtual environments no longer sets the path to use what I've installed in that virtual environment.
When I start a terminal session, I see a new message saying:
WARNING: `pyenv init -` no longer sets PATH.
Run `pyenv init` to see the necessary changes to make to your configuration.
So I ran pyenv init
which told me:
# Add pyenv executable to PATH by adding
# the following to ~/.profile:
set -Ux PYENV_ROOT $HOME/.pyenv
set -Ux fish_user_paths $PYENV_ROOT/bin $fish_user_paths
# Load pyenv automatically by appending
# the following to ~/.config/fish/config.fish:
pyenv init - | source
# and the following to ~/.profile:
pyenv init --path | source
# If your ~/.profile sources ~/.config/fish/config.fish,
# the lines should be inserted before the part
# that does that.
# Make sure to restart your entire logon session
# for changes to ~/.profile to take effect.
I'm pretty sure I already have all of the above. Here's my ~/.profile
:
set -Ux PYENV_ROOT $HOME/.pyenv
set -Ux fish_user_paths $PYENV_ROOT/bin $fish_user_paths
pyenv init --path | source
Here's my ~/.config/fish/config.fish
:
# Set default editor
set -gx EDITOR nano
# Set Junest path
set PATH /home/[username]/.local/share/junest/bin $PATH
# Set pyenv root directory
set PYENV_ROOT $HOME/.pyenv
# Add pyenv and local bin to $PATH
set PATH $PYENV_ROOT/bin /home/[username]/.local/bin $PATH
# Add pyenv init to shell to enable shims and autocompletion
# Note the command `pyenv init` will tell you to add this line for fish
status --is-interactive; and source (pyenv init -|psub)
pyenv init - | source
My ~/.bashrc
:
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific environment
PATH="$HOME/.local/bin:$HOME/bin:$PATH"
export PATH
# Uncomment the following line if you don't like systemctl's auto-paging featur$
# export SYSTEMD_PAGER=
# User specific aliases and functions
# Load pyenv
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
A few more observations:
- I discovered that even though I have
~/.profile
, it is never sourced/run when I log into my desktop environment. - Putting
set -Ux PYENV_ROOT $HOME/.pyenv
andset -Ux fish_user_paths $PYENV_ROOT/bin $fish_user_paths
in~/.profile
or~/.config/fish/config.fish
doesn't make a difference.
In the end, even after activating a pyenv-created virtual environment, I still don't have access to what's in it.
How can I troubleshoot this? Thank you.