Errors setting up build environment on mac

evidently it is not removing pyenv successfully (see below). I included the entire terminal session this time.

As you saw in my previous post, the last time it seemed to work, because the output of which pyenv was empty so I thought it had worked. what’s going on?

Last login: Tue Jun 29 11:55:50 on ttys001
-bash: /Users/Tools/completion/completion.bash: No such file or directory

The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
2015mattmacbookproW:~ mholmes$ which pyenv
/usr/local/bin/pyenv
2015mattmacbookproW:~ mholmes$ rm -rf ~/.pyenv
2015mattmacbookproW:~ mholmes$ which pyenv
/usr/local/bin/pyenv
2015mattmacbookproW:~ mholmes$ pwd
/Users/mholmes
2015mattmacbookproW:~ mholmes$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/Library/Apple/usr/bin
2015mattmacbookproW:~ mholmes$ rm -rf ~/.pyenv
2015mattmacbookproW:~ mholmes$ which pyenv
/usr/local/bin/pyenv
2015mattmacbookproW:~ mholmes$

oh I’ve got pyenv globally installed and we’re just removing it from my home directory yes?

if pyenv manages my py installations, is there a pyenvenv to manage my pyenv installations? :slight_smile:

ok, I successfully uninstalled the remaining pyenv using brew uninstall pyenv

then re-ran the script

bash-3.2$ ./prereqsscript_20210629a.sh
---------- ./prereqsscript_20210629a.sh start ----------
+ '[' 501 == 0 ']'
+ [[ /bin/bash == *\z\s\h* ]]
+ [[ /bin/bash == *\b\a\s\h* ]]
+ AP_COMPLETION_SCR=completion.bash
+ SHELL_LOGIN=.bash_profile
+ OPT=/opt
+ ARDUPILOT_TOOLS=Tools/autotest
+ ASSUME_YES=false
+ sep='##############################################'
+ OPTIND=1
+ getopts y opt
+ echo 'Checking homebrew...'
Checking homebrew...
++ which -s brew
+ echo 'Homebrew installed'
Homebrew installed
+ echo 'Checking CLI Tools installed...'
Checking CLI Tools installed...
++ xcode-select --install
+ ERROR='xcode-select: error: command line tools are already installed, use "Software Update" to install updates'
+ [[ xcode-select: error: command line tools are already installed, use "Software Update" to install updates != *\c\o\m\m\a\n\d\ \l\i\n\e\ \t\o\o\l\s\ \a\r\e\ \a\l\r\e\a\d\y\ \i\n\s\t\a\l\l\e\d* ]]
+ brew update
Updated 1 tap (homebrew/core).
==> Updated Formulae
jupyterlab                                           vulkan-headers                                       zabbix
+ brew install gawk curl coreutils wget
Warning: gawk 5.1.0 is already installed and up-to-date.
To reinstall 5.1.0, run:
  brew reinstall gawk
Warning: curl 7.77.0 is already installed and up-to-date.
To reinstall 7.77.0, run:
  brew reinstall curl
Warning: coreutils 8.32 is already installed and up-to-date.
To reinstall 8.32, run:
  brew reinstall coreutils
Warning: wget 1.21.1 is already installed and up-to-date.
To reinstall 1.21.1, run:
  brew reinstall wget
