python - 是否可以将 SpaCy 安装到 Raspberry Pi 4 Raspbian Buster

标签 python python-3.x raspberry-pi arm spacy

我整天都在安装 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) 架构上安装它?


更新:也试过install from source ,这里是错误:

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 插件在多个主机上运行分布式测试,因此运行测试在集群上会通过得更快。

此外,虽然在 x86 系统上针对 ARM 进行交叉编译是一种更快的选择,但正确的设置可能比缓慢的 native 编译花费更多的时间,所以要小心。

获取预制轮子

如果您想节省时间,我已经在 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 并创建一个用于构建的新虚拟环境:

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

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

blis 构建

这遵循(或多或少)项目的 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 等直到适合(参见 list of arch names)。例如,对于我的 RPi 3,它是 cortexa15。编译完成后,构建 blis 轮:

(spacy-build) $ python setup.py bdist_wheel

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

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

spacy 构建

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

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

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

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

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

(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 标志附加到上述命令。

关于python - 是否可以将 SpaCy 安装到 Raspberry Pi 4 Raspbian Buster,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59927844/

相关文章:

linux - 如何在tornado上使用epoll

linux - 相当于 OpenELEC 上的 apt-get

python - 如何在 Sphinx Docs 中显示 Matrix?

python - 如何在 Debian/Ubuntu 中为我的 python 应用程序定义图标?

python - 如何从 csv 中读取字节对象?

c - 来自 NULL 的错误消息

c++ - opencv2/photo/photo.hpp c++​​ 的条件包含取决于 OpenCV 版本

python - 谷歌日历 API : Error code 403: The request is missing a valid API key

Python使用 'from ... import *'链接相同解决方案中的两个项目

python - 函数的monkeypatching中的setattr抛出属性错误