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

2024-05-06

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


更新:也尝试过从源安装 https://spacy.io/usage#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 进行交叉编译是更快的选择,但正确的设置可能比缓慢的本机编译花费更多的时间,所以要小心。

获取预制轮子

如果您想节省时间,我已经上传了使用此答案中的命令序列构建的轮子,位于Github https://github.com/hoefling/so-59927844/releases/tag/0.1。使用我自己的索引代理安装:

$ 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 build

这(或多或少准确地)遵循了项目的步骤README https://github.com/explosion/cython-blis/blob/master/README.md.

(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等等,直到适合为止(参见拱名列表 https://github.com/flame/blis/blob/0.5.1/config_registry)。例如,对于我的 RPi 3 来说是cortexa15。编译完成后,构建blis wheel:

(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/

构建完成后,distdir 还应该包含spacy wheel:

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

您现在可以将轮子复制到安全的地方,并在需要重新安装时重复使用它们blis or 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标记上述命令。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

是否可以将 SpaCy 安装到 Raspberry Pi 4 Raspbian Buster 的相关文章

随机推荐

  • 来自公共字符串的 Android RSA 加密

    我正在开发一个 Android 应用程序 我希望用户能够使用其他人的公钥加密消息 系统将生成公钥 私钥对 然后可以将消息秘密发送给其他用户 我正在创建一个加密类 它将处理消息的加密 解密 不幸的是我遇到了一些问题 在这种方法中 我想传递用户
  • (此时出乎意料 - 批处理脚本

    我正在使用下面的批处理脚本并收到错误 这时候是出乎意料的 我知道问题出在第一行 但我不明白出了什么问题 有任何想法吗 script IF 1 LOOP1 SET P isDefault Value Missing do you want t
  • 使用 use_frameworks 签名错误!和独特的配置文件

    我将最初讨论中的最后一篇文章粘贴到此处 https github com CocoaPods CocoaPods issues 4331 https github com CocoaPods CocoaPods issues 4331 这个
  • Chrome 扩展 - 使用 javascript 定期运行并永久记录数据

    目前 我有一个脚本 当单击右上角托盘中的图像 仅适用于一个特定允许的网站 时 它会扫描 HTML 页面 然后输出一些值 此扫描和输出是单个 JS 文件中的函数 称为 checkData js 即使用户没有主动使用选项卡但它已打开 是否有可能
  • 将 csv 写入谷歌云存储

    我试图了解如何将多行 csv 文件写入谷歌云存储 我只是没有遵循文档 https googlecloudplatform github io google cloud python stable storage blobs html hig
  • 通过 Office API 将多个 Word 文档保存为 HTML

    我有大量的Word文档需要解析 由于它们都是从同一个模板创建的 我认为最好的方法是将它们保存为 HTML 文件并解析 HTML 本身 虽然将单个 Word 文档保存为 HTML 相当容易 但我还没有找到从 Word 内部执行批量过程的方法
  • 使用正则表达式在图像标签周围添加链接

    我想使用 preg replace 在图像标签周围添加链接 Before img href src alt After a href img href src alt a 我将非常感谢任何帮助 非常感谢 这有帮助吗 str img href
  • ToLookup 是否强制立即执行序列

    我正在调查可枚举 ToLookup将可枚举序列转换为字典类型数据结构的 API 更多详情可在这找到 https msdn microsoft com en us library system linq enumerable tolookup
  • 通过 Whatsapp 从 Excel 发送图片

    我们如何通过 Whatsapp 从 Excel 发送图片 我找到了通过以下方式发送消息的vba代码https web whatsapp com https web whatsapp com Sub Test Dim text As Stri
  • Python:从字符串访问变量[重复]

    这个问题在这里已经有答案了 这可能是非常基本和简单的事情 我可能只是在谷歌上搜索错误的术语 但希望这里有人可以帮助我 我仍然是编程的初学者 这从这个问题中可能是显而易见的 我正在寻找一种从字符串访问变量的方法 像这样 A1 B1 C1 my
  • 将 3d 矩阵重塑为 2d 矩阵

    我有一个 3d 矩阵 n by m by t 在 MATLAB 中表示n by m一段时间内网格中的测量值 我想要一个二维矩阵 其中空间信息消失了 只有n m随着时间的推移测量t剩下 即 n m by t 我怎样才能做到这一点 你需要命令r
  • 如何一次又一次地使用同一个迭代器?

    给出下一个代码 这是某个大型方法的一部分 ArrayList
  • Angular Xeditable 下拉菜单 e-ng-change 不起作用

    我在用着角度可编辑 http vitalets github io angular xeditable editable tableapi 我需要根据下拉列表的值更改文本字段的值 但它不起作用 你能告诉我为什么吗 谢谢 Html td sp
  • ASP.NET MVC - ValidateAntiForgeryToken 过期

    在网页中 我们提供一个超链接 GET 用户可以单击该超链接进行身份验证 Html ActionLink Please Login MyMethod MyController 这映射到以下返回视图的控制器方法 RequireHttps pub
  • 不在对象上下文中时使用 $this php

    我刚刚开始学习 php 中的 OOPS 我写了一个简单的程序来实现继承 当不在对象上下文中时 我收到 this 的致命错误 谁能解释一下这个错误 它是什么意思 这是我的代码
  • 空格键在 Excel VBA 编辑器中的行尾不起作用

    我将 Personal xlsb 移至新笔记本电脑 但遇到了一个奇怪的问题 空格键在行尾不起作用 除非它是完全空的行 示例 1 不起作用的示例 不工作 示例 2 工作示例 会工作 当我按空格键时 文本选择指针没有移动 但位置指示器在原始位置
  • C中的内存使用问题

    请帮忙 操作系统 Linux 其中 sleep 1000 中 此时 top 显示Linux任务 给我写了7 7 MEM使用 valgrind 未发现内存泄漏 我明白 写得正确 所有 malloc 结果都是 NULL 但是为什么这次 睡眠 我
  • 如何在 vb.net 中更改 DateTimePicker 的日期格式

    如何更改 vb net 中 DateTimePicker 的日期格式 以便日期以 dd mm 1990 格式显示 没有任何时间值 我尝试将格式更改为 短 虽然这提供了我需要的日期格式 但它不会删除时间 您需要将 DateTimePicker
  • 在 C# 中将“set”添加到接口的属性中

    我希望通过为该接口中的属性提供设置访问器来 扩展 该接口 界面看起来像这样 interface IUser string UserName get 我想要这样的东西 interface IMutableUser IUser string U
  • 是否可以将 SpaCy 安装到 Raspberry Pi 4 Raspbian Buster

    我一整天都在安装 SpaCy sudo pip install U spacy Looking in indexes https pypi org simple https www piwheels org simple Collectin