Skip to content

cffi hard to install on osx #470

@thomasballinger

Description

@thomasballinger

I want to understand this and add it to a FAQ or something because I've been asked twice about it.

(venv)venv [master] $ pip install cffi
Downloading/unpacking cffi
  Downloading cffi-0.8.6.tar.gz (196kB): 196kB downloaded
  Running setup.py (path:/Users/maia/code/venv/build/cffi/setup.py) egg_info for package cffi

Downloading/unpacking pycparser (from cffi)
  Downloading pycparser-2.10.tar.gz (206kB): 206kB downloaded
  Running setup.py (path:/Users/maia/code/venv/build/pycparser/setup.py) egg_info for package pycparser

Installing collected packages: cffi, pycparser
  Running setup.py install for cffi
    building '_cffi_backend' extension
    clang -fno-strict-aliasing -fno-common -dynamic -I/usr/local/include -I/usr/local/opt/sqlite/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DUSE__THREAD -I/usr/include/ffi -I/usr/include/libffi -I/usr/local/Cellar/python/2.7.8_1/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c c/_cffi_backend.c -o build/temp.macosx-10.9-x86_64-2.7/c/_cffi_backend.o
    c/_cffi_backend.c:13:10: fatal error: 'ffi.h' file not found
    #include <ffi.h>
             ^
    1 error generated.
    error: command 'clang' failed with exit status 1
    Complete output from command /Users/maia/code/venv/bin/python2.7 -c "import setuptools, tokenize;__file__='/Users/maia/code/venv/build/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/ck/tdb2gmy56p58xnb6p2yj2lgh0000gn/T/pip-JhJ99M-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/maia/code/venv/bin/../include/site/python2.7:
    running install

running build

running build_py

creating build

creating build/lib.macosx-10.9-x86_64-2.7

creating build/lib.macosx-10.9-x86_64-2.7/cffi

copying cffi/__init__.py -> build/lib.macosx-10.9-x86_64-2.7/cffi

copying cffi/api.py -> build/lib.macosx-10.9-x86_64-2.7/cffi

copying cffi/backend_ctypes.py -> build/lib.macosx-10.9-x86_64-2.7/cffi

copying cffi/commontypes.py -> build/lib.macosx-10.9-x86_64-2.7/cffi

copying cffi/cparser.py -> build/lib.macosx-10.9-x86_64-2.7/cffi

copying cffi/ffiplatform.py -> build/lib.macosx-10.9-x86_64-2.7/cffi

copying cffi/gc_weakref.py -> build/lib.macosx-10.9-x86_64-2.7/cffi

copying cffi/lock.py -> build/lib.macosx-10.9-x86_64-2.7/cffi

copying cffi/model.py -> build/lib.macosx-10.9-x86_64-2.7/cffi

copying cffi/vengine_cpy.py -> build/lib.macosx-10.9-x86_64-2.7/cffi

copying cffi/vengine_gen.py -> build/lib.macosx-10.9-x86_64-2.7/cffi

copying cffi/verifier.py -> build/lib.macosx-10.9-x86_64-2.7/cffi

running build_ext

building '_cffi_backend' extension

creating build/temp.macosx-10.9-x86_64-2.7

creating build/temp.macosx-10.9-x86_64-2.7/c

clang -fno-strict-aliasing -fno-common -dynamic -I/usr/local/include -I/usr/local/opt/sqlite/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DUSE__THREAD -I/usr/include/ffi -I/usr/include/libffi -I/usr/local/Cellar/python/2.7.8_1/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c c/_cffi_backend.c -o build/temp.macosx-10.9-x86_64-2.7/c/_cffi_backend.o

c/_cffi_backend.c:13:10: fatal error: 'ffi.h' file not found

#include <ffi.h>

         ^

1 error generated.

error: command 'clang' failed with exit status 1

----------------------------------------
Cleaning up...
Command /Users/maia/code/venv/bin/python2.7 -c "import setuptools, tokenize;__file__='/Users/maia/code/venv/build/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/ck/tdb2gmy56p58xnb6p2yj2lgh0000gn/T/pip-JhJ99M-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/maia/code/venv/bin/../include/site/python2.7 failed with error code 1 in /Users/maia/code/venv/build/cffi
Storing debug log for failure in /Users/maia/.pip/pip.log

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions