Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no library called cairo-2, Cairo, libcairo-2, #392

Open
tasteitslight opened this issue Jun 23, 2023 · 4 comments
Open

no library called cairo-2, Cairo, libcairo-2, #392

tasteitslight opened this issue Jun 23, 2023 · 4 comments

Comments

@tasteitslight
Copy link

MacOS - This is after brew install cairo

Traceback shows:

OSError: no library called "cairo-2" was found
no library called "cairo" was found
no library called "libcairo-2" was found
cannot load library 'libcairo.so.2': dlopen(libcairo.so.2, 0x0002): tried: 'libcairo.so.2' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibcairo.so.2' (no such file), '/usr/lib/libcairo.so.2' (no such file, not in dyld cache), 'libcairo.so.2' (no such file), '/usr/local/lib/libcairo.so.2' (no such file), '/usr/lib/libcairo.so.2' (no such file, not in dyld cache).  Additionally, ctypes.util.find_library() did not manage to locate a library called 'libcairo.so.2'
cannot load library 'libcairo.2.dylib': dlopen(libcairo.2.dylib, 0x0002): tried: 'libcairo.2.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibcairo.2.dylib' (no such file), '/usr/lib/libcairo.2.dylib' (no such file, not in dyld cache), 'libcairo.2.dylib' (no such file), '/usr/local/lib/libcairo.2.dylib' (no such file), '/usr/lib/libcairo.2.dylib' (no such file, not in dyld cache).  Additionally, ctypes.util.find_library() did not manage to locate a library called 'libcairo.2.dylib'
cannot load library 'libcairo-2.dll': dlopen(libcairo-2.dll, 0x0002): tried: 'libcairo-2.dll' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibcairo-2.dll' (no such file), '/usr/lib/libcairo-2.dll' (no such file, not in dyld cache), 'libcairo-2.dll' (no such file), '/usr/local/lib/libcairo-2.dll' (no such file), '/usr/lib/libcairo-2.dll' (no such file, not in dyld cache).  Additionally, ctypes.util.find_library() did not manage to locate a library called 'libcairo-2.dll'
@infacto
Copy link

infacto commented Jul 11, 2023

Same here. Example:

pip3 install cairosvg

docs

from cairosvg import svg2pdf
svg2pdf(url='./input/test.svg', write_to='./input_tmp/test.png')

Python 3.11.4 - Windows 10

Any idea?

@sildeag
Copy link

sildeag commented Jul 11, 2023

The solution was given in #388 and #329. But a more permeant resolution is possible in the source code to anyone more experienced following the instructions also previously given on this site.

@jdegenstein
Copy link

One possible solution (for windows especially): use pycairo instead of cairocffi the benefit of this on Windows is that it provides a pyd cairo binary in the wheel. I don't know the broader implications of this change, but it could provide a "pure pip" installation method on windows which seems valuable to me.

@maxarvid
Copy link

maxarvid commented Feb 5, 2024

For OSX users: I had the same issue that I managed to solve by setting the following variable in my .zshrc (should be the same if you are using bash in .bashrc or .bash_profile):

export DYLD_LIBRARY_PATH="/opt/homebrew/opt/cairo/lib:$DYLD_LIBRARY_PATH"

My problem (MBP M1) was that the Python shipped with OSX could not resolve packages installed with Homebrew without this. Hopefully it will not disappear on me.

Don't forget the $ source .zshrc once you've added the variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants