spaCy/website/docs/_quickstart-install.jade

123 lines
4.8 KiB
Plaintext
Raw Normal View History

2016-10-03 21:19:13 +03:00
//- ----------------------------------
//- 💫 QUICKSTART > GETTING STARTED
//- ----------------------------------
2016-03-31 17:24:48 +03:00
2016-10-03 21:19:13 +03:00
+section("getting-started")
+h(2, "getting-started")
| Getting started
2016-03-31 17:24:48 +03:00
2016-10-03 21:19:13 +03:00
+section("install-spacy")
+h(3, "install-spacy")
| Install spaCy
2016-03-31 17:24:48 +03:00
p.
2016-10-03 21:19:13 +03:00
spaCy is compatible with 64-bit CPython 2.6+/3.3+ and runs on Unix/Linux,
2016-10-21 01:59:07 +03:00
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],
2016-10-03 21:19:13 +03:00
#[a(href="/docs#install-source-osx") OS X] and
#[a(href="/docs#install-source-windows") Windows] for details.
+code("bash", "pip").
2016-10-21 01:59:07 +03:00
pip install -U spacy
2016-03-31 17:24:48 +03:00
p.
2016-10-21 01:59:07 +03:00
After installation you need to download a language model. Models for English (#[code en]) and German (#[code de]) are available.
2016-03-31 17:24:48 +03:00
2016-10-03 21:19:13 +03:00
+code("bash").
2016-10-21 01:59:07 +03:00
# 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
2016-10-03 21:19:13 +03:00
python -c "import spacy; spacy.load('en'); print('OK')"
2016-03-31 17:24:48 +03:00
p.
2016-10-21 01:59:07 +03:00
The download command fetches and installs about 1 GB of data which it installs
2016-10-03 21:19:13 +03:00
within the #[code spacy] package directory.
2016-03-31 17:24:48 +03:00
2016-10-03 21:19:13 +03:00
+section("install-source")
+h(3, "install-source")
2016-03-31 17:24:48 +03:00
| Compile from source
p.
2016-10-03 21:19:13 +03:00
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.
2016-03-31 17:24:48 +03:00
2016-10-03 21:19:13 +03:00
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
2016-03-31 17:24:48 +03:00
git clone https://github.com/spacy-io/spaCy.git
2016-10-03 21:19:13 +03:00
2016-03-31 17:24:48 +03:00
cd spaCy
virtualenv .env && source .env/bin/activate
pip install -r requirements.txt
pip install -e .
p.
2016-10-03 21:19:13 +03:00
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
2016-03-31 17:24:48 +03:00
2016-10-03 21:19:13 +03:00
+h(4, "install-source-osx")
| OS X
2016-03-31 17:24:48 +03:00
p.
2016-10-03 21:19:13 +03:00
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