From ed32fa80cde53f3adf20f8c38fe01657f4c8fd24 Mon Sep 17 00:00:00 2001 From: Adriane Boyd Date: Mon, 16 Nov 2020 10:13:51 +0100 Subject: [PATCH 1/2] Update source install instructions * Use `pip install` instead of `python setup.py install` * For developers recommend: * `python setup.py build_ext --inplace -j N` * `python setup.py develop` --- website/docs/usage/index.md | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/website/docs/usage/index.md b/website/docs/usage/index.md index 8d40ee61e..156771169 100644 --- a/website/docs/usage/index.md +++ b/website/docs/usage/index.md @@ -174,7 +174,13 @@ $ 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 -$ python setup.py install # install spaCy +$ pip install . # install spaCy +``` + +To install with extras: + +```bash +$ pip install -e .[lookups,cuda102] # install spaCy with extras ``` Compared to regular install via pip, the @@ -195,6 +201,28 @@ to get the right commands for your platform and Python version. [Visual Studio Express](https://www.visualstudio.com/vs/visual-studio-express/) 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 developer 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`. + + ```diff + - $ pip install . + + $ python setup.py develop + ``` + +- Build in parallel using `N` CPUs to speed up compilation: + + ```diff + - $ python setup.py build_ext --inplace + + $ python setup.py build_ext --inplace -j N + ``` + ### Building an executable {#executable} The spaCy repository includes a [`Makefile`](%%GITHUB_SPACY/Makefile) that From 6f133877aa4c0d82d2ac4e348004ff4c2cb8f537 Mon Sep 17 00:00:00 2001 From: Adriane Boyd Date: Tue, 24 Nov 2020 14:44:13 +0100 Subject: [PATCH 2/2] 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`. --- website/docs/usage/index.md | 50 +++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/website/docs/usage/index.md b/website/docs/usage/index.md index 156771169..67b757ce9 100644 --- a/website/docs/usage/index.md +++ b/website/docs/usage/index.md @@ -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. @@ -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}