+ PIP=pip
+ maybe_prompt_user 'Install python using pyenv [N/y]?'
+ false
+ read -p 'Install python using pyenv [N/y]?'
Install python using pyenv [N/y]?y
+ [[ y =~ ^[Yy]$ ]]
+ return 0
+ echo 'Checking pyenv...'
Checking pyenv...
++ which -s pyenv
+ echo 'Installing pyenv'
Installing pyenv
+ curl https://pyenv.run
+ bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   285  100   285    0     0    442      0 --:--:-- --:--:-- --:--:--   441
Cloning into '/Users/mholmes/.pyenv'...
remote: Enumerating objects: 768, done.
remote: Counting objects: 100% (768/768), done.
remote: Compressing objects: 100% (399/399), done.
remote: Total 768 (delta 423), reused 483 (delta 274), pack-reused 0
Receiving objects: 100% (768/768), 411.33 KiB | 2.29 MiB/s, done.
Resolving deltas: 100% (423/423), done.
Cloning into '/Users/mholmes/.pyenv/plugins/pyenv-doctor'...
remote: Enumerating objects: 11, done.
remote: Counting objects: 100% (11/11), done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 11 (delta 1), reused 5 (delta 0), pack-reused 0
Unpacking objects: 100% (11/11), 38.62 KiB | 416.00 KiB/s, done.
Cloning into '/Users/mholmes/.pyenv/plugins/pyenv-installer'...
remote: Enumerating objects: 16, done.
remote: Counting objects: 100% (16/16), done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 16 (delta 1), reused 7 (delta 0), pack-reused 0
Unpacking objects: 100% (16/16), 5.74 KiB | 588.00 KiB/s, done.
Cloning into '/Users/mholmes/.pyenv/plugins/pyenv-update'...
remote: Enumerating objects: 10, done.
remote: Counting objects: 100% (10/10), done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 10 (delta 1), reused 6 (delta 0), pack-reused 0
Unpacking objects: 100% (10/10), 2.77 KiB | 472.00 KiB/s, done.
Cloning into '/Users/mholmes/.pyenv/plugins/pyenv-virtualenv'...
remote: Enumerating objects: 57, done.
remote: Counting objects: 100% (57/57), done.
remote: Compressing objects: 100% (51/51), done.
remote: Total 57 (delta 11), reused 19 (delta 0), pack-reused 0
Unpacking objects: 100% (57/57), 35.30 KiB | 178.00 KiB/s, done.
Cloning into '/Users/mholmes/.pyenv/plugins/pyenv-which-ext'...
remote: Enumerating objects: 10, done.
remote: Counting objects: 100% (10/10), done.
remote: Compressing objects: 100% (6/6), done.
Unpacking objects: 100% (10/10), 2.92 KiB | 497.00 KiB/s, done.
remote: Total 10 (delta 1), reused 6 (delta 0), pack-reused 0

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


# (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.

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

eval "$(pyenv virtualenv-init -)"

+ exportline='export PYENV_ROOT=$HOME/.pyenv'
+ echo export 'PYENV_ROOT=$HOME/.pyenv'
+ exportline='export PATH=$PYENV_ROOT/bin:$PATH'
+ echo export 'PATH=$PYENV_ROOT/bin:$PATH'
+ evalline='eval "$(pyenv init --path)"'
+ echo eval '"$(pyenv' init '--path)"'
+ evalline='eval "$(pyenv init -)"'
+ echo eval '"$(pyenv' init '-)"'
+ source /Users/mholmes/.bash_profile
++ export PATH
++ source /Users/Tools/completion/completion.bash
/Users/mholmes/.bash_profile: line 2: /Users/Tools/completion/completion.bash: No such file or directory
bash-3.2$ 

this is the current contents of my .bash_profile, in case that’s relevant to the new error:

export PATH
source /Users/Tools/completion/completion.bash
export PYENV_ROOT=$HOME/.pyenv
export PATH=$PYENV_ROOT/bin:$PATH
eval "$(pyenv init --path)"
eval "$(pyenv init -)"

what’s with the completion.bash file? I’ll do some more self-educating

line 118 in your script is incomplete, I think it should be: evalline="eval \"\$(pyenv init --path)\"" just had some characters missing

so I fixed that, cleaned out any pyenv again, re-ran the script, and the script finished successfully

now I will try to build something, but so far so good

ok, success!
two things:

  1. after running the setup script I think one needs to restart the shell in order to load the new paths from the .bash_profile. I got an error Could not find the program ['arm-none-eabi-ar'] and then I thought to start a new shell and then it worked
  2. I ran the setup script from my home directory, and the script balked at the git update command (last thing) because it wants to be run from within the ardupilot directory, so if you work your path construction magic on that script command that should remedy it right?

thanks for the help!

1 Like

@CBwintertime thanks for verifying this, yes you do need to restart the shell after installation. We can mention this in the updated docs. The script is supposed to be run from inside ardupilot repository context, most scripts in ardupilot are. But to be on the safe side we will mention the same in the docs as well.

1 Like

FYI @bugobliterator’s PR has been merged to latest (aka “master”) today…