pygobject / pycairo

Python bindings for cairo
https://pycairo.readthedocs.io
Other
622 stars 85 forks source link

Import error on Mac Catalina #169

Open mklilley opened 4 years ago

mklilley commented 4 years ago

Hi.

I've been battling with trying to get Cairo to work on my Mac which is running Catalina but am having a really tough time - I hope I'm just being silly and missing something obvious. I could do with a second opinion.

No errors in install.

When I go to run import cairo in python I get the following error

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-381c76bbfa70> in <module>
----> 1 import cairo

~/miniconda3/lib/python3.7/site-packages/cairo/__init__.py in <module>
----> 1 from ._cairo import *  # noqa: F401,F403
      2 
      3 
      4 def get_include():
      5     """Returns a path to the directory containing the C header files"""

ImportError: dlopen(/Users/matt/miniconda3/lib/python3.7/site-packages/cairo/_cairo.cpython-37m-darwin.so, 2): Symbol not found: _cairo_font_options_get_variations
  Referenced from: /Users/matt/miniconda3/lib/python3.7/site-packages/cairo/_cairo.cpython-37m-darwin.so
  Expected in: flat namespace
 in /Users/matt/miniconda3/lib/python3.7/site-packages/cairo/_cairo.cpython-37m-darwin.so

My $PKG_CONFIG_PATH is /usr/local/Cellar/cairo/1.16.0_2/lib/pkgconfig/cairo.pc:/usr/local/opt/icu4c/lib/pkgconfig: so I have a sense that things should be pointing to the right place. However, even when I run brew uninstall cairo I still get the same error message which suggested to me that there was another Cairo hanging around.

When I ran conda list I found a Cairo version 1.14.12.

I just did a force remove of the conda cairo version and I no longer get the error.

Is there a way to point pycairo to the right cairo to use?

Thanks for your time.

Matt

lazka commented 4 years ago

No mac here, so not sure. I don't know if distutils sets an rpath, so my guess is that it uses the cairo it finds in your DYLD_LIBRARY_FALLBACK_PATH env var.

mklilley commented 4 years ago

Thanks @lazka , I appreciate you taking the time to reply

Talal916 commented 3 years ago

@mklilley Were you able to get this working?

mklilley commented 3 years ago

Hi @Talal916 . I gave up on it to be honest. Recently I installed it on a newer mac and it was fine. Thanks for checking back in with me.

Talal916 commented 3 years ago

@mklilley Yeah I'm running into the same issue on my x86 Catalina MacBook pro. Not able to find much info on this specific issue. Is your newer mac an m1 or x86?

mklilley commented 3 years ago

@Talal916 It's an M1. I'm using pycario in the context of this tool https://docs.manim.community/en/stable/installation/macos.html . I followed those instructions and everything worked fine