是否可以将SpaCy安装到Raspberry Pi 4 Raspbian Buster [英] Is it possible to install SpaCy to Raspberry Pi 4 Raspbian Buster

查看:107
本文介绍了是否可以将SpaCy安装到Raspberry Pi 4 Raspbian Buster的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我整天都无法安装SpaCy.

I have been stuck at installing SpaCy the entire day.

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)体系结构上?

I just wondering is it possible to install it on ARM(armv7l) architecture?

已更新:还尝试从源代码安装,这是错误消息:

updated: also tried to install from source, here is the error:

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/

推荐答案

免责声明

在单个RPi上构建可能会花费很长时间.如果您有一个可用的多个Pi集群,则最好在它们上设置distcc.这也将减少最后一步(通过运行测试来验证构建),因为pytest支持使用pytest-xdist插件在多个主机上运行的分布式测试,因此在集群上运行测试的速度会更快.

Disclaimer

The build might take a long time on a single RPi. If you have a cluster of multiple Pi's available, it may be wise to invest into setting up distcc on them. This will also reduce the last step (verifying the build by running the tests) as pytest supports distributed test running on multiple hosts with the pytest-xdist plugin, so running the tests will pass a lot faster on a cluster.

此外,尽管在x86系统上针对ARM进行交叉编译的速度要快得多,但是正确的设置可能比慢速本机编译花费更多的时间,因此请注意.

Also, although crosscompiling for ARM on a x86 system is a lot more faster option, a proper setup may take a lot more time than the slow native compilation, so beware.

如果您想节省时间,我已经在

If you want to save time, I have uploaded the wheels, built using the command sequence in this answer, on Github. Install using my own index proxy:

$ 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并创建一个用于构建的新虚拟环境:

Preparations

Install the compiler, atlas and create a new virtual env for building:

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

请勿使用内置的venv模块创建虚拟环境,否则您将需要自己调整编译选项,手动指向环境.

Don't use the builtin venv module for the virtual env creation or you will have to adjust the compilation options yourself, pointing to the env manually.

(或多或少地)遵循项目的步骤自述文件.

This follows (more or less exactly) the steps from the project's README.

(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).如果此命令失败,请尝试使用较旧的拱门,例如cortexa53cortexa15cortexa9等直到适合为止(请参见拱门名称列表).例如,对于我的RPi 3,它是cortexa15.编译完成后,构建blis滚轮:

This last command should run without errors, generating the $BLIS_ARCH.jsonl file with system configuration (e.g. cortexa57.jsonl in this example). If this command fails, try an older arch, e.g. cortexa53, cortexa15, cortexa9 etc until it fits (see the list of arch names). For example, for my RPi 3 it's cortexa15. Once the compilation is done, build the blis wheel:

(spacy-build) $ python setup.py bdist_wheel

如果命令成功,请检出dist目录的内容:

If the command succeeds, check out the contents of the dist dir:

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

spacy构建

只需下载源dist并从中构建一个轮子:

spacy build

Simply download the source dist and build a wheel from it:

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

构建完成后,dist目录也应包含spacy滚轮:

Once the build is done, the dist dir should also contain the spacy wheel:

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

现在,您可以将轮子复制到安全的地方,并在需要重新安装blisspacy时重新使用它们.要从内置车轮安装,请发出:

You can now copy the wheels somewhere safe and reuse them when in need of reinstalling blis or spacy. To install from the built wheels, issue:

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

测试安装

从内置的车轮上安装spacy后,最好进行测试以确保您确实构建了可用的东西.安装pytest并测试依赖项:

Testing the installation

After you have installed spacy from your built wheel, it may be wise to run the tests to ensure you have actually built something usable. Install pytest and test dependencies:

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

要运行分布在所有内核上的测试并加快执行速度,请另外安装pytest-xdist并将-nauto标志附加到上述命令中.

To run the tests distributed on all cores ans speedup the execution, install pytest-xdist in addition and append the -nauto flag to the above command.

这篇关于是否可以将SpaCy安装到Raspberry Pi 4 Raspbian Buster的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