R: Conda Tools

conda-tools {reticulate} | R Documentation

## Conda Tools

### Description

Tools for managing Python `conda` environments.

### Usage

    conda_list(conda = "auto")

    conda_create(
      envname = NULL,
      packages = NULL,
      ...,
      forge = TRUE,
      channel = character(),
      environment = NULL,
      conda = "auto",
      python_version = miniconda_python_version()
    )

    conda_clone(envname, ..., clone = "base", conda = "auto")

    conda_export(
      envname,
      file = if (json) "environment.json" else "environment.yml",
      json = FALSE,
      ...,
      conda = "auto"
    )

    conda_remove(envname, packages = NULL, conda = "auto")

    conda_install(
      envname = NULL,
      packages,
      forge = TRUE,
      channel = character(),
      pip = FALSE,
      pip_options = character(),
      pip_ignore_installed = FALSE,
      conda = "auto",
      python_version = NULL,
      ...
    )

    conda_binary(conda = "auto")

    conda_exe(conda = "auto")

    conda_version(conda = "auto")

    conda_update(conda = "auto")

    conda_python(envname = NULL, conda = "auto", all = FALSE)

### Arguments

`conda` | 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.
`envname` | The name of, or path to, a conda environment.
`packages` | A character vector, indicating package names which should be installed or removed. Use `python=<version>` to request the installation of a specific version of Python.
`...` | Optional arguments, reserved for future expansion.
`forge` | Boolean; include the conda-forge repository?
`channel` | An optional character vector of conda channels to include. When specified, the `forge` argument is ignored. If you need to specify multiple channels, including the conda forge, you can use `c("conda-forge", <other channels>)`.
`environment` | The path to an environment definition, generated via (for example) `conda_export()`, or via `conda env export`. When provided, the conda environment will be created using this environment definition, and other arguments will be ignored.
`python_version` | The version of Python to be installed. Set this if you'd like to change the version of Python associated with a particular conda environment.
`clone` | The name of the conda environment to be cloned.
`file` | The path where the conda environment definition will be written.
`json` | Boolean; should the environment definition be written as JSON? By default, conda exports environmentas as YAML.
`pip` | Boolean; use `pip` for package installation? By default, packages are installed from the active conda channels.
`pip_options` | An optional character vector of additional command line arguments to be passed to `pip`. Only relevant when `pip = TRUE`.
`pip_ignore_installed` | Ignore already-installed versions when using pip? (defaults to `FALSE`). Set this to `TRUE` so that specific package versions can be installed even if they are downgrades. The `FALSE` option is useful for situations where you don't want a pip install to attempt an overwrite of a conda binary package (e.g. SciPy on Windows which is very difficult to install via pip due to compilation requirements).
`all` | Boolean; report all instances of Python found?

### Value

`conda_list()` returns an R `data.frame`, with `name` giving the name of the associated environment, and `python` giving the path to the Python binary associated with that environment.

`conda_create()` returns the path to the Python binary associated with the newly-created conda environment.

`conda_clone()` returns the path to Python within the newly-created conda environment.

`conda_export()` returns the path to the exported environment definition, invisibly.

### Finding Conda

Most of `reticulate`'s conda APIs accept a `conda` parameter, used to control the `conda` binary used in their operation. When `conda = "auto"`, `reticulate` will attempt to automatically find a conda installation. The following locations are searched, in order:

1. The location specified by the `reticulate.conda_binary` R option,

2. The location specified by the `RETICULATE_CONDA` environment variable,

3. The `miniconda_path()` location (if it exists),

4. The program `PATH`,

5. A set of pre-defined locations where conda is typically installed.

To force `reticulate` to use a particular `conda` binary, we recommend setting:

    options(reticulate.conda_binary = "/path/to/conda")

This can be useful if your conda installation lives in a location that `reticulate` is unable to automatically discover.

[Package reticulate version 1.23 Index]