Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status


pyenv (30) Versions 3.5.1

Manages pyenv and its installed Python versions.

cookbook 'pyenv', '= 3.5.1', :supermarket
cookbook 'pyenv', '= 3.5.1'
knife supermarket install pyenv
knife supermarket download pyenv
Quality 100%

pyenv Chef Cookbook

Cookbook Version
Build Status


Manages pyenv and its installed Pythons.

Several custom resources are defined to facilitate this.

WARNING As of v1.0.0, this cookbook no longer provide any recipes. Custom resources are provided instead.

NOTE The following distros have [known issues][openssl-issues] regarding building python 3.7 which are all related to the OpenSSL library versions.

  • RHEL6
  • Debian 8



This cookbook requires Chef 14.0+.

Platform family

  • Debian derivatives (debian, ubuntu)
  • Fedora
  • RHEL derivatives (RHEL, CentOS, Amazon Linux, Oracle, Scientific Linux)
  • openSUSE and openSUSE leap


Examples installations are provided in test/fixtures/cookbooks/test/recipes

A pyenv_system_install or pyenv_user_install is required to be set so that pyenv knows which version you want to use, and is installed on the system.


Used to install a Python package into the selected pyenv environment.

pyenv_pip 'requests' do
  virtualenv  # Optional: if passed, pip inside provided virtualenv would be used (by default system's pip)
  version     # Optional: if passed, the version the python package to install
  user        # Optional: if passed, the user to install the python module for
  umask       # Optional: if passed, the umask to set before installing the python module
  options     # Optional: if passed, pip would install/uninstall packages with given options
  requirement # Optional: if true passed, install/uninstall requirements file passed with name property
  editable    # Optional: if true passed, install package in editable mode

The pyenv_pip resource has the following actions:

  • :install - Default. Install a python package. If a version is specified, install the specified version of the python package.
  • :upgrade - Install/upgrade a python package. Call install command with --upgrade flag. If version is not specified, latest version will be installed.
  • :uninstall - Uninstall a python package.


pyenv_global '3.6.1' do
  user # Optional: if passed sets the users global version. Do not set, to set the systems global version

If a user is passed in to this resource it sets the global version for the user, under the users root_path (usually ~/.pyenv/version), otherwise it sets the system global version.


Installs a pyenv plugin.

pyenv_plugin 'virtualenv' do
  git_url     # Git URL of the plugin
  git_ref     # Git reference of the plugin
  environment # Optional: pass environment variables to git resource
  user        # Optional: if passed installs to the users pyenv. Do not set, to set installs to the system pyenv.


pyenv_rehash 'rehash' do
  user # Optional: if passed rehashes the user pyenv otherwise rehashes the system pyenv


pyenv_python '3.6.1' do
  user         # Optional: if passed, the user pyenv to install to
  environment  # Optional: pass environment variable to git resource
  pyenv_action # Optional: the action to perform, install, remove etc
  verbose      # Optional: print verbose output during python installation

Shorter example pyenv_python '3.6.1'.


Runs a pyenv aware script.

pyenv_script 'foo' do
  code          # Script code to run
  pyenv_version # pyenv version to run the script against
  environment   # Optional: Environment to setup to run the script
  user          # Optional: User to run as
  umask         # Optional: the umask to set before running the script
  group         # Optional: Group to run as
  path          # Optional: Path to search for commands
  returns       # Optional: Expected return code

System install

Installs pyenv to the system location, by default /usr/local/pyenv

pyenv_system_install 'foo' do
  git_url      # URL of the plugin repo you want to checkout
  git_ref      # Optional: Git reference to checkout
  environment  # Optional: pass environment variable during pyenv installation
  update_pyenv # Optional: Keeps the git repo up to date

User install

Installs pyenv to the user path, making pyenv available to that user only.

pyenv_user_install 'vagrant' do
  git_url     # Optional: Git URL to checkout pyenv from.
  git_ref     # Optional: Git reference to checkout e.g. 'master'
  environment # Optional: pass environment variable during pyenv installation
  user        # Which user to install pyenv to (also specified in the resources name above)

System-Wide Mac Installation Note

This cookbook takes advantage of managing profile fragments in an
/etc/profile.d directory, common on most Unix-flavored platforms.
Unfortunately, Mac OS X does not support this idiom out of the box,
so you may need to [modify][mac_profile_d] your user profile.


Pull requests are very welcome! Make sure your patches are well tested.


This project exists thanks to all the people who contribute.


Thank you to all our backers!


Support this project by becoming a sponsor. Your logo will show up here with a link to your website.

pyenv Changelog

3.5.1 - 2021-08-30

  • Standardise files with files in sous-chefs/repo-management

3.5.0 - 2021-07-22

  • Add support for setting umask for pip resource.

3.4.2 - 2021-06-01

  • Standardise files with files in sous-chefs/repo-management

3.4.1 - 2020-12-31

  • resolved cookstyle error: resources/pip.rb:153:1 convention: Layout/TrailingEmptyLines

3.4.0 (2020-11-05)

  • Add :upgrade action to the pyenv_pip resource

3.3.2 (2020-08-05)

  • Do not attempt to rehash in a system-wide install
  • Removed testing support for centos-6. Python 3.7.1 requires a newer version of openssl than centos-6 supplies.
  • Removed testing support for debian-8. Debian-8 is no longer supported. Also has issues with the level of openssl that is available.


  • Namespace the run_state variables used in the resources


  • Chef 16 removed defaults for checkout_branch from the git resource, restore them to the previous default 'deploy'


  • resolved cookstyle error: resources/pip.rb:107:7 convention: Style/RedundantReturn
  • resolved cookstyle error: resources/pip.rb:110:7 convention: Style/RedundantReturn
  • Migrate to actions for builds
  • Fix broken link in README
  • Follow up tweaks after ownership migration


  • Migrated ownership to Sous-Chefs
  • Latest cookstyle fixes (5.9.3)


  • invoke pip install only necessary #34


  • deprecate support for Chef 13 due to EOL
  • update cookbook to use apt_update and build_essential resources from Chef 14 make sure builds don't failed because of lack of packages


  • add support for virtualenv installation and uninstallation.
  • add support for passing environment variable during pyenv, python and plugin installation.
  • delete "reinstall" property from pip resource and replace it with general "options" property
  • make pyenv_script fail on any subcommand failure

Thanks to @ssps!


  • Dropping support for Chef 12


  • Refactor and update the legacy code base. Recipes are no longer provided, and custom resources are used to manage pyenv installations instead.
  • update system_install to be a resource
  • update user_install to be a resource
  • update script resource
  • update python resource
  • update global resource
  • update rehash resource
  • create plugin resource
  • create pip resource
  • update integration tests
  • add linting to CI
  • delete all recipes
  • delete matchers
  • delete chef_pyenv_recipe_helpers library
  • delete chef_pyenv_mixin library
  • add support for Fedora, RedHat distros and OpenSUSE


  • Add oracle linux support
  • Update syntax for chef-client v13
  • Update gems and dependencies
  • Add integration tests on travis


  • Updated deprecated methods used in attributes.rb


  • Update default pyenv version to v0.4.0-20140516
  • Add support for CentOS 6.5
  • Install make, build-essential, libssl-dev, zlib1g-dev, wget, curl, and llvm on Debian machines


Collaborator Number Metric

3.5.1 passed this metric

Contributing File Metric

3.5.1 passed this metric

Foodcritic Metric

3.5.1 passed this metric

No Binaries Metric

3.5.1 passed this metric

Testing File Metric

3.5.1 passed this metric

Version Tag Metric

3.5.1 passed this metric