alpine-python icon indicating copy to clipboard operation
alpine-python copied to clipboard

libffi / ffi.h issue on alpine-python:3.6-onbuild

Open sadsfae opened this issue 7 years ago • 5 comments

I could be doing something wrong but I get the following with a fairly simple requirements.txt and alpine-python:3.6-onbuild. This could be just an issue with upstream pip however?

Short summary

  Installing build dependencies: finished with status 'error'
  Complete output from command /usr/lib/python3.6.6/bin/python3.6 /usr/lib/python3.6.6/lib/python3.6/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-c3okpqft/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel "cffi>=1.4.1; python_implementation != 'PyPy'":

Full log

      Running setup.py install for cffi: finished with status 'error'
      Complete output from command /usr/lib/python3.6.6/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-labi968q/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-t4nbxvbv/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-r9ugyqb3/overlay --compile:
      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
      Package 'libffi', required by 'virtual:world', not 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
      Package 'libffi', required by 'virtual:world', not 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
      Package 'libffi', required by 'virtual:world', not 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
      Package 'libffi', required by 'virtual:world', not 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
      Package 'libffi', required by 'virtual:world', not found
      running install
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-3.6
      creating build/lib.linux-x86_64-3.6/cffi
      copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-3.6/cffi
      copying cffi/model.py -> build/lib.linux-x86_64-3.6/cffi
      copying cffi/commontypes.py -> build/lib.linux-x86_64-3.6/cffi
      copying cffi/error.py -> build/lib.linux-x86_64-3.6/cffi
      copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-3.6/cffi
      copying cffi/cparser.py -> build/lib.linux-x86_64-3.6/cffi
      copying cffi/ffiplatform.py -> build/lib.linux-x86_64-3.6/cffi
      copying cffi/pkgconfig.py -> build/lib.linux-x86_64-3.6/cffi
      copying cffi/vengine_gen.py -> build/lib.linux-x86_64-3.6/cffi
      copying cffi/api.py -> build/lib.linux-x86_64-3.6/cffi
      copying cffi/lock.py -> build/lib.linux-x86_64-3.6/cffi
      copying cffi/__init__.py -> build/lib.linux-x86_64-3.6/cffi
      copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-3.6/cffi
      copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-3.6/cffi
      copying cffi/verifier.py -> build/lib.linux-x86_64-3.6/cffi
      copying cffi/recompiler.py -> build/lib.linux-x86_64-3.6/cffi
      copying cffi/_cffi_include.h -> build/lib.linux-x86_64-3.6/cffi
      copying cffi/parse_c_type.h -> build/lib.linux-x86_64-3.6/cffi
      copying cffi/_embedding.h -> build/lib.linux-x86_64-3.6/cffi
      copying cffi/_cffi_errors.h -> build/lib.linux-x86_64-3.6/cffi
      running build_ext
      building '_cffi_backend' extension
      creating build/temp.linux-x86_64-3.6
      creating build/temp.linux-x86_64-3.6/c
      gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/lib/python3.6.6/include/python3.6m -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.6/c/_cffi_backend.o
      c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory
       #include <ffi.h>
                       ^
      compilation terminated.
      error: command 'gcc' failed with exit status 1
  
      ----------------------------------------
  Command "/usr/lib/python3.6.6/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-labi968q/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-t4nbxvbv/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-r9ugyqb3/overlay --compile" failed with error code 1 in /tmp/pip-install-labi968q/cffi/

Here's my requirements.txt

cherrypy
pyyaml
mongoengine
requests
ipdb
python-wordpress-xmlrpc
python-git
flake8
paramiko
pexpect

Here's my Dockerfile

FROM jfloff/alpine-python:3.6-onbuild

RUN apk upgrade --update
RUN apk add git
WORKDIR /opt

sadsfae avatar Feb 26 '19 12:02 sadsfae

It seems one of those gems is requiring libffi-dev. Have you tried installing that package?

jfloff avatar Feb 26 '19 19:02 jfloff

Hi there, I recently updated the images and libffi-dev is now included. Could you double check if your previous image now works? Feel free to reopen the issue if you still find this problem.

Thank you!

jfloff avatar Mar 09 '19 21:03 jfloff

@jfloff with apk add libffi-dev it works perfectly

bmwant avatar Jun 09 '19 14:06 bmwant

apk add libffi-dev works great on 3.7-alpine too.

ollyjshaw avatar Nov 28 '19 10:11 ollyjshaw

RUN apk add --no-cache libffi-dev

fabdelgado avatar Oct 15 '20 20:10 fabdelgado