installConda: Install (Mini)conda

View source: R/installConda.R

installCondaR Documentation

Install (Mini)conda

Description

Install conda - specifically Miniconda, though historically we used Anaconda - to an appropriate destination path, skipping the installation if said path already exists.

Usage

installConda(installed = TRUE)

Arguments

installed

Logical scalar indicating whether basilisk is already installed. Should only be set to FALSE in basilisk configure scripts.

Details

This function was originally created from code in https://github.com/hafen/rminiconda, also borrowing code from reticulate's install_miniconda for correct Windows installation. It downloads and runs a Miniconda installer to create a dedicated Conda instance that is managed by basilisk, separate from other instances that might be available on the system.

The installer itself is cached to avoid re-downloading it when, e.g., re-installing basilisk across separate R sessions. Users can obtain/delete the cached installer by looking at the contents of the parent directory of getExternalDir. This caching behavior is disabled for system installations (see useSystemDir), which touch nothing except the system directories; in such cases, only repeated installation attempts in the same R session will re-use the same installer.

Currently, we use version 4.12.0 of the Miniconda3 installer, which also comes with Python 3.9. Users can change this by setting the BASILISK_MINICONDA_VERSION environment variable, e.g., to "py38_4.11.0". Any change should be done with a great deal of caution, typically due to some system-specific problem with a particular Miniconda version. If it must be done, users should try to stick to the same Python version.

Value

A conda instance is created at the location specified by getCondaDir. Nothing is performed if a complete instance already exists at that location. A logical scalar is returned indicating whether a new instance was created.

Destruction of old instances

Whenever installConda is re-run and BASILISK_USE_SYSTEM_DIR is not set, any old conda instances and their associated basilisk environments are deleted from the external installation directory. This avoids duplication of large conda instances after their obselescence. Client packages are expected to recreate their environments in the latest conda instance.

Users can disable this destruction by setting the BASILISK_NO_DESTROY environment variable to "1". This may be necessary on rare occasions when running multiple R instances on the same Bioconductor release. Note that setting this variable is not required for R instances using different Bioconductor releases; the destruction process is smart enough to only remove conda instances generated from the same release.

Skipping the fallback R

When BASILISK_USE_SYSTEM_DIR is set, installConda will automatically create a conda environment with its own copy of R. This is used as the “last resort fallback” for running reticulate code in the presence of shared library incompatibilities with the main R installation. If users know that no incompatibilities exist in their application, they can set the BASILISK_NO_FALLBACK_R variable to "1". This will instruct installConda to skip the creation of the fallback environment, saving some time and disk space.

Author(s)

Aaron Lun

Examples

# We can't actually run installConda() here, as it 
# either relies on basilisk already being installed or
# it has a hard-coded path to the basilisk system dir.
print("dummy test to pass BiocCheck")


LTLA/basilisk.utils documentation built on May 3, 2024, 12:51 p.m.