Можно ли установить SpaCy на Raspberry Pi 4 Raspbian Buster? - PullRequest
2 голосов
/ 27 января 2020

Я застрял при установке SpaCy весь день.

sudo pip install -U spacy

Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting spacy
  Using cached https://files.pythonhosted...
  Installing build dependencies ... done
    Complete output from command python setup.py egg_info:
      Failed building wheel for blis
    ERROR: Failed to build one or more wheels
    Traceback (most recent call last):
      File "/tmp/pip-build-env-e4fo917j/lib/python3.7/site-packages/setuptools/installer.py", line 128, in fetch_build_egg
        subprocess.check_call(cmd)
      File "/usr/lib/python3.7/subprocess.py", line 347, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['/usr/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpgp2s1vb0', '--quiet', 'blis<0.5.0,>=0.4.0']' returned non-zero exit status 1.

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-avn68ykf/spacy/setup.py", line 200, in <module>
        setup_package()
      File "/tmp/pip-install-avn68ykf/spacy/setup.py", line 195, in setup_package
        cmdclass={"build_ext": build_ext_subclass},
      File "/tmp/pip-build-env-e4fo917j/lib/python3.7/site-packages/setuptools/__init__.py", line 144, in setup
        _install_setup_requires(attrs)
      File "/tmp/pip-build-env-e4fo917j/lib/python3.7/site-packages/setuptools/__init__.py", line 139, in _install_setup_requires
        dist.fetch_build_eggs(dist.setup_requires)
      File "/tmp/pip-build-env-e4fo917j/lib/python3.7/site-packages/setuptools/dist.py", line 721, in fetch_build_eggs
        replace_conflicting=True,
      File "/tmp/pip-build-env-e4fo917j/lib/python3.7/site-packages/pkg_resources/__init__.py", line 783, in resolve
        replace_conflicting=replace_conflicting
      File "/tmp/pip-build-env-e4fo917j/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1066, in best_match
        return self.obtain(req, installer)
      File "/tmp/pip-build-env-e4fo917j/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1078, in obtain
        return installer(requirement)
      File "/tmp/pip-build-env-e4fo917j/lib/python3.7/site-packages/setuptools/dist.py", line 777, in fetch_build_egg
        return fetch_build_egg(self, req)
      File "/tmp/pip-build-env-e4fo917j/lib/python3.7/site-packages/setuptools/installer.py", line 130, in fetch_build_egg
        raise DistutilsError(str(e))
    distutils.errors.DistutilsError: Command '['/usr/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpgp2s1vb0', '--quiet', 'blis<0.5.0,>=0.4.0']' returned non-zero exit status 1.

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-avn68ykf/spacy/

Мне просто интересно, возможно ли установить его на архитектуре ARM (armv7l)?


обновлено: также пытался установить из источника , вот ошибка:

sudo pip install -r requirements.txt 

Ignoring pathlib: markers 'python_version < "3.4"' don't match your environment
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: cymem<2.1.0,>=2.0.2 in /usr/local/lib/python3.7/dist-packages (from -r requirements.txt (line 2)) (2.0.3)
Requirement already satisfied: preshed<3.1.0,>=3.0.2 in /usr/local/lib/python3.7/dist-packages (from -r requirements.txt (line 3)) (3.0.2)
Collecting thinc==7.4.0.dev0 (from -r requirements.txt (line 4))
  Using cached https://www.piwheels.org/simple/thinc/thinc-7.4.0.dev0-cp37-cp37m-linux_armv7l.whl
Requirement already satisfied: murmurhash<1.1.0,>=0.28.0 ...
Requirement already satisfied: wasabi<1.1.0,>=0.4.0 ...
Requirement already satisfied: srsly<1.1.0,>=0.1.0 ...
Requirement already satisfied: catalogue<1.1.0,>=0.0.7 ...
Requirement already satisfied: numpy>=1.15.0 in ...
Requirement already satisfied: requests<3.0.0,>=2.13.0 ...
Requirement already satisfied: plac<1.2.0,>=0.9.6 ...
Requirement already satisfied: tqdm<5.0.0,>=4.38.0 ...
Collecting jsonschema<3.1.0,>=2.6.0 (from -r requirements.txt (line 17))
  Using cached https://files.pythonhosted.org/packages/54/48/f5f11003ceddcd4ad292d4d9b5677588e9169eef41f88e38b2888e7ec6c4/jsonschema-3.0.2-py2.py3-none-any.whl
Requirement already satisfied: cython>=0.25 ...
Collecting pytest>=4.6.5 (from -r requirements.txt (line 20))
  Using cached https://files.pythonhosted.org/packages/0b/2d/75def2ed660903839bab38a1cadf819726637a0c3c78951de7e67a97a7c3/pytest-5.3.4-py3-none-any.whl
