This function runs a command in a chosen conda environment.
The system command to be invoked, as a character string.
A character vector of arguments to the command. The arguments should
be quoted e.g. by shQuote()
in case they contain space or other special
characters (a double quote or backslash on Windows, shell-specific special
characters on Unix).
The path to a conda
executable. Use "auto"
to allow
reticulate
to automatically find an appropriate conda
binary.
See Finding Conda and conda_binary()
for more details.
The name of, or path to, a conda environment.
The command line to be executed, as a character string. This
is automatically generated from cmd
and args
, but can be provided
directly if needed (if provided, it overrides cmd
and args
).
A logical (not NA
) which indicates whether to capture the
output of the command as an R character vector. If FALSE
(the default), the
return value is the error code (0
for success).
A logical (not NA
) which indicates whether to echo the command to
the console before running it.
conda_run2()
runs a command in the desired conda environment. If
intern = TRUE
the output is returned as a character vector; if intern = FALSE
(the
deafult), then the return value is the error code (0 for success). See
shell()
(on windows) or system2()
on macOS or Linux for more details.
Note that, whilst the syntax is similar to system2()
, the function
dynamically generates a shell script with commands to activate the chosen
conda environent. This avoids issues with quoting, as discussed in this
GitHub issue.