This helper bootstraps a Conda environment (named "multimod" by default)
using the reticulate toolkit. It
ensures reticulate::install_miniconda() has been invoked (unless disabled),
creates the target environment when missing, installs the requested Python
packages, and activates the environment for the current R session via
reticulate::use_condaenv().
Usage
setup_python_environment(
env_name = "multimod",
packages = c("pyomo", "highspy"),
python_version = NULL,
ensure_miniconda = TRUE,
reinstall = FALSE,
pip = TRUE,
...
)
setup_multimod_python(
env_name = "multimod",
packages = c("pyomo", "highspy"),
python_version = NULL,
ensure_miniconda = TRUE,
reinstall = FALSE,
pip = TRUE,
...
)Arguments
- env_name
Name of the Conda environment to manage. Defaults to "multimod" so the generated Pyomo artifacts have a predictable runtime.
- packages
Character vector of Python packages to install once the environment exists. Defaults to both
"pyomo"and"highspy"so a usable solver backend is available immediately. Set toNULLorcharacter(0)to skip installation.- python_version
Optional Python version spec passed to
reticulate::conda_create(). IfNULL, reticulate's default is used.- ensure_miniconda
Logical flag controlling whether
reticulate::install_miniconda()should run when no Conda binary is detected on the system. Defaults toTRUEto minimize user setup.- reinstall
Logical flag; when
TRUEthe environment is recreated even if it already exists. Defaults toFALSEto preserve prior installs.- pip
Logical; when
TRUE(default) packages are installed viapipinside the Conda environment (ensureshighspyis available). Set toFALSEto install via conda instead.- ...
Additional arguments forwarded to
reticulate::install_miniconda()whenensure_miniconda = TRUE.
Details
After setup, you can optionally configure multimod to use this environment
via set_multimod_python() or by letting get_multimod_python() detect it
automatically through reticulate.
