Search code examples
pythonmacosapple-m1cairo

OSError: no library called "cairo-2" was found - I am using mac m1 chip


I tried to install it using brew: brew install cairo.

Then added the following line to my .bashrc and .zshrc file:

export DYLD_FALLBACK_LIBRARY_PATH=/usr/local/lib:$DYLD_FALLBACK_LIBRARY_PATH

But it is still giving me the same error.

I even tried those:

  1. brew install cairo pango gdk-pixbuf libxml2 libxslt libffi

  2. pip install pipwin pipwin install cairocffi

I tried to run a flask project which had some dependencies in a mac m1 and it is giving me this error


Solution

  • You have to go to your Applications -> Utilities in your mac and there will be Terminal right click it click Get Info then check Open using Rosetta.

    Then open a terminal and write:

    brew install cairo
    brew install pango
    

    To do this you should have installed Homebrew you can check the brew docs.