Install spaCy

spaCy is compatible with 64-bit CPython 2.6+∕3.3+ and runs on Unix/Linux, macOS/OS X and Windows. The latest spaCy releases are currently only available as source packages over pip. Installation requires a working build environment. See notes on Ubuntu, macOS/OS X and Windows for details.

pip install -U spacy

After installation you need to download a language model. Models for English (en) and German (de) are available.

python -m all
python -m all

The download command fetches about 1 GB of data which it installs within the spacy package directory.

Compile from source

The other way to install spaCy is to clone its GitHub repository and build it from source. That is the common way if you want to make changes to the code base.

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 Ubuntu, OS X and Windows for details.


Install system-level dependencies via apt-get:

sudo apt-get install build-essential python-dev git

macOS / OS X

Install a recent version of XCode, including the so-called "Command Line Tools". macOS and OS X ship with Python and git preinstalled.

To compile spaCy with multi-threading support on macOS / OS X, see here.


Install a version of Visual Studio Express that matches the version that was used to compile your Python interpreter. For official distributions these are:

Python 2.7Visual Studio 2008
Python 3.4Visual Studio 2010
Python 3.5Visual Studio 2015

Run tests

spaCy comes with an extensive test suite. First, find out where spaCy is installed:

python -c "import os; import spacy; print(os.path.dirname(spacy.__file__))"

Then run pytest on that directory. The flags --vectors, --slow and --model are optional and enable additional tests:

# make sure you are using recent pytest version
python -m pip install -U pytest

python -m pytest <spacy-directory> --vectors --model --slow

Download model to custom location

You can specify where and download the language model to using the --data-path or -d argument:

python -m all --data-path /some/dir

If you choose to download to a custom location, you will need to tell spaCy where to load the model from in order to use it. You can do this either by calling spacy.util.set_data_path() before calling spacy.load(), or by passing a path argument to the spacy.en.English or constructors.

Read next: Lightning tour