Downloads the micromamba binary that condathis uses and installs it
in the condathis data directory, at the path that
micromamba_bin_path() returns. The functions that need micromamba call
it when no usable binary is found (see micromamba discovery in
condathis-options). You need to call it only to choose the version, or
to install micromamba ahead of time.
Usage
install_micromamba(
micromamba_version = "2.10.0-0",
timeout = 3600,
download_method = "auto",
force = FALSE,
verbose = c("output", "silent", "cmd", "spinner", "full"),
timeout_limit = NULL
)Arguments
- micromamba_version
Character string with the micromamba version, in the format
"X.Y.Z-N"(version and build number), for example"2.10.0-0", the default. Another format aborts with classcondathis_install_micromamba_invalid_micromamba_version. Versions older than 2.8.1 abort with classcondathis_install_micromamba_unsupported_version, becausecondathisdoes not use them. When you passmicromamba_versionand a binary is already installed,install_micromamba()keeps the binary only when its version (X.Y.Z) is the requested one. When it reports another version, or its version cannot be read,install_micromamba()installs the requested version. Withoutmicromamba_version, it always keeps an installed binary, unlessforce = TRUE.- timeout
Numeric download timeout in seconds, a single non-negative number.
Infmeans no limit. Defaults to3600. Each download uses the larger of this value andgetOption("timeout"), so0means no limit only whengetOption("timeout")is0too. The function lowers values above 2147483 seconds (about 24.8 days) to 2147483. Other values abort with classcondathis_install_micromamba_invalid_timeout.- download_method
Character string with the download method of
utils::download.file(): one of"auto"(the default),"internal","libcurl","wget","curl"or"wininet". It is ignored when thecurlpackage 5.0.0 or later is installed, because thencurl::curl_download()is used. Other values abort with classcondathis_install_micromamba_invalid_download_method.- force
Logical value.
TRUEdownloads micromamba also when a binary is already installed. Defaults toFALSE. A value that is notTRUEorFALSEaborts with classcondathis_install_micromamba_invalid_force.- verbose
Character string that controls the console output. One of:
"output": show the output of the command and the messages of condathis."silent": show nothing."cmd": show the command line."spinner": show only a spinner."full": show the command line, the output, and the backend's own log.
TRUEmeans"output"andFALSEmeans"silent". Every level except"silent"shows a spinner in interactive sessions. Invalid values abort with classcondathis_invalid_verbose(see condathis-conditions). The default is shown in Usage.The command line shown, the
cmdof a result and the messages ofcondathisshow the password and the token of a URL as*****.micromambadoes the same (https://user:*****@host/channel,https://host/t/*****/channel). The command still gets them.- timeout_limit
Deprecated. Use
timeout. A value warns with classcondathis_deprecated_argand is used astimeout. Passing both aborts with classcondathis_install_micromamba_conflicting_args.
Value
The path of the micromamba binary, an fs_path, invisibly: the
path that micromamba_bin_path() returns. A failed download aborts
with class condathis_install_micromamba_download_failed.
Details
The binary is the build for the platform of the running R (see
get_sys_arch()): linux-64, linux-aarch64, linux-ppc64le,
osx-64, osx-arm64, win-64 or win-arm64. A native ARM64 R on
Windows gets win-arm64. An x64 R on an ARM64 PC gets win-64, which
runs through x64 emulation. Every R of a user shares the installed
binary. So on an ARM64 PC, the binary installed first stays until you
replace it, for example with force = TRUE. Either binary works with
both builds of R: micromamba builds environments for its own platform.
install_micromamba() tries the compressed archive first, from the
micromamba releases on GitHub, then from the conda-forge channel on
anaconda.org and prefix.dev. It extracts the archive with R's internal
tar, so no system tar or bzip2 is needed. When every archive
fails, it downloads the standalone binary from GitHub. A mirror fails
when the download fails, or when the file does not extract, does not
run, or does not match the SHA256 checksum published with the release.
Then it tries the next mirror. It replaces an installed binary only with
a download that passed these checks, also with force = TRUE.
When no published checksum can be read, install_micromamba() installs
the binary. It warns with class
condathis_install_micromamba_checksum_unavailable when verbose is
"output" or "full". A checksum that does not match warns with class
condathis_install_micromamba_checksum_mismatch, and that binary is not
installed.
See also
Other setup:
clean_cache(),
get_install_dir(),
get_sys_arch(),
micromamba_bin_path(),
with_sandbox_dir()
Examples
if (FALSE) { # \dontrun{
condathis::with_sandbox_dir({
# Install the default version of micromamba
condathis::install_micromamba()
# Install a specific version (2.8.1 or newer): it replaces a binary of
# another version
condathis::install_micromamba(micromamba_version = "2.9.0-0")
# Without `micromamba_version`, the installed binary is kept unless
# `force = TRUE`
condathis::install_micromamba(force = TRUE)
})
} # }