Learn R Programming

spacyr (version 1.2.1)

spacy_install: Install spaCy in conda or virtualenv environment

Description

Install spaCy in a self-contained environment, including specified language models. For macOS and Linux-based systems, this will also install Python itself via a "miniconda" environment, for spacy_install. Alternatively, an existing conda installation may be used, by specifying its path. The default setting of "auto" will locate and use an existing installation automatically, or download and install one if none exists.

For Windows, automatic installation of miniconda installation is not currently available, so the user will need to miniconda (or Anaconda) manually.

If you wish to install Python ion a "virtualenv", use the spacy_install_virtualenv function.

Usage

spacy_install(
  conda = "auto",
  version = "latest",
  lang_models = "en_core_web_sm",
  python_version = "3.6",
  envname = "spacy_condaenv",
  pip = FALSE,
  python_path = NULL,
  prompt = TRUE
)

spacy_install_virtualenv( version = "latest", lang_models = "en_core_web_sm", python_version = "3.6", python_path = NULL, prompt = TRUE )

Arguments

conda

character; path to conda executable. Default "auto" which automatically find the path

version

character; spaCy version to install. Specify "latest" to install the latest release, or "latest_v1" to install the latest release of spaCy v1.*. See spaCy Version Issues.

You can also provide a full major.minor.patch specification (e.g. "1.1.0")

lang_models

character; language models to be installed. Default 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.

python_version

character; determine Python version for condaenv installation. 3.5 and 3.6 are available.

envname

character; name of the conda-environment to install spaCy. Default is "spacy_condaenv".

pip

TRUE to use pip for installing spacy. If FALSE, conda package manager with conda-forge channel will be used for installing spacy.

python_path

character; path to Python in virtualenv installation

prompt

logical; ask whether to proceed during the installation

spaCy Version Issues

The version options currently default to the latest spaCy v2 (version = "latest"). As of 2018-04, however, some performance issues affect the speed of the spaCy pipeline for spaCy v2.x relative to v1.x. This can enormously affect the performance of spacy_parse(), especially when a large number of small texts are parsed. For this reason, the spacyr provides an option to automatically install the latest version of spaCy v1.*, using version = "latest_v1".

Examples

Run this code
if (FALSE) {
# install spaCy in a miniconda environment (macOS and Linux)
spacy_install(lang_models = c("en_core_web_sm", "de_core_news_sm"), prompt = FALSE)

# install spaCy to an existing conda environment
spacy_install(conda = "~/anaconda/bin/")
}

if (FALSE) {
# install spaCy in a virtualenv environment
spacy_install_virtualenv(lang_models = c("en_core_web_sm"))
}

Run the code above in your browser using DataLab