Install spaCy in a self-contained environment, including specified language models.
spacy_install(
version = "latest",
lang_models = "en_core_web_sm",
ask = interactive(),
force = FALSE,
...
)
character; spaCy version to install (see details).
character; language models to be installed. Defaults
en_core_web_sm
(English model). A vector of multiple model names can
be used (e.g. c("en_core_web_sm", "de_core_news_sm")
). A list of
available language models and their
names is available from the spaCy language models page.
logical; ask whether to proceed during the installation. By default, questions are only asked in interactive sessions.
ignore if spaCy/the lang_models is already present and install it anyway.
not used.
The function checks whether a suitable installation of Python is
present on the system and installs one via
reticulate::install_python()
otherwise. It then creates a
virtual environment with the necessary packages in the default location
chosen by reticulate::virtualenv_root()
.
If you want to install a different version of Python than the default, you
should call reticulate::install_python()
directly. If you want
to create or use a different virtual environment, you can use, e.g.,
Sys.setenv(SPACY_PYTHON = "path/to/directory")
.
if (FALSE) {
# install the latest version of spaCy
spacy_install()
# update spaCy
spacy_install(force = TRUE)
# install an older version
spacy_install(version = "3.1.0")
# install with GPU enabled
spacy_install(version = "cuda-autodetect")
# install on Apple ARM processors
spacy_install(version = "apple")
# install an old custom version
spacy_install(version = "[cuda-autodetect]==3.2.0")
# install several models with spaCy
spacy_install(lang_models = c("en_core_web_sm", "de_core_news_sm"))
# install spaCy to an existing virtual environment
Sys.setenv(RETICULATE_PYTHON = "path/to/python")
spacy_install()
}