# salt.states.pyenv

## Managing python installations with pyenv

This module is used to install and manage python installations with pyenv. Different versions of python can be installed, and uninstalled. pyenv will be installed automatically the first time it is needed and can be updated later. This module will not automatically install packages which pyenv will need to compile the versions of python.

If pyenv is run as the root user then it will be installed to /usr/local/pyenv, otherwise it will be installed to the users ~/.pyenv directory. To make pyenv available in the shell you may need to add the pyenv/shims and pyenv/bin directories to the users PATH. If you are installing as root and want other users to be able to access pyenv then you will need to add pyenv_ROOT to their environment.

This is how a state configuration could look like:

    pyenv-deps:
      pkg.installed:
        - pkgs:
          - make
          - build-essential
          - libssl-dev
          - zlib1g-dev
          - libbz2-dev
          - libreadline-dev
          - libsqlite3-dev
          - wget
          - curl
          - llvm
    python-2.6:
      pyenv.absent:
        - require:
          - pkg: pyenv-deps

    python-2.7.6:
      pyenv.installed:
        - default: True
        - require:
          - pkg: pyenv-deps

Note

Git needs to be installed and available via PATH if pyenv is to be installed automatically by the module.

salt.states.pyenv.absent(name, user=None)

  Verify that the specified python is not installed with pyenv. pyenv is installed if necessary.

  name

    The version of python to uninstall

  user: None

    The user to run pyenv as.

    Added in version 0.17.0.

  Added in version 0.16.0.

salt.states.pyenv.install_pyenv(name, user=None)

  Install pyenv if not installed. Allows you to require pyenv be installed prior to installing the plugins. Useful if you want to install pyenv plugins via the git or file modules and need them installed before installing any rubies.

  Use the pyenv.root configuration option to set the path for pyenv if you want a system wide install that is not in a user home dir.

  user: None

    The user to run pyenv as.

salt.states.pyenv.installed(name, default=False, user=None)

  Verify that the specified python is installed with pyenv. pyenv is installed if necessary.

  name

    The version of python to install

  defaultFalse

    Whether to make this python the default.

  user: None

    The user to run pyenv as.

    Added in version 0.17.0.

  Added in version 0.16.0.