Collecting pytest-timeout<2.0.0,>=1.3.0 (from -r requirements.txt (line 21))
  Using cached https://files.pythonhosted.org/packages/de/23/048cd3a3e03a35c45df4f7ce9fb2ce5fb424479633cceb46143debeafc2f/pytest_timeout-1.3.4-py2.py3-none-any.whl
Collecting mock<3.0.0,>=2.0.0 (from -r requirements.txt (line 22))
  Using cached https://files.pythonhosted.org/packages/e6/35/f187bdf23be87092bd0f1200d43d23076cee4d0dec109f195173fd3ebc79/mock-2.0.0-py2.py3-none-any.whl
Collecting flake8<3.6.0,>=3.5.0 (from -r requirements.txt (line 23))
  Using cached https://files.pythonhosted.org/packages/b9/dc/14e9d94c770b8c4ef584e906c7583e74864786a58d47de101f2767d50c0b/flake8-3.5.0-py2.py3-none-any.whl
Collecting blis<0.5.0,>=0.4.0 (from thinc==7.4.0.dev0->-r requirements.txt (line 4))
  Using cached https://files.pythonhosted.org/packages/98/5a/f9b8a78e3d1fdde1b0215413d88ab55d907ab81f95b62418a6e9cda30dec/blis-0.4.1.tar.gz
Requirement already satisfied: importlib-metadata>=0.20; python_version < "3.8" ...
Requirement already satisfied: six>=1.11.0 ...
Requirement already satisfied: setuptools ...
Collecting pyrsistent>=0.14.0 (from jsonschema<3.1.0,>=2.6.0->-r requirements.txt (line 17))
  Using cached https://www.piwheels.org/simple/pyrsistent/pyrsistent-0.15.7-cp37-cp37m-linux_armv7l.whl
Collecting attrs>=17.4.0 (from jsonschema<3.1.0,>=2.6.0->-r requirements.txt (line 17))
  Using cached https://files.pythonhosted.org/packages/a2/db/4313ab3be961f7a763066401fb77f7748373b6094076ae2bda2806988af6/attrs-19.3.0-py2.py3-none-any.whl
Collecting pluggy<1.0,>=0.12 (from pytest>=4.6.5->-r requirements.txt (line 20))
  Using cached https://files.pythonhosted.org/packages/a0/28/85c7aa31b80d150b772fbe4a229487bc6644da9ccb7e427dd8cc60cb8a62/pluggy-0.13.1-py2.py3-none-any.whl
Requirement already satisfied: wcwidth in /usr/lib/python3/dist-packages (from pytest>=4.6.5->-r requirements.txt (line 20)) (0.1.7)
Collecting packaging (from pytest>=4.6.5->-r requirements.txt (line 20))
  Using cached https://files.pythonhosted.org/packages/98/42/87c585dd3b113c775e65fd6b8d9d0a43abe1819c471d7af702d4e01e9b20/packaging-20.1-py2.py3-none-any.whl
Collecting more-itertools>=4.0.0 (from pytest>=4.6.5->-r requirements.txt (line 20))
  Using cached https://files.pythonhosted.org/packages/bc/e2/3206a70758a21f9878fcf9478282bb68fbc66a5564718f9ed724c3f2bb52/more_itertools-8.1.0-py3-none-any.whl
Collecting py>=1.5.0 (from pytest>=4.6.5->-r requirements.txt (line 20))
  Using cached https://files.pythonhosted.org/packages/99/8d/21e1767c009211a62a8e3067280bfce76e89c9f876180308515942304d2d/py-1.8.1-py2.py3-none-any.whl
Collecting pbr>=0.11 (from mock<3.0.0,>=2.0.0->-r requirements.txt (line 22))
  Using cached https://files.pythonhosted.org/packages/7a/db/a968fd7beb9fe06901c1841cb25c9ccb666ca1b9a19b114d1bbedf1126fc/pbr-5.4.4-py2.py3-none-any.whl
Collecting pycodestyle<2.4.0,>=2.0.0 (from flake8<3.6.0,>=3.5.0->-r requirements.txt (line 23))
  Using cached https://files.pythonhosted.org/packages/e4/81/78fe51eb4038d1388b7217dd63770b0f428370207125047312886c923b26/pycodestyle-2.3.1-py2.py3-none-any.whl
