install_greta_deps: Install Python dependencies for greta

View source: R/install_greta_deps.R

install_greta_depsR Documentation

Install Python dependencies for greta

Description

This is a helper function to install Python dependencies needed. By default these are TF 2.15.0, TFP 0.23.0, and Python 3.10. These Python modules will be installed into a conda environment named "greta-env-tf2".

Usage

install_greta_deps(
  deps = greta_deps_spec(),
  timeout = 5,
  restart = c("ask", "force", "no"),
  ...
)

reinstall_greta_deps(
  deps = greta_deps_spec(),
  timeout = 5,
  restart = c("ask", "force", "no")
)

Arguments

deps

object created with greta_deps_spec() where you specify python, TF, and TFP versions. By default these are TF 2.15.0, TFP 0.23.0, and Python 3.10. These versions must be compatible with each other. If they are not, greta_deps_spec() will error with more information and suggestions. See ?greta_deps_spec() for more information, and see the data object greta_deps_tf_tfp ('?greta_deps_tf_tfp“).

timeout

maximum time in minutes until the installation for each installation component times out and exits. Default is 5 minutes per installation component.

restart

character. Restart R after installation? Default is "ask". Other options are, "force", and "no". Using "force" will will force a restart after installation. Using "no" will not restart. Note that this only restarts R during interactive sessions, and only in RStudio.

...

Optional arguments, reserved for future expansion.

Details

You can specify an environment variable to write a logfile to a specific location with GRETA_INSTALLATION_LOG using Sys.setenv('GRETA_INSTALLATION_LOG'='path/to/logfile.html'). Or use greta_set_install_logfile() to set the path, e.g., greta_set_install_logfile('path/to/logfile.html'). By default it uses tools::R_user_dir("greta") as the directory to save a logfile named "greta-installation-logfile.html". To see installation notes or errors, after installation you can open the logfile with open_greta_install_log(), or you can navigate to the logfile and open it in a browser.

By default, if using RStudio, it will now ask you if you want to restart the R session. If the session is not interactive, or is not in RStudio, it will not restart. You can also override this with restart = TRUE.

Note

This will automatically install Miniconda (a minimal version of the Anaconda scientific software management system), create a 'conda' environment for greta named 'greta-env-tf2' with required python and python package versions, and forcibly switch over to using that conda environment.

If you don't want to use conda or the "greta-env-tf2" conda environment, you can install versions that you like, e.g., using reticulate::py_install(). If you want to see which versions of TF, TFP, and Python work with each other (at least according to information from tensorflows website), see the data greta_deps_tf_tfp, which is provided with greta. Managing your own installation is not always straightforward, so we recommend installing the python packages using install_greta_deps() for most users.

Examples

## Not run: 
install_greta_deps()

## End(Not run)
## Not run: 
# to help troubleshoot your greta installation, this can help resolve some
# issues with installing greta dependencies
reinstall_greta_deps()

## End(Not run)

greta-dev/greta documentation built on Dec. 21, 2024, 5:03 a.m.