Use Python
Select the version of Python to be used by reticulate
.
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)
python |
The path to a Python binary. |
required |
Is the requested copy of Python required? If |
version |
The version of Python to use. |
virtualenv |
Either the name of, or the path to, a Python virtual environment. |
condaenv |
The name of the Conda environment to use. |
conda |
The path to a |
The 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.
The 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 .Renviron
)
can be a useful way of forcing reticulate
to use a particular version of
Python.
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 numpy
available,
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 use_python()
and friends only persist for the active session; they must be re-run in each
new R session as appropriate.
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.