Requirement already satisfied: mccabe<0.7.0,>=0.6.0 in /usr/lib/python3/dist-packages (from flake8<3.6.0,>=3.5.0->-r requirements.txt (line 23)) (0.6.1)
Collecting pyflakes<1.7.0,>=1.5.0 (from flake8<3.6.0,>=3.5.0->-r requirements.txt (line 23))
  Using cached https://files.pythonhosted.org/packages/d7/40/733bcc64da3161ae4122c11e88269f276358ca29335468005cb0ee538665/pyflakes-1.6.0-py2.py3-none-any.whl
Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.7/dist-packages (from importlib-metadata>=0.20; python_version < "3.8"->catalogue<1.1.0,>=0.0.7->-r requirements.txt (line 9)) (2.1.0)
Requirement already satisfied: pyparsing>=2.0.2 in /usr/lib/python3/dist-packages (from packaging->pytest>=4.6.5->-r requirements.txt (line 20)) (2.2.0)
Building wheels for collected packages: blis
  Running setup.py bdist_wheel for blis ... error
  Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-sh0bcfbq/blis/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-hbtbd3ev --python-tag cp37:
  BLIS_COMPILER? None
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-armv7l-3.7
  creating build/lib.linux-armv7l-3.7/blis
  copying blis/benchmark.py -> build/lib.linux-armv7l-3.7/blis
  copying blis/__init__.py -> build/lib.linux-armv7l-3.7/blis
  copying blis/about.py -> build/lib.linux-armv7l-3.7/blis
  creating build/lib.linux-armv7l-3.7/blis/tests
  copying blis/tests/test_gemm.py -> build/lib.linux-armv7l-3.7/blis/tests
  copying blis/tests/__init__.py -> build/lib.linux-armv7l-3.7/blis/tests
  copying blis/tests/test_dotv.py -> build/lib.linux-armv7l-3.7/blis/tests
  copying blis/tests/common.py -> build/lib.linux-armv7l-3.7/blis/tests
  copying blis/cy.pyx -> build/lib.linux-armv7l-3.7/blis
  copying blis/py.pyx -> build/lib.linux-armv7l-3.7/blis
  copying blis/cy.pxd -> build/lib.linux-armv7l-3.7/blis
  copying blis/__init__.pxd -> build/lib.linux-armv7l-3.7/blis
  running build_ext
  /usr/local/lib/python3.7/dist-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /tmp/pip-install-sh0bcfbq/blis/blis/cy.pxd
    tree = Parsing.p_module(s, pxd, full_module_name)
  /usr/local/lib/python3.7/dist-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /tmp/pip-install-sh0bcfbq/blis/blis/py.pyx
    tree = Parsing.p_module(s, pxd, full_module_name)
  Processing blis/cy.pyx
  Processing blis/py.pyx
  unix
  py_compiler gcc
  {'BLIS_ARCH': 'generic', 'HOSTNAME': 'aa9d42588791', 'SSL_CERT_FILE': '/opt/_internal/certs.pem', 'TERM': 'xterm', 'OLDPWD': '/usr/local/repos/cython-blis', 'LD_LIBRARY_PATH': '/opt/rh/devtoolset-2/root/usr/lib64:/opt/rh/devtoolset-2/root/usr/lib:/usr/local/lib64:/usr/local/lib', 'LS_COLORS': 'no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:', 'VIRTUAL_ENV': '/usr/local/repos/cython-blis/env3.6', 'PATH': '/usr/local/repos/cython-blis/env3.6/bin:/opt/rh/devtoolset-2/root/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'PWD': '/usr/local/repos/cython-blis/flame-blis', 'BLIS_ARCh': 'generic', 'LANG': 'en_US.UTF-8', 'HOME': '/root', 'SHLVL': '2', 'LANGUAGE': 'en_US.UTF-8', 'BLIS_ARC': 'generic', 'AUDITWHEEL_PLAT': 'manylinux1_x86_64', 'PKG_CONFIG_PATH': '/usr/local/lib/pkgconfig', 'LESSOPEN': '|/usr/bin/lesspipe.sh %s', 'G_BROKEN_FILENAMES': '1', '_': '/usr/local/repos/cython-blis/env3.6/bin/python'}
  gcc -c /tmp/pip-install-sh0bcfbq/blis/blis/_src/config/generic/bli_cntx_init_generic.c -o /tmp/tmpday66tmd/bli_cntx_init_generic.o -O3 -fPIC -std=c99 -D_POSIX_C_SOURCE=200112L -DBLIS_VERSION_STRING="0.5.1" -DBLIS_IS_BUILDING_LIBRARY -Iinclude/linux-x86_64 -I./frame/3/ -I./frame/ind/ukernels/ -I./frame/1m/ -I./frame/1f/ -I./frame/1/ -I./frame/include -I/tmp/pip-install-sh0bcfbq/blis/blis/_src/include/linux-x86_64
  gcc -c /tmp/pip-install-sh0bcfbq/blis/blis/_src/config/haswell/bli_cntx_init_haswell.c -o /tmp/tmpday66tmd/bli_cntx_init_haswell.o -O3 -fPIC -std=c99 -D_POSIX_C_SOURCE=200112L -DBLIS_VERSION_STRING="0.5.1" -DBLIS_IS_BUILDING_LIBRARY -Iinclude/linux-x86_64 -I./frame/3/ -I./frame/ind/ukernels/ -I./frame/1m/ -I./frame/1f/ -I./frame/1/ -I./frame/include -I/tmp/pip-install-sh0bcfbq/blis/blis/_src/include/linux-x86_64
  gcc -c /tmp/pip-install-sh0bcfbq/blis/blis/_src/config/penryn/bli_cntx_init_penryn.c -o /tmp/tmpday66tmd/bli_cntx_init_penryn.o -O3 -fPIC -std=c99 -D_POSIX_C_SOURCE=200112L -DBLIS_VERSION_STRING="0.5.1" -DBLIS_IS_BUILDING_LIBRARY -Iinclude/linux-x86_64 -I./frame/3/ -I./frame/ind/ukernels/ -I./frame/1m/ -I./frame/1f/ -I./frame/1/ -I./frame/include -I/tmp/pip-install-sh0bcfbq/blis/blis/_src/include/linux-x86_64
  gcc -c /tmp/pip-install-sh0bcfbq/blis/blis/_src/config/piledriver/bli_cntx_init_piledriver.c -o /tmp/tmpday66tmd/bli_cntx_init_piledriver.o -O3 -fPIC -std=c99 -D_POSIX_C_SOURCE=200112L -DBLIS_VERSION_STRING="0.5.1" -DBLIS_IS_BUILDING_LIBRARY -Iinclude/linux-x86_64 -I./frame/3/ -I./frame/ind/ukernels/ -I./frame/1m/ -I./frame/1f/ -I./frame/1/ -I./frame/include -I/tmp/pip-install-sh0bcfbq/blis/blis/_src/include/linux-x86_64
  gcc -c /tmp/pip-install-sh0bcfbq/blis/blis/_src/config/sandybridge/bli_cntx_init_sandybridge.c -o /tmp/tmpday66tmd/bli_cntx_init_sandybridge.o -O3 -fPIC -std=c99 -D_POSIX_C_SOURCE=200112L -DBLIS_VERSION_STRING="0.5.1" -DBLIS_IS_BUILDING_LIBRARY -Iinclude/linux-x86_64 -I./frame/3/ -I./frame/ind/ukernels/ -I./frame/1m/ -I./frame/1f/ -I./frame/1/ -I./frame/include -I/tmp/pip-install-sh0bcfbq/blis/blis/_src/include/linux-x86_64
  gcc -c /tmp/pip-install-sh0bcfbq/blis/blis/_src/config/steamroller/bli_cntx_init_steamroller.c -o /tmp/tmpday66tmd/bli_cntx_init_steamroller.o -O3 -fPIC -std=c99 -D_POSIX_C_SOURCE=200112L -DBLIS_VERSION_STRING="0.5.1" -DBLIS_IS_BUILDING_LIBRARY -Iinclude/linux-x86_64 -I./frame/3/ -I./frame/ind/ukernels/ -I./frame/1m/ -I./frame/1f/ -I./frame/1/ -I./frame/include -I/tmp/pip-install-sh0bcfbq/blis/blis/_src/include/linux-x86_64
  gcc -c /tmp/pip-install-sh0bcfbq/blis/blis/_src/kernels/zen/1/bli_amaxv_zen_int.c -o /tmp/tmpday66tmd/bli_amaxv_zen_int.o -O3 -mavx2 -mfma -mfpmath=sse -march=core-avx2 -fPIC -std=c99 -D_POSIX_C_SOURCE=200112L -DBLIS_VERSION_STRING="0.5.1" -DBLIS_IS_BUILDING_LIBRARY -Iinclude/linux-x86_64 -I./frame/3/ -I./frame/ind/ukernels/ -I./frame/1m/ -I./frame/1f/ -I./frame/1/ -I./frame/include -I/tmp/pip-install-sh0bcfbq/blis/blis/_src/include/linux-x86_64
  gcc: error: unrecognized -march target: core-avx2
  gcc: note: valid arguments are: armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5t armv5e armv5te armv5tej armv6 armv6j armv6k armv6z armv6kz armv6zk armv6t2 armv6-m armv6s-m armv7 armv7-a armv7ve armv7-r armv7-m armv7e-m armv8-a armv8.1-a armv8.2-a armv8.3-a armv8.4-a armv8-m.base armv8-m.main armv8-r iwmmxt iwmmxt2 native
  gcc: error: missing argument to ‘-march=’
  gcc: error: unrecognized command line option ‘-mavx2’
  gcc: error: unrecognized command line option ‘-mfma’
  gcc: error: unrecognized command line option ‘-mfpmath=sse’
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-install-sh0bcfbq/blis/setup.py", line 277, in <module>
      "Topic :: Scientific/Engineering",
    File "/usr/local/lib/python3.7/dist-packages/setuptools/__init__.py", line 145, in setup
      return distutils.core.setup(**attrs)
    File "/usr/lib/python3.7/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/usr/lib/python3.7/distutils/dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/usr/lib/python3/dist-packages/wheel/bdist_wheel.py", line 188, in run
      self.run_command('build')
    File "/usr/lib/python3.7/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/usr/lib/python3.7/distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
    File "/usr/lib/python3.7/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/usr/lib/python3.7/distutils/command/build_ext.py", line 340, in run
      self.build_extensions()
    File "/tmp/pip-install-sh0bcfbq/blis/setup.py", line 103, in build_extensions
      objects = self.compile_objects(compiler.split("-")[0], arch, OBJ_DIR)
    File "/tmp/pip-install-sh0bcfbq/blis/setup.py", line 188, in compile_objects
      objects.append(self.build_object(env=env, **spec))
    File "/tmp/pip-install-sh0bcfbq/blis/setup.py", line 201, in build_object
      subprocess.check_call(command, cwd=BLIS_DIR)
    File "/usr/lib/python3.7/subprocess.py", line 347, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['gcc', '-c', '/tmp/pip-install-sh0bcfbq/blis/blis/_src/kernels/zen/1/bli_amaxv_zen_int.c', '-o', '/tmp/tmpday66tmd/bli_amaxv_zen_int.o', '-O3', '-mavx2', '-mfma', '-mfpmath=sse', '-march=core-avx2', '-fPIC', '-std=c99', '-D_POSIX_C_SOURCE=200112L', '-DBLIS_VERSION_STRING="0.5.1"', '-DBLIS_IS_BUILDING_LIBRARY', '-Iinclude/linux-x86_64', '-I./frame/3/', '-I./frame/ind/ukernels/', '-I./frame/1m/', '-I./frame/1f/', '-I./frame/1/', '-I./frame/include', '-I/tmp/pip-install-sh0bcfbq/blis/blis/_src/include/linux-x86_64']' returned non-zero exit status 1.

  ----------------------------------------
  Failed building wheel for blis
  Running setup.py clean for blis
Failed to build blis
Installing collected packages: blis, thinc, pyrsistent, attrs, jsonschema, pluggy, packaging, more-itertools, py, pytest, pytest-timeout, pbr, mock, pycodestyle, pyflakes, flake8
  Running setup.py install for blis ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-sh0bcfbq/blis/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-vq1exsjn/install-record.txt --single-version-externally-managed --compile:
    BLIS_COMPILER? None
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-armv7l-3.7
    creating build/lib.linux-armv7l-3.7/blis
    copying blis/benchmark.py -> build/lib.linux-armv7l-3.7/blis
    copying blis/__init__.py -> build/lib.linux-armv7l-3.7/blis
    copying blis/about.py -> build/lib.linux-armv7l-3.7/blis
    creating build/lib.linux-armv7l-3.7/blis/tests
    copying blis/tests/test_gemm.py -> build/lib.linux-armv7l-3.7/blis/tests
    copying blis/tests/__init__.py -> build/lib.linux-armv7l-3.7/blis/tests
    copying blis/tests/test_dotv.py -> build/lib.linux-armv7l-3.7/blis/tests
    copying blis/tests/common.py -> build/lib.linux-armv7l-3.7/blis/tests
    copying blis/cy.pyx -> build/lib.linux-armv7l-3.7/blis
    copying blis/py.pyx -> build/lib.linux-armv7l-3.7/blis
    copying blis/cy.pxd -> build/lib.linux-armv7l-3.7/blis
    copying blis/__init__.pxd -> build/lib.linux-armv7l-3.7/blis
    running build_ext
    /usr/local/lib/python3.7/dist-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /tmp/pip-install-sh0bcfbq/blis/blis/cy.pxd
      tree = Parsing.p_module(s, pxd, full_module_name)
    /usr/local/lib/python3.7/dist-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /tmp/pip-install-sh0bcfbq/blis/blis/py.pyx
      tree = Parsing.p_module(s, pxd, full_module_name)
    Processing blis/cy.pyx
    Processing blis/py.pyx
    unix
    py_compiler gcc
    {'BLIS_ARCH': 'generic', 'HOSTNAME': 'aa9d42588791', 'SSL_CERT_FILE': '/opt/_internal/certs.pem', 'TERM': 'xterm', 'OLDPWD': '/usr/local/repos/cython-blis', 'LD_LIBRARY_PATH': '/opt/rh/devtoolset-2/root/usr/lib64:/opt/rh/devtoolset-2/root/usr/lib:/usr/local/lib64:/usr/local/lib', 'LS_COLORS': 'no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:', 'VIRTUAL_ENV': '/usr/local/repos/cython-blis/env3.6', 'PATH': '/usr/local/repos/cython-blis/env3.6/bin:/opt/rh/devtoolset-2/root/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'PWD': '/usr/local/repos/cython-blis/flame-blis', 'BLIS_ARCh': 'generic', 'LANG': 'en_US.UTF-8', 'HOME': '/root', 'SHLVL': '2', 'LANGUAGE': 'en_US.UTF-8', 'BLIS_ARC': 'generic', 'AUDITWHEEL_PLAT': 'manylinux1_x86_64', 'PKG_CONFIG_PATH': '/usr/local/lib/pkgconfig', 'LESSOPEN': '|/usr/bin/lesspipe.sh %s', 'G_BROKEN_FILENAMES': '1', '_': '/usr/local/repos/cython-blis/env3.6/bin/python'}
    gcc -c /tmp/pip-install-sh0bcfbq/blis/blis/_src/config/generic/bli_cntx_init_generic.c -o /tmp/tmp7c_4z8c0/bli_cntx_init_generic.o -O3 -fPIC -std=c99 -D_POSIX_C_SOURCE=200112L -DBLIS_VERSION_STRING="0.5.1" -DBLIS_IS_BUILDING_LIBRARY -Iinclude/linux-x86_64 -I./frame/3/ -I./frame/ind/ukernels/ -I./frame/1m/ -I./frame/1f/ -I./frame/1/ -I./frame/include -I/tmp/pip-install-sh0bcfbq/blis/blis/_src/include/linux-x86_64
    gcc -c /tmp/pip-install-sh0bcfbq/blis/blis/_src/config/haswell/bli_cntx_init_haswell.c -o /tmp/tmp7c_4z8c0/bli_cntx_init_haswell.o -O3 -fPIC -std=c99 -D_POSIX_C_SOURCE=200112L -DBLIS_VERSION_STRING="0.5.1" -DBLIS_IS_BUILDING_LIBRARY -Iinclude/linux-x86_64 -I./frame/3/ -I./frame/ind/ukernels/ -I./frame/1m/ -I./frame/1f/ -I./frame/1/ -I./frame/include -I/tmp/pip-install-sh0bcfbq/blis/blis/_src/include/linux-x86_64
    gcc -c /tmp/pip-install-sh0bcfbq/blis/blis/_src/config/penryn/bli_cntx_init_penryn.c -o /tmp/tmp7c_4z8c0/bli_cntx_init_penryn.o -O3 -fPIC -std=c99 -D_POSIX_C_SOURCE=200112L -DBLIS_VERSION_STRING="0.5.1" -DBLIS_IS_BUILDING_LIBRARY -Iinclude/linux-x86_64 -I./frame/3/ -I./frame/ind/ukernels/ -I./frame/1m/ -I./frame/1f/ -I./frame/1/ -I./frame/include -I/tmp/pip-install-sh0bcfbq/blis/blis/_src/include/linux-x86_64
    gcc -c /tmp/pip-install-sh0bcfbq/blis/blis/_src/config/piledriver/bli_cntx_init_piledriver.c -o /tmp/tmp7c_4z8c0/bli_cntx_init_piledriver.o -O3 -fPIC -std=c99 -D_POSIX_C_SOURCE=200112L -DBLIS_VERSION_STRING="0.5.1" -DBLIS_IS_BUILDING_LIBRARY -Iinclude/linux-x86_64 -I./frame/3/ -I./frame/ind/ukernels/ -I./frame/1m/ -I./frame/1f/ -I./frame/1/ -I./frame/include -I/tmp/pip-install-sh0bcfbq/blis/blis/_src/include/linux-x86_64
    gcc -c /tmp/pip-install-sh0bcfbq/blis/blis/_src/config/sandybridge/bli_cntx_init_sandybridge.c -o /tmp/tmp7c_4z8c0/bli_cntx_init_sandybridge.o -O3 -fPIC -std=c99 -D_POSIX_C_SOURCE=200112L -DBLIS_VERSION_STRING="0.5.1" -DBLIS_IS_BUILDING_LIBRARY -Iinclude/linux-x86_64 -I./frame/3/ -I./frame/ind/ukernels/ -I./frame/1m/ -I./frame/1f/ -I./frame/1/ -I./frame/include -I/tmp/pip-install-sh0bcfbq/blis/blis/_src/include/linux-x86_64
    gcc -c /tmp/pip-install-sh0bcfbq/blis/blis/_src/config/steamroller/bli_cntx_init_steamroller.c -o /tmp/tmp7c_4z8c0/bli_cntx_init_steamroller.o -O3 -fPIC -std=c99 -D_POSIX_C_SOURCE=200112L -DBLIS_VERSION_STRING="0.5.1" -DBLIS_IS_BUILDING_LIBRARY -Iinclude/linux-x86_64 -I./frame/3/ -I./frame/ind/ukernels/ -I./frame/1m/ -I./frame/1f/ -I./frame/1/ -I./frame/include -I/tmp/pip-install-sh0bcfbq/blis/blis/_src/include/linux-x86_64
    gcc -c /tmp/pip-install-sh0bcfbq/blis/blis/_src/kernels/zen/1/bli_amaxv_zen_int.c -o /tmp/tmp7c_4z8c0/bli_amaxv_zen_int.o -O3 -mavx2 -mfma -mfpmath=sse -march=core-avx2 -fPIC -std=c99 -D_POSIX_C_SOURCE=200112L -DBLIS_VERSION_STRING="0.5.1" -DBLIS_IS_BUILDING_LIBRARY -Iinclude/linux-x86_64 -I./frame/3/ -I./frame/ind/ukernels/ -I./frame/1m/ -I./frame/1f/ -I./frame/1/ -I./frame/include -I/tmp/pip-install-sh0bcfbq/blis/blis/_src/include/linux-x86_64
    gcc: error: unrecognized -march target: core-avx2
    gcc: note: valid arguments are: armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5t armv5e armv5te armv5tej armv6 armv6j armv6k armv6z armv6kz armv6zk armv6t2 armv6-m armv6s-m armv7 armv7-a armv7ve armv7-r armv7-m armv7e-m armv8-a armv8.1-a armv8.2-a armv8.3-a armv8.4-a armv8-m.base armv8-m.main armv8-r iwmmxt iwmmxt2 native
    gcc: error: missing argument to ‘-march=’
    gcc: error: unrecognized command line option ‘-mavx2’
    gcc: error: unrecognized command line option ‘-mfma’
    gcc: error: unrecognized command line option ‘-mfpmath=sse’
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-sh0bcfbq/blis/setup.py", line 277, in <module>
        "Topic :: Scientific/Engineering",
      File "/usr/local/lib/python3.7/dist-packages/setuptools/__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "/usr/lib/python3.7/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/lib/python3.7/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/usr/local/lib/python3.7/dist-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/usr/lib/python3.7/distutils/command/install.py", line 589, in run
        self.run_command('build')
      File "/usr/lib/python3.7/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/usr/lib/python3.7/distutils/command/build.py", line 135, in run
        self.run_command(cmd_name)
      File "/usr/lib/python3.7/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/usr/lib/python3.7/distutils/command/build_ext.py", line 340, in run
        self.build_extensions()
      File "/tmp/pip-install-sh0bcfbq/blis/setup.py", line 103, in build_extensions
        objects = self.compile_objects(compiler.split("-")[0], arch, OBJ_DIR)
      File "/tmp/pip-install-sh0bcfbq/blis/setup.py", line 188, in compile_objects
        objects.append(self.build_object(env=env, **spec))
      File "/tmp/pip-install-sh0bcfbq/blis/setup.py", line 201, in build_object
        subprocess.check_call(command, cwd=BLIS_DIR)
      File "/usr/lib/python3.7/subprocess.py", line 347, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['gcc', '-c', '/tmp/pip-install-sh0bcfbq/blis/blis/_src/kernels/zen/1/bli_amaxv_zen_int.c', '-o', '/tmp/tmp7c_4z8c0/bli_amaxv_zen_int.o', '-O3', '-mavx2', '-mfma', '-mfpmath=sse', '-march=core-avx2', '-fPIC', '-std=c99', '-D_POSIX_C_SOURCE=200112L', '-DBLIS_VERSION_STRING="0.5.1"', '-DBLIS_IS_BUILDING_LIBRARY', '-Iinclude/linux-x86_64', '-I./frame/3/', '-I./frame/ind/ukernels/', '-I./frame/1m/', '-I./frame/1f/', '-I./frame/1/', '-I./frame/include', '-I/tmp/pip-install-sh0bcfbq/blis/blis/_src/include/linux-x86_64']' returned non-zero exit status 1.

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-sh0bcfbq/blis/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-vq1exsjn/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-sh0bcfbq/blis/

Ответы [ 2 ]

3 голосов
/ 29 января 2020

Отказ от ответственности

Сборка может занять много времени на одном RPi. Если у вас есть кластер из нескольких Пи, может быть целесообразно инвестировать в настройку distcc на них. Это также сократит последний шаг (проверка сборки путем запуска тестов), поскольку pytest поддерживает распределенный тест, выполняющийся на нескольких хостах с плагином pytest-xdist, поэтому запуск тестов в кластере будет проходить намного быстрее.

Кроме того, хотя кросс-компиляция для ARM в системе x86 гораздо более быстрый вариант, правильная настройка может занять намного больше времени, чем медленная нативная компиляция, так что будьте осторожны.

Получите предварительно собранные колеса

Если вы хотите сэкономить время, я загрузил колеса, построенные с использованием последовательности команд в этом ответе, на Github . Установите, используя мой собственный прокси-сервер индекса:

$ pip install spacy blis --extra-index-url=https://hoefling.io/pypi

или используя прямые ссылки:

$ pip install https://github.com/hoefling/so-59927844/releases/download/0.1/blis-0.4.1-cp37-cp37m-linux_armv7l.whl
$ pip install https://github.com/hoefling/so-59927844/releases/download/0.1/spacy-2.2.3-cp37-cp37m-linux_armv7l.whl

Предварительные сведения

$ uname -a
Linux raspberrypi 4.19.57-v7+ #1244 SMP Thu Jul 4 18:45:25 BST 2019 armv7l GNU/Linux

$ python3 -V
Python 3.7.3

$ pip3 -V
pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7)

$ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

Подготовка

Установите компилятор , atlas и создайте новый виртуальный env для сборки:

$ sudo apt install build-essential gfortran libatlas-base-dev virtualenv
$ virtualenv spacy-build --python=python3
$ source spacy-build/bin/activate

Не используйте встроенный модуль venv для создания виртуального env, иначе вам придется настроить параметры компиляции самостоятельно, указывая на env вручную.

blis build

Это следует (более или менее точно) этапам README *1036*.

(spacy-build) $ git clone https://github.com/explosion/cython-blis && cd cython-blis
(spacy-build) $ git pull && git submodule init && git submodule update && git submodule status
(spacy-build) $ pip install -r requirements.txt
(spacy-build) $ export BLIS_ARCH="cortexa57"
(spacy-build) $ ./bin/generate-make-jsonl linux $BLIS_ARCH

проекта. Эта последняя команда должна выполняться без ошибок, генерируя файл $BLIS_ARCH.jsonl с конфигурацией системы (например, cortexa57.jsonl в этом примере). Если эта команда не выполнена, попробуйте более старую арку, например, cortexa53, cortexa15, cortexa9 et c, пока она не подойдет (см. список имен арок ). Например, для моего RPi 3 это cortexa15. После завершения компиляции создайте колесо blis:

(spacy-build) $ python setup.py bdist_wheel

Если команда выполнена успешно, проверьте содержимое dist dir:

(spacy-build) $ ls dist/
blis-0.4.1-cp37-cp37m-linux_armv7l.whl

spacy build

Просто скачайте исходный дистрибутив и создайте из него колесо:

(spacy-build) $ pip wheel spacy --no-binary=spacy --no-build-isolation --find-links=dist/ --wheel-dir=dist/

После завершения сборки dist dir также должен содержать колесо spacy:

(spacy-build) $ ls dist/
blis-0.4.1-cp37-cp37m-linux_armv7l.whl
...
spacy-2.2.3-cp37-cp37m-linux_armv7l.whl

Теперь вы можете скопировать колеса в безопасное место и использовать их повторно, если вам необходимо переустановить blis или spacy. Для установки со встроенных колес введите:

(spacy-build) $ pip install spacy blis --find-links=dist

Проверка установки

После установки spacy со встроенного колеса может быть целесообразно запустить тесты, чтобы убедиться, что вы на самом деле построили что-то полезное. Установите pytest и проверьте зависимости:

(spacy-build) $ pip install pytest pytest-timeout jsonschema mock
(spacy-build) $ pytest $(python -c "import spacy; print(spacy.__path__[0])")

Чтобы запустить тесты, распределенные по всем ядрам и ускорить выполнение, дополнительно установите pytest-xdist и добавьте флаг -nauto к вышеуказанной команде.

0 голосов
/ 27 января 2020

Похоже, установщик Blis пытается скомпилировать для x86_64.

Попробуйте:

BLIS_ARCH="generic" pip3 install --user spacy --no-binary=blis

Это может быть не лучшим способом, если вы хотите все возможные оптимизации для вашего оборудования c. Страница GitHub для Blis содержит больше информации о том, как генерировать аппаратные конфигурации c: https://github.com/explosion/cython-blis#b -building-speci c -support

Также с использованием pip с sudo плохая идея: Каковы риски запуска 'sudo pip'?


Редактировать :

I Я только что попробовал установку на образе fre sh Raspbian Buster, и у меня сработало следующее:

sudo apt update
sudo apt install -y python3-pip libatlas-base-dev
pip3 install --user numpy cython
BLIS_ARCH="generic" pip3 install --user spacy --no-binary=blis
python3 -m spacy info
...