question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pip installation of cairocffi not working on mac

See original GitHub issue

I tried to install cairocffi on Mac. I am getting error while importing cairocffi.

Below are environment details: Model: MacBook Pro OS X: 10.8.5 Python: 2.7.2

Command Log: <snip> sudo pip install cairocffi

…some warnings …

    35 warnings generated.
    clang -bundle -undefined dynamic_lookup -Wl,-F. -arch i386 -arch x86_64 build/temp.macosx-10.8-intel-2.7/c/_cffi_backend.o -L/opt/local/lib -lffi -o build/lib.macosx-10.8-intel-2.7/_cffi_backend.so
    ld: warning: ignoring file /opt/local/lib/libffi.dylib, file was built for x86_64 which is not the architecture being linked (i386): /opt/local/lib/libffi.dylib

  Running setup.py install for pycparser

Successfully installed cairocffi cffi pycparser
Cleaning up...
SymMacToolkit-C02K824VF1G3:specs nitin_bodke$ python
Python 2.7.2 (default, Oct 11 2012, 20:14:37) 
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cairocffi
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/cairocffi/__init__.py", line 39, in <module>
    cairo = dlopen(ffi, 'libcairo.so.2', 'libcairo-2.dll', 'cairo', 'libcairo-2')
  File "/Library/Python/2.7/site-packages/cairocffi/__init__.py", line 34, in dlopen
    return ffi.dlopen(names[0])  # pragma: no cover
  File "/Library/Python/2.7/site-packages/cffi/api.py", line 117, in dlopen
    lib, function_cache = _make_ffi_library(self, name, flags)
  File "/Library/Python/2.7/site-packages/cffi/api.py", line 399, in _make_ffi_library
    backendlib = backend.load_library(name, flags)
OSError: cannot load library libcairo.so.2: dlopen(libcairo.so.2, 2): image not found
>>> 
</snip>

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:24 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
Eimisascommented, Jul 4, 2022

@SebaRGFSL

The following export fixed the issue for me:

export DYLD_FALLBACK_LIBRARY_PATH=/opt/homebrew/lib

Make sure you have libcairo dependencies within homebrew location (or change it accordingly depending on your setup)

2reactions
khinkcommented, Feb 18, 2015

… but

export DYLD_FALLBACK_LIBRARY_PATH=/opt/local/lib

fixed it for me. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Overview — cairocffi 1.4.0 documentation - Read the Docs
cairocffi requires CFFI, which can be installed with pip but has its own dependencies that can be tricky to install. On Linux, install...
Read more >
How to pip install cairocffi? - python - Stack Overflow
You'll need to install libffi and libffi-dev through your distro's package manager ( yum , apt-get , whatever) before the pip installation will...
Read more >
cairocffi - PyPI
cairocffi is a CFFI-based drop-in replacement for Pycairo, a set of Python bindings and object-oriented API for cairo. Cairo is a 2D vector...
Read more >
Using Python's pip to Manage Your Projects' Dependencies
It's not installed by default with the interpreter. ... Note: Before you start any troubleshooting when the pip command doesn't work, ...
Read more >
André E. Veltstra: "Hello, #python folks! Anyone r…" - Mastodon
(I run an OLD MacOs, with python 3.9 and other tools installed using ... pip installation of cairocffi not working on mac ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found