pez-globo / pufferfish-software

All software for the Pufferfish ventilator.
Apache License 2.0
0 stars 1 forks source link

`deploy/configs/pyenv_config.txt` no longer works correctly #385

Open ethanjli opened 3 years ago

ethanjli commented 3 years ago

After running deploy/install.sh on 2021-06-14 and restarting the RPi when prompted, I opened the terminal and then saw the following message:

WARNING: `pyenv init -` no longer sets PATH.
Run `pyenv init` to see the necessary changes to make to your configuration.

This refers to https://github.com/pez-globo/pufferfish-software/blob/006b6af617f2ab5abf5e7d503eaef43be5e22e0f/deploy/configs/pyenv_config.txt#L3 .

When I run pyenv init, I get the following output:

# (The below instructions are intended for common
# shell setups. See the README for more guidance
# if they don't apply and/or don't work for you.)

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

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

# If your ~/.profile sources ~/.bashrc,
# the lines need to be inserted before the part
# that does that. See the README for another option.

# If you have ~/.bash_profile, make sure that it
# also executes the above lines -- e.g. by
# copying them there or by sourcing ~/.profile

# Load pyenv into the shell by adding
# the following to ~/.bashrc:

eval "$(pyenv init -)"

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

(After running deploy/install.sh, our ~/.profile does seem to source ~/.bashrc, and that we don't have a ~/.bash_profile).

Despite this issue, I am able to run the backend afterwards with poetry run python3 -m ventserver.simulator; however, the pyenv configuration may be broken in other ways that don't prevent that command from running.

ethanjli commented 3 years ago

https://github.com/pyenv/pyenv/blob/master/README.md describes the instructions we should follow:

Put these lines into ~/.profile before the part that sources ~/.bashrc:

export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"

And put this line at the bottom of ~/.profile:

eval "$(pyenv init --path)"

Alternatively, for an automated installation, you can run the following:

echo -e 'if shopt -q login_shell; then' \
      '\n  export PYENV_ROOT="$HOME/.pyenv"' \
      '\n  export PATH="$PYENV_ROOT/bin:$PATH"' \
      '\n eval "$(pyenv init --path)"' \
      '\nfi' >> ~/.bashrc
echo -e 'if [ -z "$BASH_VERSION" ]; then'\
      '\n  export PYENV_ROOT="$HOME/.pyenv"'\
      '\n  export PATH="$PYENV_ROOT/bin:$PATH"'\
      '\n  eval "$(pyenv init --path)"'\
      '\nfi' >>~/.profile