Search code examples
pipspacypowerpc

installing spaCy with pip failed with error "Failed building wheel for blis"


Tried to install spaCy with pip (version 20.0.2)

but got error like bellow

gcc -c /tmp/pip-install-f2b27qwm/blis/blis/_src/kernels/zen/1/bli_amaxv_zen_int.c -o /tmp/tmpu1wg8fg1/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-f2b27qwm/blis/blis/_src/include/linux-x86_64
    gcc: error: unrecognized command line option '-mavx2'
    gcc: error: unrecognized command line option '-mfma'
    gcc: error: unrecognized command line option '-mfpmath=sse'
    gcc: error: unrecognized command line option '-march=core-avx2'
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-f2b27qwm/blis/setup.py", line 277, in <module>
        "Topic :: Scientific/Engineering",
      File "/home/{user_name}/.conda/envs/ncn/lib/python3.7/site-packages/setuptools/__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "/home/{user_name}/.conda/envs/ncn/lib/python3.7/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/home/{user_name}/.conda/envs/ncn/lib/python3.7/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/home/{user_name}/.conda/envs/ncn/lib/python3.7/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/home/{user_name}/.conda/envs/ncn/lib/python3.7/site-packages/wheel/bdist_wheel.py", line 192, in run
        self.run_command('build')
      File "/home/{user_name}/.conda/envs/ncn/lib/python3.7/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/home/{user_name}/.conda/envs/ncn/lib/python3.7/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/home/{user_name}/.conda/envs/ncn/lib/python3.7/distutils/command/build.py", line 135, in run
        self.run_command(cmd_name)
      File "/home/{user_name}/.conda/envs/ncn/lib/python3.7/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/home/{user_name}/.conda/envs/ncn/lib/python3.7/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/home/{user_name}/.conda/envs/ncn/lib/python3.7/distutils/command/build_ext.py", line 340, in run
        self.build_extensions()
      File "/tmp/pip-install-f2b27qwm/blis/setup.py", line 103, in build_extensions
        objects = self.compile_objects(compiler.split("-")[0], arch, OBJ_DIR)
      File "/tmp/pip-install-f2b27qwm/blis/setup.py", line 188, in compile_objects
        objects.append(self.build_object(env=env, **spec))
      File "/tmp/pip-install-f2b27qwm/blis/setup.py", line 201, in build_object
        subprocess.check_call(command, cwd=BLIS_DIR)
      File "/home/{user_name}/.conda/envs/ncn/lib/python3.7/subprocess.py", line 347, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['gcc', '-c', '/tmp/pip-install-f2b27qwm/blis/blis/_src/kernels/zen/1/bli_amaxv_zen_int.c', '-o', '/tmp/tmpu1wg8fg1/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-f2b27qwm/blis/blis/_src/include/linux-x86_64']' returned non-zero exit status 1.
    ----------------------------------------
    ERROR: Failed building wheel for blis
    Running setup.py clean for blis 
  Failed to build numpy blis
  ERROR: Could not build wheels for numpy which use PEP 517 and cannot be installed directly
  ----------------------------------------
ERROR: Command errored out with exit status 1: /home/{user_name}/.conda/envs/ncn/bin/python /home/{user_name}/.conda/envs/ncn/lib/python3.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-3j47_tuc/normal --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'cython>=0.25' 'thinc<7.4.0,>=7.3.0' 'preshed<3.1.0,>=3.0.2' 'murmurhash<1.1.0,>=0.28.0' wheel 'cymem<2.1.0,>=2.0.2' Check the logs for full command output.

it seems there are numpy problem

but i already installed numpy(1.16.5) while installing pytorch(1.12.0)

some stackoverflow solutions did not solve the problem (Python Cannot install module spaCy) (Failed building wheel for spacy)

because my machine runs on ppc64le, IBM watson machine. so there are no wheel for my machine. several packages are available (https://public.dhe.ibm.com/ibmdl/export/pub/software/server/ibm-ai/conda/#/) but spaCy is not one of them.

What should I do for installing spaCy?


Solution

  • You may install version 2.2.1 of spacy compiled for ppc64le in the powerai supplementary channel that was recently added.

    conda install -c powerai spacy

    You may also git clone https://github.com/IBM/powerai and modify https://github.com/IBM/powerai/blob/master/conda-recipes/spacy-feedstock/recipe/meta.yaml#L2-L3 to be version 2.1.6 and then conda-build the package yourself if you want that specific version. (You would then run conda-build from the conda-recipes/spacy-feedstock directory to generate the conda package)