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

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. 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
$ pip install . # install spaCy
``` ```
To install with extras: To install with extras:
```bash ```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 To install all dependencies required for development:
[`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 -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>
@ -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 Some additional options may be useful for spaCy developers who are editing the
source code and recompiling frequently. 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 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 the `pip install` or `python setup.py build_ext` command below to be run
you have removed any previous installs with `pip uninstall spacy`. 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 ```diff
- $ pip install . - $ 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 ```diff
- $ python setup.py build_ext --inplace - $ pip install .
+ $ pip install -r requirements.txt
+ $ python setup.py build_ext --inplace -j N + $ python setup.py build_ext --inplace -j N
+ $ pip install --no-build-isolation --editable .
``` ```
### Building an executable {#executable} ### Building an executable {#executable}