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 available over pip (source packages only) and conda. Installation requires a working build environment. See notes on Ubuntu, macOS/OS X and Windows for details.
python -m pip install -U virtualenvpython -m pip install -U venvvirtualenv .envvenv .envsource .env/bin/activatesource .env/bin/activate.env\Scripts\activatepip install -U spacyconda config --add channels conda-forgeconda install spacygit clone https://github.com/explosion/spaCycd spaCypip install -r requirements.txtpip install -e .python -m spacy download enpython -m spacy download depython -m spacy download frpython -m spacy download es
Using pip, spaCy releases are currently only available as source packages.
pip install -U spacy
When using pip it is generally recommended to install packages in a
virtualenv to avoid modifying system state:
virtualenv .env source .env/bin/activate pip install spacy
Thanks to our great community, we've finally re-added conda support. You can now install spaCy via
conda config --add channels conda-forge conda install spacy
For the feedstock including the build recipe and configuration, check out this repository. Improvements and pull requests to the recipe and setup are always appreciated.
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.
# make sure you are using recent pip/virtualenv versions python -m pip install -U pip virtualenv git clone https://github.com/explosion/spaCy cd spaCy virtualenv .env source .env/bin/activate pip install -r requirements.txt pip install -e .
Compared to regular install via pip, requirements.txt additionally installs developer dependencies such as Cython.
Instead of the above verbose commands, you can also use the following Fabric commands:
|Compile the source.|
|Remove compiled objects, including the generated C++.|
|Run basic tests, aborting after first failure.|
All commands assume that your
virtualenv is located in a directory
.env. If you're using a different directory, you can change it via the environment variable
VENV_DIR, for example:
VENV_DIR=".custom-env" fab clean make
Install system-level dependencies via
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.7||Visual Studio 2008|
|Python 3.4||Visual Studio 2010|
|Python 3.5+||Visual Studio 2015|
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__))"
pytest on that directory. The flags
--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 --models --slow