mirror of https://github.com/explosion/spaCy.git
Tweak build jobs setting, update install docs (#11077)
* Restrict SPACY_NUM_BUILD_JOBS to only override if set * Update install docs
This commit is contained in:
parent
36cb2029a9
commit
3701039c1f
10
setup.py
10
setup.py
|
@ -126,8 +126,8 @@ class build_ext_options:
|
||||||
|
|
||||||
class build_ext_subclass(build_ext, build_ext_options):
|
class build_ext_subclass(build_ext, build_ext_options):
|
||||||
def build_extensions(self):
|
def build_extensions(self):
|
||||||
if not self.parallel:
|
if self.parallel is None and os.environ.get("SPACY_NUM_BUILD_JOBS") is not None:
|
||||||
self.parallel = int(os.environ.get("SPACY_NUM_BUILD_JOBS", 1))
|
self.parallel = int(os.environ.get("SPACY_NUM_BUILD_JOBS"))
|
||||||
build_ext_options.build_options(self)
|
build_ext_options.build_options(self)
|
||||||
build_ext.build_extensions(self)
|
build_ext.build_extensions(self)
|
||||||
|
|
||||||
|
@ -208,7 +208,11 @@ def setup_package():
|
||||||
for name in MOD_NAMES:
|
for name in MOD_NAMES:
|
||||||
mod_path = name.replace(".", "/") + ".pyx"
|
mod_path = name.replace(".", "/") + ".pyx"
|
||||||
ext = Extension(
|
ext = Extension(
|
||||||
name, [mod_path], language="c++", include_dirs=include_dirs, extra_compile_args=["-std=c++11"]
|
name,
|
||||||
|
[mod_path],
|
||||||
|
language="c++",
|
||||||
|
include_dirs=include_dirs,
|
||||||
|
extra_compile_args=["-std=c++11"],
|
||||||
)
|
)
|
||||||
ext_modules.append(ext)
|
ext_modules.append(ext)
|
||||||
print("Cythonizing sources")
|
print("Cythonizing sources")
|
||||||
|
|
|
@ -130,8 +130,8 @@ grateful to use the work of Chainer's [CuPy](https://cupy.chainer.org) module,
|
||||||
which provides a numpy-compatible interface for GPU arrays.
|
which provides a numpy-compatible interface for GPU arrays.
|
||||||
|
|
||||||
spaCy can be installed for a CUDA-compatible GPU by specifying `spacy[cuda]`,
|
spaCy can be installed for a CUDA-compatible GPU by specifying `spacy[cuda]`,
|
||||||
`spacy[cuda102]`, `spacy[cuda112]`, `spacy[cuda113]`, etc. If you know your
|
`spacy[cuda102]`, `spacy[cuda112]`, `spacy[cuda113]`, etc. If you know your CUDA
|
||||||
CUDA version, using the more explicit specifier allows CuPy to be installed via
|
version, using the more explicit specifier allows CuPy to be installed via
|
||||||
wheel, saving some compilation time. The specifiers should install
|
wheel, saving some compilation time. The specifiers should install
|
||||||
[`cupy`](https://cupy.chainer.org).
|
[`cupy`](https://cupy.chainer.org).
|
||||||
|
|
||||||
|
@ -236,24 +236,32 @@ package to see what the oldest recommended versions of `numpy` are.
|
||||||
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 editable mode. Changes to `.py` files will be reflected as soon as
|
- Install in editable mode. Changes to `.py` files will be reflected as soon
|
||||||
the files are saved, but edits to Cython files (`.pxd`, `.pyx`) will require
|
as the files are saved, but edits to Cython files (`.pxd`, `.pyx`) will
|
||||||
the `pip install` or `python setup.py build_ext` command below to be run
|
require the `pip install` command below to be run again. Before installing in
|
||||||
again. Before installing in editable mode, be sure you have removed any
|
editable mode, be sure you have removed any previous installs with
|
||||||
previous installs with `pip uninstall spacy`, which you may need to run
|
`pip uninstall spacy`, which you may need to run multiple times to remove all
|
||||||
multiple times to remove all traces of earlier installs.
|
traces of earlier installs.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ pip install -r requirements.txt
|
$ pip install -r requirements.txt
|
||||||
$ pip install --no-build-isolation --editable .
|
$ pip install --no-build-isolation --editable .
|
||||||
```
|
```
|
||||||
|
|
||||||
- Build in parallel using `N` CPUs to speed up compilation and then install in
|
- Build in parallel. Starting in v3.4.0, you can specify the number of
|
||||||
editable mode:
|
build jobs with the environment variable `SPACY_NUM_BUILD_JOBS`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ pip install -r requirements.txt
|
$ pip install -r requirements.txt
|
||||||
$ python setup.py build_ext --inplace -j N
|
$ SPACY_NUM_BUILD_JOBS=4 pip install --no-build-isolation --editable .
|
||||||
|
```
|
||||||
|
|
||||||
|
- For editable mode and parallel builds with `python setup.py` instead of `pip`
|
||||||
|
(no longer recommended):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ pip install -r requirements.txt
|
||||||
|
$ python setup.py build_ext --inplace -j 4
|
||||||
$ python setup.py develop
|
$ python setup.py develop
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue