dora-metrics / pelorus

Automate the measurement of organizational behavior
https://pelorus.readthedocs.io/
Apache License 2.0
245 stars 83 forks source link

mkdocs serve fails to import libcairo on certain mac setups #1073

Open KevinMGranger opened 1 year ago

KevinMGranger commented 1 year ago

OpenShift version

Not related to OpenShift

Problem description

@prakritikoller was having trouble with mkdocs serve, and got a traceback ending with the following: (ignore the mis-formatting)

../pelorus/.venv/lib/python3.10/site-packages/cairocffi/__init__.py", line 44, in dlopen
raise OSError(error_message)  # pragma: no cover
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/lib/libcairo.so.2' (no such file, not in dyld cache)                                                                                                                                                           cannot load library 'libcairo.2.dylib': dlopen(libcairo.2.dylib, 0x0002): tried: 'libcairo.2.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibcair
o.2.dylib' (no such file), '/usr/lib/libcairo.2.dylib' (no such file, not in dyld cache), 'libcairo.2.dylib' (no such file), '/usr/lib/libcairo.2.dylib' (no such file, not in dyld cache)                                                                                                                                      cannot load library 'libcairo-2.dll': dlopen(libcairo-2.dll, 0x0002): tried: 'libcairo-2.dll' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibcairo-2.dl
l' (no such file), '/usr/lib/libcairo-2.dll' (no such file, not in dyld cache), 'libcairo-2.dll' (no such file), '/usr/lib/libcairo-2.dll' (no such file, not in dyld cache)

We did find a workaround, though! export DYLD_FALLBACK_LIBRARY_PATH=/opt/homebrew/lib.

I don't know why or when that's necessary, but we should consider documenting it. Or at least finding the root cause.

Steps to reproduce

  1. make
  2. . .venv/bin/activate
  3. make system-doc-deps (do we document this requirement, btw?)
  4. mkdocs serve

Current behavior

On some setups, the above traceback occurs. Strangely enough, it did not happen for me.

Expected behavior

mkdocs... serves.

Code of Conduct

shaloo commented 1 year ago

After sonoma upgrade I see this very same error for libcairo-2 lib

Worked with export DYLD_FALLBACK_LIBRARY_PATH=$DYLD_FALLBACK_LIBRARY_PATH:/opt/homebrew/Cellar/cairo/1.16.0_5/lib