View source: R/spacy_install.R
spacy_install | R Documentation |
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,
...
)
version |
character; spaCy version to install (see details). |
lang_models |
character; language models to be installed. Defaults
|
ask |
logical; ask whether to proceed during the installation. By default, questions are only asked in interactive sessions. |
force |
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")
.
spacy_download_langmodel()
## Not run:
# 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()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.