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

pyenv init shows wrong shell configuration instructions when a custom PYENV_ROOT is set #2637

Open
11 of 13 tasks
Poshi opened this issue Mar 7, 2023 · 0 comments
Open
11 of 13 tasks

Comments

@Poshi
Copy link

Poshi commented Mar 7, 2023

Prerequisite

  • 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 pyenv and the default python-build plugin only. Please refrain from reporting issues of other plugins here.

Description

  • Platform information (e.g. Ubuntu Linux 16.04):
    CentOS Linux release 7.9.2009 (Core)
  • OS architecture (e.g. amd64):
    x86_64
  • pyenv version:
    Latest (v2.3.14)
  • Python version:
    None yet.
  • C Compiler information (e.g. gcc 7.3):
    None yet.
  • Please attach the debug trace of the failing command as a gist:
    No failing command, but an excerpt of the wrong output can be found with the description.
  • If you have a problem with installing Python, please also attach config.log from the build directory
    • The build directory is reported after the "BUILD FAILED" message and is usually under /tmp.
  • 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.log from the build directory. When using pyenv install with -k as per above, the build directory will be under $PYENV_ROOT/sources.

I'm aware of the XDG discussion in another issue, and I don't plan to interfere in that. But I didn't wanted to have an extra dotfile in my home, so I wanted to put the pyenv installation in another "standard" location. I decided to put it in ${XDG_DATA_HOME}, although this is not the best place either. In any case, to achieve this behavior, I started by definig PYENV_ROOT before installation:

export PYENV_ROOT="${XDG_DATA_HOME}/pyenv"
curl https://pyenv.run | bash

Apparently, the installation succeeded (in the expected location given by the exported var, not in default .pyenv) and gave me instructions to update my config files for automatic initialization. And here comes the issue: it proposed me to export a different PYENV_ROOT than the one really used:

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

# Load pyenv automatically by appending
# the following to
~/.bash_profile if it exists, otherwise ~/.profile (for login shells)
and ~/.bashrc (for interactive shells) :

export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"

# Restart your shell for the changes to take effect.

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

eval "$(pyenv virtualenv-init -)"

It should not be difficult to change those isntructions to include the real ${PYENV_ROOT} used.

@native-api native-api changed the title Wrong configuration instructions Wrong configuration instructions when a custom PYENV_ROOT is set Mar 8, 2023
@native-api native-api changed the title Wrong configuration instructions when a custom PYENV_ROOT is set pyenv init shows wrong shell configuration instructions when a custom PYENV_ROOT is set Mar 8, 2023
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

No branches or pull requests

1 participant