Skip to contents

Checks, without starting Python, whether spaCy (and optionally one or more language models) is installed in the environment that spacy_initialize() will use: the one set by RETICULATE_PYTHON if set, or otherwise the virtual environment named by SPACY_PYTHON (by default "r-spacyr"). This is useful, for instance, to skip examples or tests when spaCy is not available. If a different interpreter is already running in the R session and prevents use of the named virtual environment, returns FALSE.

Usage

spacy_is_installed(lang_models = NULL)

Arguments

lang_models

character; names of language models that must also be installed, e.g. "en_core_web_sm". If NULL (the default), only spaCy itself is checked.

Value

TRUE if spaCy and all lang_models are installed, FALSE otherwise.

Examples

spacy_is_installed()
#> [1] TRUE
spacy_is_installed("en_core_web_sm")
#> [1] TRUE