Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

conda-tools

Interface to conda


Description

R functions for managing Python conda environments.

Usage

conda_list(conda = "auto")

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

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_version(conda = "auto")

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

Arguments

conda

The path to a conda executable. Use "auto" to allow reticulate to automatically find an appropriate conda binary. See Finding Conda 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.

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>).

python_version

The version of Python to be used in this Conda environment. The associated Python package from Conda will be requested as python={python_version}. When NULL, the default python package will be used instead. For example, use python_version = "3.6" to request that the Conda environment be created with a copy of Python 3.6. This argument will be ignored if python is specified as part of the packages argument, for backwards compatibility.

pip

Boolean; use pip when downloading or installing packages? Defaults to FALSE.

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 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).

...

Optional arguments, reserved for future expansion.

Value

conda_list() returns a data frame with the names and paths to the respective python binaries of available environments. conda_create() returns the path to the python binary of the created environment. conda_binary() returns the location of the main conda binary or NULL if none can be found.

Finding Conda

When conda = "auto", reticulate will attempt to automatically find an Anaconda / Miniconda installation and use that. reticulate will search the following locations:

  1. The location specified by the reticulate.conda_binary R option;

  2. The miniconda_path() location (if it exists);

  3. The program PATH;

  4. A set of pre-defined locations where Conda is typically installed.


reticulate

Interface to 'Python'

v1.20
Apache License 2.0
Authors
Kevin Ushey [aut, cre], JJ Allaire [aut], RStudio [cph, fnd], Yuan Tang [aut, cph] (<https://orcid.org/0000-0001-5243-233X>), Dirk Eddelbuettel [ctb, cph], Bryan Lewis [ctb, cph], Sigrid Keydana [ctb], Ryan Hafen [ctb, cph], Marcus Geelnard [ctb, cph] (TinyThread library, http://tinythreadpp.bitsnbites.eu/)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.