mkdocs-material: Cairocffi can't find cairo library
Context
I’m running mkdocs locally on my M1 mac and using poetry to manage my virtual environment. The same issue occurs if you use pip.
Bug description
To use the social plugin, mkdocs requires installing pillow and cairosvg. Additionally, Cairo Graphics and its dependencies must be installed as stated in the docs. I’m using an M1 mac so I used the following command:
brew install cairo freetype libffi libjpeg libpng zlib
These libraries installed without issue. However, upon running mkdocs serve I receive the following error:
OSError: no library called "cairo-2" was found
no library called "cairo" was found
no library called "libcairo-2" was found
It appears to be looking for these libraries inside of the python installation instead of inside the homebrew folder. My current workaround is to use the following environment variable as mentioned in this issue:
export DYLD_FALLBACK_LIBRARY_PATH=/opt/homebrew/lib
Related links
Reproduction
Steps to reproduce
- Create a virtual environment
- Run
pip install -r requirements.lock.txt - Run
mkdocs serveormkdocs build
Browser
Other
Before submitting
- I have read and followed the bug reporting guidelines.
- I have attached links to the documentation, and possibly related issues and discussions.
- I assure that I have removed all customizations before submitting this bug report.
- I have attached a .zip file with a minimal reproduction.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 6
- Comments: 15 (5 by maintainers)
@bigmike36c and @bilal-fazlani - After installing cairo with Homebrew, I had to manually copy the library to a location in my path:
cp /opt/homebrew/Cellar/cairo/1.16.0_5/lib/libcairo.2.dylib /usr/local/libNo, unfortunately I was never able to resolve this issue on my Mac.
@bigmike36c did you ever find the cause of this? I am setting a new M1 Mac and running into same issue.