mirror of https://github.com/explosion/spaCy.git
Merge pull request #6391 from adrianeboyd/docs/install-guide
This commit is contained in:
commit
d8e01ca931
|
@ -158,29 +158,37 @@ The other way to install spaCy is to clone its
|
||||||
source. That is the common way if you want to make changes to the code base.
|
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 environment consisting of a
|
You'll need to make sure that you have a development environment consisting of a
|
||||||
Python distribution including header files, a compiler,
|
Python distribution including header files, a compiler,
|
||||||
[pip](https://pip.pypa.io/en/latest/installing/),
|
[pip](https://pip.pypa.io/en/stable/) and [git](https://git-scm.com) installed.
|
||||||
[virtualenv](https://virtualenv.pypa.io/) and [git](https://git-scm.com)
|
The compiler part is the trickiest. How to do that depends on your system. See
|
||||||
installed. The compiler part is the trickiest. How to do that depends on your
|
notes on [Ubuntu](#source-ubuntu), [macOS / OS X](#source-osx) and
|
||||||
system. See notes on [Ubuntu](#source-ubuntu), [macOS / OS X](#source-osx) and
|
|
||||||
[Windows](#source-windows) for details.
|
[Windows](#source-windows) for details.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ python -m pip install -U pip # update pip
|
$ python -m pip install -U pip setuptools wheel # install/update build tools
|
||||||
$ git clone https://github.com/explosion/spaCy # clone spaCy
|
$ git clone https://github.com/explosion/spaCy # clone spaCy
|
||||||
$ cd spaCy # navigate into dir
|
$ cd spaCy # navigate into dir
|
||||||
|
|
||||||
$ python -m venv .env # create environment in .env
|
$ python -m venv .env # create environment in .env
|
||||||
$ source .env/bin/activate # activate virtual env
|
$ source .env/bin/activate # activate virtual env
|
||||||
$ export PYTHONPATH=`pwd` # set Python path to spaCy dir
|
$ pip install . # compile and install spaCy
|
||||||
$ pip install -r requirements.txt # install all requirements
|
|
||||||
$ python setup.py build_ext --inplace # compile spaCy
|
|
||||||
$ python setup.py install # install spaCy
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Compared to regular install via pip, the
|
To install with extras:
|
||||||
[`requirements.txt`](%%GITHUB_SPACY/requirements.txt) additionally installs
|
|
||||||
developer dependencies such as Cython. See the [quickstart widget](#quickstart)
|
```bash
|
||||||
to get the right commands for your platform and Python version.
|
$ pip install .[lookups,cuda102] # install spaCy with extras
|
||||||
|
```
|
||||||
|
|
||||||
|
To install all dependencies required for development:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ pip install -r requirements.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
Compared to a regular install via pip, the
|
||||||
|
[`requirements.txt`](%%GITHUB_SPACY/requirements.txt) additionally includes
|
||||||
|
developer dependencies such as Cython and the libraries required to run the test
|
||||||
|
suite. See the [quickstart widget](#quickstart) to get the right commands for
|
||||||
|
your platform and Python version.
|
||||||
|
|
||||||
<a id="source-ubuntu"></a><a id="source-osx"></a><a id="source-windows"></a>
|
<a id="source-ubuntu"></a><a id="source-osx"></a><a id="source-windows"></a>
|
||||||
|
|
||||||
|
@ -195,6 +203,34 @@ to get the right commands for your platform and Python version.
|
||||||
[Visual Studio Express](https://www.visualstudio.com/vs/visual-studio-express/)
|
[Visual Studio Express](https://www.visualstudio.com/vs/visual-studio-express/)
|
||||||
that matches the version that was used to compile your Python interpreter.
|
that matches the version that was used to compile your Python interpreter.
|
||||||
|
|
||||||
|
#### Additional options for developers {#source-developers}
|
||||||
|
|
||||||
|
Some additional options may be useful for spaCy developers who are editing the
|
||||||
|
source code and recompiling frequently.
|
||||||
|
|
||||||
|
- Install in editable mode. Changes to `.py` files will be reflected as soon as
|
||||||
|
the files are saved, but edits to Cython files (`.pxd`, `.pyx`) will require
|
||||||
|
the `pip install` or `python setup.py build_ext` command below to be run
|
||||||
|
again. Before installing in editable mode, be sure you have removed any
|
||||||
|
previous installs with `pip uninstall spacy`, which you may need to run
|
||||||
|
multiple times to remove all traces of earlier installs.
|
||||||
|
|
||||||
|
```diff
|
||||||
|
- $ pip install .
|
||||||
|
+ $ pip install -r requirements.txt
|
||||||
|
+ $ pip install --no-build-isolation --editable .
|
||||||
|
```
|
||||||
|
|
||||||
|
- Build in parallel using `N` CPUs to speed up compilation and then install in
|
||||||
|
editable mode:
|
||||||
|
|
||||||
|
```diff
|
||||||
|
- $ pip install .
|
||||||
|
+ $ pip install -r requirements.txt
|
||||||
|
+ $ python setup.py build_ext --inplace -j N
|
||||||
|
+ $ pip install --no-build-isolation --editable .
|
||||||
|
```
|
||||||
|
|
||||||
### Building an executable {#executable}
|
### Building an executable {#executable}
|
||||||
|
|
||||||
The spaCy repository includes a [`Makefile`](%%GITHUB_SPACY/Makefile) that
|
The spaCy repository includes a [`Makefile`](%%GITHUB_SPACY/Makefile) that
|
||||||
|
|
Loading…
Reference in New Issue