spaCy/website/docs/_quickstart-install.jade

123 lines
4.8 KiB
Plaintext

//- ----------------------------------
//- 💫 QUICKSTART > GETTING STARTED
//- ----------------------------------
+section("getting-started")
+h(2, "getting-started")
| Getting started
+section("install-spacy")
+h(3, "install-spacy")
| Install spaCy
p.
spaCy is compatible with 64-bit CPython 2.6+/3.3+ and runs on Unix/Linux,
OS X and Windows. The latest spaCy releases are currently only available as source packages over #[+a("https://pypy.python.org/pypi/spacy") pip]. Installaton requires a working build environment. See notes on #[a(href="/docs#install-source-ubuntu") Ubuntu],
#[a(href="/docs#install-source-osx") OS X] and
#[a(href="/docs#install-source-windows") Windows] for details.
+code("bash", "pip").
pip install -U spacy
p.
After installation you need to download a language model. Models for English (#[code en]) and German (#[code de]) are available.
+code("bash").
# English:
# - Install tagger, parser, NER and GloVe vectors:
python -m spacy.en.download all
# - OR install English tagger, parser and NER
python -m spacy.en.download parser
# - OR install English GloVe vectors
python -m spacy.en.download glove
# German:
# - Install German tagger, parser, NER and word vectors
python -m spacy.de.download all
# Upgrade/overwrite existing data
python -m spacy.en.download --force
# Check whether the model was successfully installed
python -c "import spacy; spacy.load('en'); print('OK')"
p.
The download command fetches and installs about 1 GB of data which it installs
within the #[code spacy] package directory.
+section("install-source")
+h(3, "install-source")
| Compile from source
p.
The other way to install spaCy is to clone its
#[a(href="https://github.com/spacy-io/spaCy") GitHub repository] and
build it from source. That is the common way if you want to make changes
to the code base.
p.
You'll need to make sure that you have a development enviroment consisting
of a Python distribution including header files, a compiler, pip,
virtualenv and git installed. The compiler
part is the trickiest. How to do that depends on your system. See
notes on #[a(href="/docs#install-source-ubuntu") Ubuntu],
#[a(href="/docs#install-source-osx") OS X] and
#[a(href="/docs#install-source-windows") Windows] for details.
+code("bash").
# make sure you are using recent pip/virtualenv versions
python -m pip install -U pip virtualenv
# find git install instructions at https://git-scm.com/downloads
git clone https://github.com/spacy-io/spaCy.git
cd spaCy
virtualenv .env && source .env/bin/activate
pip install -r requirements.txt
pip install -e .
p.
Compared to regular install via #[code pip] and #[code conda]
#[+a("https://github.com/" + SOCIAL.github + "/spaCy/blob/master/requirements.txt") requirements.txt]
additionally installs developer dependencies such as #[code cython].
+h(4, "install-source-ubuntu")
| Ubuntu
p Install system-level dependencies via #[code apt-get]:
+code("bash").
sudo apt-get install build-essential python-dev git
+h(4, "install-source-osx")
| OS X
p.
Install a recent version of XCode, including the so-called "Command Line Tools". OS X
ships with Python and git preinstalled.
+h(4, "install-source-windows")
| Windows
p.
Install a version of Visual Studio Express or higher that matches the version that was
used to compile your Python interpreter. For official distributions
these are VS 2008 (Python 2.7), VS 2010 (Python 3.4) and VS 2015 (Python 3.5).
+section("run-tests")
+h(3, "run-tests")
| Run tests
p.
spaCy comes with an extensive test suite. First, find out where spaCy is installed:
+code("bash").
python -c "import os; import spacy; print(os.path.dirname(spacy.__file__))"
p.
Then run #[code pytest] on that directory. The flags #[code --vectors],
#[code --slow] and #[code --model] are optional and enable additional tests:
+code("bash").
# make sure you are using recent pytest version
python -m pip install -U pytest
python -m pytest <spacy-directory> --vectors --model --slow