R functions for managing Python virtual environments.


  envname = NULL,
  python = NULL,
  packages = "numpy",
  system_site_packages = getOption("reticulate.virtualenv.system_site_packages",
    default = FALSE)

  envname = NULL,
  ignore_installed = FALSE,
  pip_options = character(),

virtualenv_remove(envname = NULL, packages = NULL, confirm = interactive())


virtualenv_python(envname = NULL)



The name of, or path to, a Python virtual environment. If this name contains any slashes, the name will be interpreted as a path; if the name does not contain slashes, it will be treated as a virtual environment within virtualenv_root(). When NULL, the virtual environment as specified by the RETICULATE_PYTHON_ENV environment variable will be used instead.


The path to a Python interpreter, to be used with the created virtual environment. When NULL, the Python interpreter associated with the current session will be used.


A set of Python packages to install (via pip install) into the virtual environment, after it has been created. By default, the "numpy" package will be installed, and the pip, setuptools and wheel packages will be updated. Set this to FALSE to avoid installing any packages after the virtual environment has been created.


Boolean; create new virtual environments with the --system-site-packages flag, thereby allowing those virtual environments to access the system's site packages. Defaults to FALSE.


Boolean; ignore previously-installed versions of the requested packages? (This should normally be TRUE, so that pre-installed packages available in the site libraries are ignored and hence packages are installed into the virtual environment.)


An optional character vector of additional command line arguments to be passed to pip.


Optional arguments; currently ignored for future expansion.


Boolean; confirm before removing packages or virtual environments?


Virtual environments are by default located at ~/.virtualenvs (accessed with the virtualenv_root function). You can change the default location by defining defining the WORKON_HOME environment variable.

Virtual environment functions are not supported on Windows (the use of conda environments is recommended on Windows).