diff --git a/README.md b/README.md index 359adbb5..4c655fa0 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ devtools::install_github("greta-dev/greta") The `install_greta_deps()` function helps install the Python dependencies (Google's [TensorFlow](https://www.tensorflow.org/) and [tensorflow-probability](https://github.com/tensorflow/probability)). -By default, `install_greta_deps()` installs versions TF 2.15.0, and TFP version 0.23.0, using python 3.10. To change the versions of TF, TFP, or python that you want to use, you specify the `python_deps` argument of `install_greta_deps()`, which used `greta_python_deps()`. See `?install_greta_deps()` or `?greta_python_deps()` for more information. +By default, `install_greta_deps()` installs versions TF 2.15.0, and TFP version 0.23.0, using python 3.10. To change the versions of TF, TFP, or python that you want to use, you specify the `deps` argument of `install_greta_deps()`, which used `greta_deps_spec()`. See `?install_greta_deps()` or `?greta_deps_spec()` for more information. This helper function, `install_greta_deps()`, installs the exact pythons package versions needed. It also places these inside a conda environment, "greta-env-tf2". This isolates these exact python modules from other python installations, so that only `greta` will see them. This helps avoids installation issues, where previously you might update tensorflow on your computer and overwrite the current version needed by `greta`. Using this "greta-env-tf2" conda environment means installing other python packages should not be impact the Python packages needed by `greta`. diff --git a/vignettes/installation.Rmd b/vignettes/installation.Rmd index 9993501c..6c29408f 100644 --- a/vignettes/installation.Rmd +++ b/vignettes/installation.Rmd @@ -44,11 +44,11 @@ We do this as it helps avoids installation issues, where previously you might up The `install_greta_deps()` function takes three arguments: -1. `python_deps`: Specify dependencies with `greta_python_deps()` +1. `deps`: Specify dependencies with `greta_deps_spec()` 2. `timeout`: time in minutes to wait in installation before failing/exiting 3. `restart`: whether to restart R ("force" - restart R, "no", will not restart, "ask" (default) - ask the user) -You specify the version of TF TFP, or python that you want to use with `greta_python_deps()`, which has arguments: +You specify the version of TF TFP, or python that you want to use with `greta_deps_spec()`, which has arguments: - `tf_version` - `tfp_version` @@ -58,96 +58,72 @@ If you specify versions of TF/TFP/Python that are not compatible with each other If you provide an invalid installation versions, it will error and suggest some alternative installation versions. -## How we install dependencies. +## How we install dependencies -We create a separate R instances using [`callr`]() to install python dependencies using `reticulate` to talk to Python, and the R package `tensorflow`, for installing the tensorflow python module. +This is for users who want to know more about the installation process of dependencies in greta. -## More Detail on how greta installs python dependencies +We create a separate R instance using [`callr`](https://callr.r-lib.org/index.html) to install python dependencies using `reticulate` to talk to Python, and the R package `tensorflow`, for installing the tensorflow python module. We use `callr` so that we can ensure the installation of python dependencies happens in a clean R session that doesn't have python or reticulate already loaded. -## Troubleshooting installation +If miniconda isn't installed, we install miniconda. You can think of miniconda as a lightweight version of python with minimal dependencies. -### Using reinstallers -### destroying dependencies -### manual installation +If "greta-tf2-env" isn't found, then we create a new conda environment named "greta-tf2-env", for a version of python that works with the specified versions of TF and TFP. -If the previous installation helper did not work, you can try the following: +Then we install the TF and TFP python modules, using the versions specified in `greta_deps_spec()`. -```{r install_tensorflow, eval = FALSE} -reticulate::install_miniconda() -reticulate::conda_create( - envname = "greta-env", - python_version = "3.7" - ) -reticulate::conda_install( - envname = "greta-env", - packages = c( - "numpy==1.16.4", - "tensorflow-probability==0.7.0", - "tensorflow==1.14.0" - ) - ) -``` +After installation, we ask users if they want to restart R. This only happens in interactive sessions, and only if the user is in RStudio. This is to avoid potential issues where this script might be used in batch scripts online. -Which will install the python modules into a conda environment named "greta-env". +## Troubleshooting installation -You can also not install these not into a special conda environment "greta-env", -like so: +Installation doesn't always go to plan. Sometimes -```{r install-deps-plain, eval = FALSE} -reticulate::install_miniconda() -reticulate::conda_install( - packages = c( - "numpy==1.16.4", - "tensorflow-probability==0.7.0", - "tensorflow==1.14.0" - ) - ) -``` +### Using a logfile - +We write a logfile -
+### Using reinstallers +You -# Morgue +### Destroying dependencies -#### Standard installation +### Manual installation If the previous installation helper did not work, you can try the following: ```{r install_tensorflow, eval = FALSE} reticulate::install_miniconda() reticulate::conda_create( - envname = "greta-env", - python_version = "3.7" + envname = "greta-env-tf2", + python_version = "3.10" ) reticulate::conda_install( - envname = "greta-env", + envname = "greta-env-tf2", packages = c( - "numpy==1.16.4", - "tensorflow-probability==0.7.0", - "tensorflow==1.14.0" + "tensorflow-probability==0.23.0", + "tensorflow==2.15.0" ) ) ``` -Which will install the python modules into a conda environment named "greta-env". +Which will install the python modules into a conda environment named "greta-env-tf2". -You can also not install these not into a special conda environment "greta-env", -like so: +You can also not install these not into a special conda environment like so: ```{r install-deps-plain, eval = FALSE} reticulate::install_miniconda() reticulate::conda_install( packages = c( - "numpy==1.16.4", - "tensorflow-probability==0.7.0", - "tensorflow==1.14.0" + "tensorflow-probability==0.23.0", + "tensorflow==2.15.0" ) ) ``` +
+ + +