Параллельное построение модуля C Python с установкой пипса - PullRequest
0 голосов
/ 20 марта 2020

Я бы хотел ускорить этап установки этого Python C модуля. setuptools может собрать расширение с несколькими ядрами с помощью:

python setup.py build --parallel 8

Теперь, как я могу сказать pip install, чтобы заставить setuptools выполнить параллельную сборку модуля?

pip install не имеет --build-option и pip install --install-option или --global-option завершаются с этим сообщением об ошибке:

$ python -m pip install --build-option='--parallel 8' .
/home/azmeuk/dev/zodb/BTrees/env/lib/python3.8/site-packages/pip/_internal/commands/install.py:244: UserWarning: Disabling all use of wheels due to the use of --build-option / --global-option / --install-option.
  cmdoptions.check_install_build_global(options)
Processing /home/azmeuk/dev/zodb/BTrees
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Collecting zope.interface
  Using cached zope.interface-5.0.0.tar.gz (214 kB)
Collecting persistent>=4.1.0  Using cached persistent-4.6.3.tar.gz (119 kB)Requirement already satisfied: setuptools in ./env/lib/python3.8/site-packages (from zope.interface->BTrees==4.7.1.dev0) (46.0.0)
Collecting cffi
  Using cached cffi-1.14.0.tar.gz (463 kB)
Collecting pycparser
  Using cached pycparser-2.20.tar.gz (161 kB)
Skipping wheel build for zope.interface, due to binaries being disabled for it.
Skipping wheel build for persistent, due to binaries being disabled for it.
Skipping wheel build for cffi, due to binaries being disabled for it.
Skipping wheel build for pycparser, due to binaries being disabled for it.
Building wheels for collected packages: BTrees
  Building wheel for BTrees (PEP 517) ... done  Created wheel for BTrees: filename=BTrees-4.7.1.dev0-cp38-cp38-linux_x86_64.whl size=3310012 sha256=8d7ede730f4c7eb1a56b71124a1956fc6381f2f42c2e64be82d0fd040785bc74  Stored in directory: /tmp/pip-ephem-wheel-cache-xvmeibjl/wheels/6e/6d/be/8acde01b09d9c1158ca46a22021870cad200ef2325bf167cc8
Successfully built BTrees
Installing collected packages: zope.interface, pycparser, cffi, persistent, BTrees
    Running setup.py install for zope.interface ... error
    ERROR: Command errored out with exit status 1:
     command: /home/azmeuk/dev/zodb/BTrees/env/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-n5jo5jsl/zope.interface/setup.py'"'"'; __file__='"'"'/tmp/pip-install-n5jo5jsl/zope.interface/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-byf2qhbs/install-record.txt --single-version-externally-managed --compile --install-headers /home/azmeuk/dev/zodb/BTrees/env/include/site/python3.8/zope.interface '--parallel 8'
         cwd: /tmp/pip-install-n5jo5jsl/zope.interface/
    Complete output (6 lines):
    usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
       or: setup.py --help [cmd1 cmd2 ...]
       or: setup.py --help-commands
       or: setup.py cmd --help

    error: option --parallel 8 not recognized
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/azmeuk/dev/zodb/BTrees/env/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-n5jo5jsl/zope.interface/setup.py'"'"'; __file__='"'"'/tmp/pip-install-n5jo5jsl/zope.interface/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-byf2qhbs/install-record.txt --single-version-externally-managed --compile --install-headers /home/azmeuk/dev/zodb/BTrees/env/include/site/python3.8/zope.interface '--parallel 8' Check the logs for full command output.
...