Skip to contents

Introduction

This vignette guides you through the process of installing Metaflow using the R package. Metaflow is a Python library, but this R package provides a convenient way to install and use Metaflow within an R environment.

Prerequisites

Before installing Metaflow, ensure you have:

  1. R (version 3.6 or later)
  2. Python (version 3.7 or later)

Basic Installation

To install the latest version of Metaflow, use the install_metaflow() function:

This will install Metaflow in a virtual environment named “r-metaflow”.

Customizing the Installation

Specifying a Version

You can install a specific version of Metaflow:

install_metaflow(version = "2.7.3")

Using Conda

To use Conda for installation:

install_metaflow(method = "conda")

You can specify the Conda executable path if needed:

install_metaflow(method = "conda", conda = "/path/to/conda")

Using pip

By default, install_metaflow() uses pip. You can make this explicit:

install_metaflow(method = "virtualenv")

Custom Environment Name

Specify a custom environment name:

install_metaflow(envname = "my-metaflow-env")

Additional Packages

Install additional Python packages along with Metaflow:

install_metaflow(extra_packages = c("pandas", "numpy"))

Specifying Python Version

Choose a specific Python version:

install_metaflow(python_version = "3.8")

Using Existing Python Environments

Instead of creating a new environment, you can use an existing Python installation by setting environment variables:

Use METAFLOW_PYTHON: Set this to the path of your Python executable to use a specific Python installation for Metaflow.

Sys.setenv(METAFLOW_PYTHON = "/path/to/python")

After setting either of these variables, you can use Metaflow without running install_metaflow().

Verifying the Installation

After installation, verify that Metaflow is correctly installed:

This should print the installed version of Metaflow.

Troubleshooting

If you encounter issues during installation:

  1. Ensure you have the required Python version installed.
  2. Check that you have write permissions in the installation directory.
  3. If using Conda, make sure Conda is properly set up in your system.

For more detailed information, refer to the install_metaflow() function documentation:

?install_metaflow

Conclusion

You should now have Metaflow installed and ready to use in your R environment. For more information on using Metaflow, refer to other vignettes in this package or the official Metaflow documentation.