0

I want to run some library which uses cairocffi package.

However, when I try to run it I get:

OSError: dlopen() failed to load a library: cairo / cairo-2 /

So I've installed cairo using 'brew install cairo'. Then I tried to install py2cairo (1.10.0), (using waf) and got

ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Looking for this error in google gives a lot of pages but regarding Xcode. Finally I found this (later also this. I was then able to install py2cairo using './waf install'.

But I still had the same error, so I went to the cairocffi/init.py and changed line 46 from:

cairo = dlopen(ffi, 'cairo', 'cairo-2')

to:

cairo = dlopen(ffi, 'cairo', 'cairo-2', 'py2cairo')

error changed only to:

OSError: dlopen() failed to load a library: cairo / cairo-2 / py2cairo

I can't see if it was installed properly, but probably not, because I don't see it using

sorted(["%s==%s" % (i.key, i.version) for i in pip.get_installed_distributions()])

which I can understand since I installed it without pip. But I also can't import it in python console either with 'import cairo' or 'import py2cairo'.

I tried 'brew install cairo' and got 'cairo-1.14-0 already installed'. I tried to install py2cairo-1.10.0, can it be the source of problems?

I use Python 2.7.3 and have OS X 10.10.5.

Community
  • 1
  • 1
mstechly
  • 15
  • 8
  • Looking at the [Homebrew package list](http://braumeister.org/search/cairo), it looks you probably also need `brew install py2cairo` to get the Python bindings; `brew install cairo` only gets the underlying graphics library. Have you tried that? – alexwlchan Nov 15 '15 at 16:56
  • Yes, Homebrew told me it is already installed. – mstechly Nov 16 '15 at 14:39

1 Answers1

0

I don't know why, but reinstalling python helped. I updated it to 2.7.11 and the whole process went smoothly.

mstechly
  • 15
  • 8