Machine executor with python has problems with pyenv

python

#1

I am trying to use the machine executor on a CircleCI 2.0 config so my tests can create networks and spin containers as they see fit.

However, I could not make pyenv work as intended like following logs demonstrate. Even after updating pyenv (cd $(pyenv root) && git pull):

circleci@prealloc-xyz:/opt/circleci/.pyenv$ pyenv versions
/opt/circleci/.pyenv/libexec/pyenv-versions: line 75: pyenv-version-name: command not found
  2.7.12
  3.5.2
circleci@prealloc-xyz:/opt/circleci/.pyenv$ pyenv global 3.5.2
/opt/circleci/.pyenv/libexec/pyenv-global: line 28: pyenv-version-file-write: command not found

Even pyenv init - shows this same issue:

circleci@prealloc-7q38ocmx-c8e34328-6a08-4ddf-a87c-b8ab092f2ecc:/opt/circleci/.pyenv/libexec$ pyenv init -
export PATH="/opt/circleci/.pyenv/shims:${PATH}"
export PYENV_SHELL=bash
source '/opt/circleci/.pyenv/libexec/../completions/pyenv.bash'
command pyenv rehash 2>/dev/null
/opt/circleci/.pyenv/libexec/pyenv-init: line 107: pyenv-commands: command not found

I ended up using the system executable which unfortunately also requires some tweaking, because it misses some packages:

sudo apt-get install python3-dev python3.4-venv

#2