Skip to contents

install_metaflow() installs the Metaflow Python package and its direct dependencies from PyPI using pip. This function provides a convenient way to set up Metaflow within an R environment.

Usage

install_metaflow(
  method = c("virtualenv", "conda", "auto"),
  conda = "auto",
  version = "default",
  envname = "r-metaflow",
  extra_packages = NULL,
  restart_session = TRUE,
  python_version = NULL,
  new_env = TRUE,
  ...
)

Arguments

method

Installation method. Can be "auto", "virtualenv", or "conda". This affects the type of environment created, but Metaflow will always be installed via pip.

conda

Path to conda executable (only applicable if method = "conda")

version

Metaflow version to install. Use "default" for the latest version, or specify a version like "2.12.23" or "2.11.6".

envname

Name of the virtual/conda environment to install packages into. Default is "r-metaflow".

extra_packages

Additional Python packages to install along with Metaflow

restart_session

Restart R session after installing (only in RStudio)

python_version

Python version to use. Must be >= 3.8.

new_env

Whether to create a new environment or use an existing one

...

Additional arguments passed to reticulate installation functions

Value

This function returns NULL invisibly. The primary side effect is the installation of Metaflow and its dependencies in the specified environment.

Details

This function installs Metaflow from PyPI using pip, regardless of whether a virtualenv or Conda environment is used. If a Conda environment is specified, the function will create a Conda environment but still use pip to install Metaflow within that environment.

The function performs several checks and steps:

  • Verifies that the system is not Windows (not supported)

  • Checks and sets the appropriate Python version

  • Prepares the installation environment (new or existing)

  • Installs Metaflow and any additional specified packages

See also

reticulate package for R interface to Python

Examples

if (FALSE) { # \dontrun{
install_metaflow()
install_metaflow(method = "conda", version = "2.3.0")
} # }