Select the version of Python to be used by
use_python(python, required = FALSE) use_python_version(version, required = FALSE) use_virtualenv(virtualenv = NULL, required = FALSE) use_condaenv(condaenv = NULL, conda = "auto", required = FALSE) use_miniconda(condaenv = NULL, required = FALSE)
The path to a Python binary.
Is the requested copy of Python required? If
The version of Python to use.
Either the name of, or the path to, a Python virtual environment.
The name of the Conda environment to use.
The path to a
reticulate package initializes its Python bindings lazily -- that is,
it does not initialize its Python bindings until an API that explicitly
requires Python to be loaded is called. This allows users and package authors
to request particular versions of Python by calling
use_python() or one of
the other helper functions documented in this help file.
RETICULATE_PYTHON environment variable can also be used to control
which copy of Python
reticulate chooses to bind to. It should be set to
the path to a Python interpreter, and that interpreter can either be:
A standalone system interpreter,
Part of a virtual environment,
Part of a Conda environment.
When set, this will override any other requests to use a particular copy of
Python. Setting this in
~/.Renviron (or optionally, a project
can be a useful way of forcing
reticulate to use a particular version of
By default, requests are advisory, and may be ignored for a number of reasons:
The requested copy of Python cannot be initialized,
The requested copy of Python does not have an installation of
Another call to
use_python() has requested a different version of Python,
The request has been overridden via
use_python(..., required = TRUE).
In general, if you explicitly want to use a particular version of Python, it
is recommended to set
required = TRUE, or explicitly set the
RETICULATE_PYTHON environment variable.
Note that the requests for a particular version of Python via
and friends only persist for the active session; they must be re-run in each
new R session as appropriate.