ERROR: Failed building wheel for cffi

pip 安装gevent时报出这些错:
重点看这个:ERROR: Failed building wheel for cffi

Collecting gevent==20.6.2
  Downloading gevent-20.6.2.tar.gz (5.8 MB)
     |████████████████████████████████| 5.8 MB 3.1 MB/s 
  Installing build dependencies ... error
  ERROR: Command errored out with exit status 1:
   command: /opt/spiderman/venv/bin/python /opt/spiderman/venv/lib/python3.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-dic51yhk/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple --extra-index-url https://www.piwheels.org/simple -- 'setuptools >= 40.8.0' wheel 'Cython >= 3.0a5' 'cffi >= 1.12.3 ; platform_python_implementation == '"'"'CPython'"'"'' 'greenlet >= 0.4.16 ; platform_python_implementation == '"'"'CPython'"'"''
       cwd: None
  Complete output (151 lines):
  Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple, https://www.piwheels.org/simple
  Collecting setuptools>=40.8.0
    Using cached setuptools-50.0.0-py3-none-any.whl (783 kB)
  Collecting wheel
    Downloading wheel-0.35.1-py2.py3-none-any.whl (33 kB)
  Collecting Cython>=3.0a5
    Downloading Cython-3.0a6-py2.py3-none-any.whl (1.0 MB)
  Collecting cffi>=1.12.3
    Downloading cffi-1.14.2.tar.gz (470 kB)
  Collecting greenlet>=0.4.16
    Downloading greenlet-0.4.16.tar.gz (60 kB)
  Collecting pycparser
    Downloading pycparser-2.20-py2.py3-none-any.whl (112 kB)
  Building wheels for collected packages: cffi, greenlet
    Building wheel for cffi (setup.py): started
    Building wheel for cffi (setup.py): finished with status 'error'
    ERROR: Command errored out with exit status 1:
     command: /opt/spiderman/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-1xscxoo3/cffi/setup.py'"'"'; __file__='"'"'/tmp/pip-install-1xscxoo3/cffi/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-n3mt__a_
         cwd: /tmp/pip-install-1xscxoo3/cffi/
    Complete output (56 lines):
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    running bdist_wheel
    running build
    running build_py
    creating build
    creating build/lib.linux-aarch64-3.7
    creating build/lib.linux-aarch64-3.7/cffi
    copying cffi/vengine_cpy.py -> build/lib.linux-aarch64-3.7/cffi
    copying cffi/recompiler.py -> build/lib.linux-aarch64-3.7/cffi
    copying cffi/cffi_opcode.py -> build/lib.linux-aarch64-3.7/cffi
    copying cffi/cparser.py -> build/lib.linux-aarch64-3.7/cffi
    copying cffi/error.py -> build/lib.linux-aarch64-3.7/cffi
    copying cffi/ffiplatform.py -> build/lib.linux-aarch64-3.7/cffi
    copying cffi/vengine_gen.py -> build/lib.linux-aarch64-3.7/cffi
    copying cffi/commontypes.py -> build/lib.linux-aarch64-3.7/cffi
    copying cffi/pkgconfig.py -> build/lib.linux-aarch64-3.7/cffi
    copying cffi/model.py -> build/lib.linux-aarch64-3.7/cffi
    copying cffi/backend_ctypes.py -> build/lib.linux-aarch64-3.7/cffi
    copying cffi/lock.py -> build/lib.linux-aarch64-3.7/cffi
    copying cffi/verifier.py -> build/lib.linux-aarch64-3.7/cffi
    copying cffi/__init__.py -> build/lib.linux-aarch64-3.7/cffi
    copying cffi/setuptools_ext.py -> build/lib.linux-aarch64-3.7/cffi
    copying cffi/api.py -> build/lib.linux-aarch64-3.7/cffi
    copying cffi/_cffi_include.h -> build/lib.linux-aarch64-3.7/cffi
    copying cffi/parse_c_type.h -> build/lib.linux-aarch64-3.7/cffi
    copying cffi/_embedding.h -> build/lib.linux-aarch64-3.7/cffi
    copying cffi/_cffi_errors.h -> build/lib.linux-aarch64-3.7/cffi
    running build_ext
    building '_cffi_backend' extension
    creating build/temp.linux-aarch64-3.7
    creating build/temp.linux-aarch64-3.7/c
    aarch64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/opt/spiderman/venv/include -I/usr/include/python3.7m -c c/_cffi_backend.c -o build/temp.linux-aarch64-3.7/c/_cffi_backend.o
    c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory
     #include <ffi.h>
              ^~~~~~~
    compilation terminated.
    error: command 'aarch64-linux-gnu-gcc' failed with exit status 1
    ----------------------------------------
    ERROR: Failed building wheel for cffi
    Running setup.py clean for cffi
    Building wheel for greenlet (setup.py): started
    Building wheel for greenlet (setup.py): finished with status 'done'
    Created wheel for greenlet: filename=greenlet-0.4.16-cp37-cp37m-linux_aarch64.whl size=49566 sha256=22d37dfd9269a17f6653fc289edf340489127e8dc99744e93163bda7200f42df
    Stored in directory: /root/.cache/pip/wheels/aa/f8/1a/c33dc2f3d0afc0a2a607fadbf177921c8ad6da271d8eef3e3e
  Successfully built greenlet
  Failed to build cffi
  DEPRECATION: Could not build wheels for cffi which do not use PEP 517. pip will fall back to legacy 'setup.py install' for these. pip 21.0 will remove support for this functionality. A possible replacement is to fix the wheel build issue reported above. You can find discussion regarding this at https://github.com/pypa/pip/issues/8368.
  Installing collected packages: setuptools, wheel, Cython, pycparser, cffi, greenlet
      Running setup.py install for cffi: started
      Running setup.py install for cffi: finished with status 'error'
      ERROR: Command errored out with exit status 1:
       command: /opt/spiderman/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-1xscxoo3/cffi/setup.py'"'"'; __file__='"'"'/tmp/pip-install-1xscxoo3/cffi/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-4zt94g4a/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-dic51yhk/overlay --compile --install-headers /tmp/pip-build-env-dic51yhk/overlay/include/site/python3.7/cffi
           cwd: /tmp/pip-install-1xscxoo3/cffi/
      Complete output (56 lines):
      Package libffi was not found in the pkg-config search path.
      Perhaps you should add the directory containing `libffi.pc'
      to the PKG_CONFIG_PATH environment variable
      No package 'libffi' found
      Package libffi was not found in the pkg-config search path.
      Perhaps you should add the directory containing `libffi.pc'
      to the PKG_CONFIG_PATH environment variable
      No package 'libffi' found
      Package libffi was not found in the pkg-config search path.
      Perhaps you should add the directory containing `libffi.pc'
      to the PKG_CONFIG_PATH environment variable
      No package 'libffi' found
      Package libffi was not found in the pkg-config search path.
      Perhaps you should add the directory containing `libffi.pc'
      to the PKG_CONFIG_PATH environment variable
      No package 'libffi' found
      Package libffi was not found in the pkg-config search path.
      Perhaps you should add the directory containing `libffi.pc'
      to the PKG_CONFIG_PATH environment variable
      No package 'libffi' found
      running install
      running build
      running build_py
      creating build
      creating build/lib.linux-aarch64-3.7
      creating build/lib.linux-aarch64-3.7/cffi
      copying cffi/vengine_cpy.py -> build/lib.linux-aarch64-3.7/cffi
      copying cffi/recompiler.py -> build/lib.linux-aarch64-3.7/cffi
      copying cffi/cffi_opcode.py -> build/lib.linux-aarch64-3.7/cffi
      copying cffi/cparser.py -> build/lib.linux-aarch64-3.7/cffi
      copying cffi/error.py -> build/lib.linux-aarch64-3.7/cffi
      copying cffi/ffiplatform.py -> build/lib.linux-aarch64-3.7/cffi
      copying cffi/vengine_gen.py -> build/lib.linux-aarch64-3.7/cffi
      copying cffi/commontypes.py -> build/lib.linux-aarch64-3.7/cffi
      copying cffi/pkgconfig.py -> build/lib.linux-aarch64-3.7/cffi
      copying cffi/model.py -> build/lib.linux-aarch64-3.7/cffi
      copying cffi/backend_ctypes.py -> build/lib.linux-aarch64-3.7/cffi
      copying cffi/lock.py -> build/lib.linux-aarch64-3.7/cffi
      copying cffi/verifier.py -> build/lib.linux-aarch64-3.7/cffi
      copying cffi/__init__.py -> build/lib.linux-aarch64-3.7/cffi
      copying cffi/setuptools_ext.py -> build/lib.linux-aarch64-3.7/cffi
      copying cffi/api.py -> build/lib.linux-aarch64-3.7/cffi
      copying cffi/_cffi_include.h -> build/lib.linux-aarch64-3.7/cffi
      copying cffi/parse_c_type.h -> build/lib.linux-aarch64-3.7/cffi
      copying cffi/_embedding.h -> build/lib.linux-aarch64-3.7/cffi
      copying cffi/_cffi_errors.h -> build/lib.linux-aarch64-3.7/cffi
      running build_ext
      building '_cffi_backend' extension
      creating build/temp.linux-aarch64-3.7
      creating build/temp.linux-aarch64-3.7/c
      aarch64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/opt/spiderman/venv/include -I/usr/include/python3.7m -c c/_cffi_backend.c -o build/temp.linux-aarch64-3.7/c/_cffi_backend.o
      c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory
       #include <ffi.h>
                ^~~~~~~
      compilation terminated.
      error: command 'aarch64-linux-gnu-gcc' failed with exit status 1
      ----------------------------------------
  ERROR: Command errored out with exit status 1: /opt/spiderman/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-1xscxoo3/cffi/setup.py'"'"'; __file__='"'"'/tmp/pip-install-1xscxoo3/cffi/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-4zt94g4a/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-dic51yhk/overlay --compile --install-headers /tmp/pip-build-env-dic51yhk/overlay/include/site/python3.7/cffi Check the logs for full command output.
  ----------------------------------------
ERROR: Command errored out with exit status 1: /opt/spiderman/venv/bin/python /opt/spiderman/venv/lib/python3.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-dic51yhk/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple --extra-index-url https://www.piwheels.org/simple -- 'setuptools >= 40.8.0' wheel 'Cython >= 3.0a5' 'cffi >= 1.12.3 ; platform_python_implementation == '"'"'CPython'"'"'' 'greenlet >= 0.4.16 ; platform_python_implementation == '"'"'CPython'"'"'' Check the logs for full command output.

解决办法是 安装编译依赖:

apt-get install build-essential libssl-dev libffi-dev python-dev
相关文章
添加新评论
取消评论
*
*
*
勇士!消灭0条评论,这么艰巨的任务就靠你了!