Update source install instructions

* Don't recommend an editable install in the default source
instructions.
* Use `pip install --no-build-isolation` for editable installs.
* Remove reference to `virtualenv`.
This commit is contained in:
Adriane Boyd 2020-11-24 14:44:13 +01:00
parent ed32fa80cd
commit 6f133877aa
1 changed files with 29 additions and 21 deletions

View File

@ -158,35 +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.
You'll need to make sure that you have a development environment consisting of a
Python distribution including header files, a compiler,
[pip](https://pip.pypa.io/en/latest/installing/),
[virtualenv](https://virtualenv.pypa.io/) and [git](https://git-scm.com)
installed. The compiler part is the trickiest. How to do that depends on your
system. See notes on [Ubuntu](#source-ubuntu), [macOS / OS X](#source-osx) and
[pip](https://pip.pypa.io/en/stable/) and [git](https://git-scm.com) installed.
The compiler part is the trickiest. How to do that depends on your system. See
notes on [Ubuntu](#source-ubuntu), [macOS / OS X](#source-osx) and
[Windows](#source-windows) for details.
```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
$ cd spaCy # navigate into dir
$ python -m venv .env # create environment in .env
$ source .env/bin/activate # activate virtual env
$ export PYTHONPATH=`pwd` # set Python path to spaCy dir
$ pip install -r requirements.txt # install all requirements
$ python setup.py build_ext --inplace # compile spaCy
$ pip install . # install spaCy
$ pip install . # compile and install spaCy
```
To install with extras:
```bash
$ pip install -e .[lookups,cuda102] # install spaCy with extras
$ pip install .[lookups,cuda102] # install spaCy with extras
```
Compared to regular install via pip, the
[`requirements.txt`](%%GITHUB_SPACY/requirements.txt) additionally installs
developer dependencies such as Cython. See the [quickstart widget](#quickstart)
to get the right commands for your platform and Python version.
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>
@ -206,21 +208,27 @@ to get the right commands for your platform and Python version.
Some additional options may be useful for spaCy developers who are editing the
source code and recompiling frequently.
- Install in developer mode. Changes to `.py` files will be reflected as soon as
- 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 compile step to be run again. Before installing in developer mode, be sure
you have removed any previous installs with `pip uninstall spacy`.
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 .
+ $ python setup.py develop
+ $ pip install -r requirements.txt
+ $ pip install --no-build-isolation --editable .
```
- Build in parallel using `N` CPUs to speed up compilation:
- Build in parallel using `N` CPUs to speed up compilation and then install in
editable mode:
```diff
- $ python setup.py build_ext --inplace
- $ 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}