Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning about the load path tells the user to append to ~/.bash_profile which makes ~/.profile not run #383

Closed
Jackenmen opened this issue May 7, 2021 · 5 comments · Fixed by #384
Assignees

Comments

@Jackenmen
Copy link

Currently, this is the warning message you get from pyenv installer after installation (the part that concerns this issue is from pyenv-virtualenv and is at the end of this code block):

WARNING: seems you still have not added 'pyenv' to the load path.

# Add pyenv executable to PATH by adding
 the following to ~/.profile:

export PATH="/home/vm/.pyenv/bin:$PATH"
# Load pyenv automatically by appending
# the following to ~/.bashrc:

eval "$(pyenv init -)"

# And the following to ~/.profile

eval "$(pyenv init --path)"

# Make sure to restart your entire logon session
# for changes to ~/.profile to take effect.

# Load pyenv-virtualenv automatically by adding
# the following to ~/.bash_profile:

eval "$(pyenv virtualenv-init -)"

This leads to a situation where the user will have both ~/.profile and ~/.bash_profile which in turn causes ~/.profile to not be run at all and therefore making the PATH change in ~/.profile not actually run (and that means everything else simply doesn't work).

From bash(1) manual (emphasis mine):

When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. The --noprofile option may be used when the shell is started to inhibit this behavior.

@Jackenmen
Copy link
Author

Jackenmen commented May 7, 2021

It does seem that a preferred way would be to use the same file for all these commands as the commands from .bashrc are likely to run before the ones from .profile as usually .profile sources .bashrc at the beginning.

This would mean this isn't just pyenv-virtualenv issue but I don't know if I should make another one.

@native-api
Copy link
Member

@anton-petrov I warned you about that in pyenv/pyenv-installer#109 (comment) !

@anton-petrov
Copy link
Member

Fixed 8c7ef73

@Jackenmen
Copy link
Author

Jackenmen commented May 9, 2021

While the issue from the title is resolved, the one I mentioned in the second comment isn't.

Currently, when following instructions, users would add these lines to the end of .bashrc:

eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

And these lines to the end of .profile:

export PATH="/home/vm/.pyenv/bin:$PATH"
eval "$(pyenv init --path)"

which leads to a situation where pyenv commands are ran before pyenv is a part of the PATH.

This wasn't an issue before as pyenv-installer told users to put all of the lines in .bashrc.

Should I make a separate issue for this?

@native-api
Copy link
Member

See pyenv/pyenv#1909 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants