-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Cairocffi can't find cairo library #5121
Comments
Thanks for reporting. I finally also got a brand new M2, and funnily, I had no problems with Cairo. I downloaded and ran your example with the steps you outlined, everything builds successfully. Here's the output: squidfunk@squidfunk Downloads/example $ python -m venv venv
squidfunk@squidfunk Downloads/example $ . ./venv/bin/activate
(venv) squidfunk@squidfunk Downloads/example $ pip install -r requirements.lock.txt
Collecting CairoSVG==2.6.0
Using cached CairoSVG-2.6.0-py3-none-any.whl (43 kB)
Collecting Jinja2==3.1.2
Using cached Jinja2-3.1.2-py3-none-any.whl (133 kB)
Collecting Markdown==3.3.7
Using cached Markdown-3.3.7-py3-none-any.whl (97 kB)
Collecting MarkupSafe==2.1.2
Using cached MarkupSafe-2.1.2-cp311-cp311-macosx_10_9_universal2.whl (17 kB)
Collecting Pillow==9.4.0
Using cached Pillow-9.4.0-cp311-cp311-macosx_11_0_arm64.whl (3.0 MB)
Collecting PyYAML==6.0
Using cached PyYAML-6.0-cp311-cp311-macosx_11_0_arm64.whl (167 kB)
Collecting Pygments==2.14.0
Using cached Pygments-2.14.0-py3-none-any.whl (1.1 MB)
Collecting cairocffi==1.4.0
Using cached cairocffi-1.4.0.tar.gz (69 kB)
Preparing metadata (setup.py) ... done
Collecting certifi==2022.12.7
Using cached certifi-2022.12.7-py3-none-any.whl (155 kB)
Collecting cffi==1.15.1
Using cached cffi-1.15.1-cp311-cp311-macosx_11_0_arm64.whl (174 kB)
Collecting charset-normalizer==3.0.1
Using cached charset_normalizer-3.0.1-cp311-cp311-macosx_11_0_arm64.whl (121 kB)
Collecting click==8.1.3
Using cached click-8.1.3-py3-none-any.whl (96 kB)
Collecting colorama==0.4.6
Using cached colorama-0.4.6-py2.py3-none-any.whl (25 kB)
Collecting cssselect2==0.7.0
Using cached cssselect2-0.7.0-py3-none-any.whl (15 kB)
Collecting defusedxml==0.7.1
Using cached defusedxml-0.7.1-py2.py3-none-any.whl (25 kB)
Collecting ghp-import==2.1.0
Using cached ghp_import-2.1.0-py3-none-any.whl (11 kB)
Collecting idna==3.4
Using cached idna-3.4-py3-none-any.whl (61 kB)
Collecting importlib-metadata==6.0.0
Downloading importlib_metadata-6.0.0-py3-none-any.whl (21 kB)
Collecting mergedeep==1.3.4
Using cached mergedeep-1.3.4-py3-none-any.whl (6.4 kB)
Collecting mkdocs-material-extensions==1.1.1
Using cached mkdocs_material_extensions-1.1.1-py3-none-any.whl (7.9 kB)
Collecting mkdocs-material==9.0.15
Downloading mkdocs_material-9.0.15-py3-none-any.whl (7.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 7.7/7.7 MB 2.3 MB/s eta 0:00:00
Collecting mkdocs==1.4.2
Using cached mkdocs-1.4.2-py3-none-any.whl (3.7 MB)
Collecting packaging==23.0
Using cached packaging-23.0-py3-none-any.whl (42 kB)
Requirement already satisfied: pip==22.3.1 in ./venv/lib/python3.11/site-packages (from -r requirements.lock.txt (line 24)) (22.3.1)
Collecting pycparser==2.21
Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB)
Collecting pymdown-extensions==9.9.2
Using cached pymdown_extensions-9.9.2-py3-none-any.whl (219 kB)
Collecting python-dateutil==2.8.2
Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
Collecting pyyaml-env-tag==0.1
Using cached pyyaml_env_tag-0.1-py3-none-any.whl (3.9 kB)
Collecting regex==2022.10.31
Using cached regex-2022.10.31-cp311-cp311-macosx_11_0_arm64.whl (287 kB)
Collecting requests==2.28.2
Using cached requests-2.28.2-py3-none-any.whl (62 kB)
Requirement already satisfied: setuptools==65.6.3 in ./venv/lib/python3.11/site-packages (from -r requirements.lock.txt (line 31)) (65.6.3)
Collecting six==1.16.0
Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting tinycss2==1.2.1
Using cached tinycss2-1.2.1-py3-none-any.whl (21 kB)
Collecting urllib3==1.26.14
Using cached urllib3-1.26.14-py2.py3-none-any.whl (140 kB)
Collecting watchdog==2.3.0
Using cached watchdog-2.3.0-cp311-cp311-macosx_11_0_arm64.whl (90 kB)
Collecting webencodings==0.5.1
Using cached webencodings-0.5.1-py2.py3-none-any.whl (11 kB)
Collecting wheel==0.38.4
Downloading wheel-0.38.4-py3-none-any.whl (36 kB)
Collecting zipp==3.15.0
Downloading zipp-3.15.0-py3-none-any.w
10000
hl (6.8 kB)
Installing collected packages: webencodings, charset-normalizer, zipp, wheel, watchdog, urllib3, tinycss2, six, regex, PyYAML, Pygments, pycparser, Pillow, packaging, mkdocs-material-extensions, mergedeep, MarkupSafe, Markdown, idna, defusedxml, colorama, click, certifi, requests, pyyaml-env-tag, python-dateutil, pymdown-extensions, Jinja2, importlib-metadata, cssselect2, cffi, ghp-import, cairocffi, mkdocs, CairoSVG, mkdocs-material
DEPRECATION: cairocffi is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
Running setup.py install for cairocffi ... done
Successfully installed CairoSVG-2.6.0 Jinja2-3.1.2 Markdown-3.3.7 MarkupSafe-2.1.2 Pillow-9.4.0 PyYAML-6.0 Pygments-2.14.0 cairocffi-1.4.0 certifi-2022.12.7 cffi-1.15.1 charset-normalizer-3.0.1 click-8.1.3 colorama-0.4.6 cssselect2-0.7.0 defusedxml-0.7.1 ghp-import-2.1.0 idna-3.4 importlib-metadata-6.0.0 mergedeep-1.3.4 mkdocs-1.4.2 mkdocs-material-9.0.15 mkdocs-material-extensions-1.1.1 packaging-23.0 pycparser-2.21 pymdown-extensions-9.9.2 python-dateutil-2.8.2 pyyaml-env-tag-0.1 regex-2022.10.31 requests-2.28.2 six-1.16.0 tinycss2-1.2.1 urllib3-1.26.14 watchdog-2.3.0 webencodings-0.5.1 wheel-0.38.4 zipp-3.15.0
[notice] A new release of pip available: 22.3.1 -> 23.0.1
[notice] To update, run: pip install --upgrade pip
(venv) squidfunk@squidfunk Downloads/example $ mkdocs build
WARNING - The "social" plugin needs the "site_url" configuration option to be defined. It will likely not work correctly.
INFO - Cleaning site directory
INFO - Building documentation to directory: /Users/squidfunk/Downloads/example/site
INFO - Documentation built in 0.59 seconds
(venv) squidfunk@squidfunk Downloads/example $ find .cache
.cache
.cache/plugin
.cache/plugin/social
.cache/plugin/social/Roboto-Medium.ttf
.cache/plugin/social/Roboto-Light.ttf
.cache/plugin/social/e8bfc1c7a8cace411c44cf75a4758b35.png # <- successfully generated
.cache/plugin/social/Roboto-Regular.ttf
.cache/plugin/social/Roboto-MediumItalic.ttf
.cache/plugin/social/Roboto-ThinItalic.ttf
.cache/plugin/social/Roboto-BoldItalic.ttf
.cache/plugin/social/Roboto-LightItalic.ttf
.cache/plugin/social/Roboto-Italic.ttf
.cache/plugin/social/Roboto-BlackItalic.ttf
.cache/plugin/social/Roboto-Bold.ttf
.cache/plugin/social/Roboto-Thin.ttf
.cache/plugin/social/Roboto-Black.ttf I just installed |
@bigmike36c did you ever find the cause of this? I am setting a new M1 Mac and running into same issue. |
No, unfortunately I was never able to resolve this issue on my Mac. |
@bigmike36c and @bilal-fazlani - After installing cairo with Homebrew, I had to manually copy the library to a location in my path:
|
@jeichenseerNRX I think you just need to run
|
I wonder however, why Homebrew didn't do that when you installed it. Was there some kind of error message? |
I had the same issue on windows, solved it with these lines: pip install pipwin |
Can confirm the issue is still there on current Mac hardware and OS. I have a new M3 MBP and the only thing that works is the |
I'm successfully running libcairo on my M2. Maybe the M3 is still too new? I'm not using the workaround. However, I'm not using Poetry but good ol' pip, which could be related. |
Just got the same issue as above today on my Mac M1. Also using pip. Resolved via the same workaround. Maybe the cairo install via brew does not really "install" it but just provides the |
@squidfunk Are you by chance using a Homebrew version of Python? I've been looking into this issue for the past couple of hours and have found that Homebrew patches the Python source code to find Homebrew-installed libraries properly, whereas if you use Python installed any other way it does not have this patch. Reproduced with your troubleshooting script, you can see the difference in paths searched: System Python
asdf-installed Python (my main install)
Homebrew Python
For my needs, explicitly using the Homebrew Python for |
Yes, I'm using the Homebrew version of Python. Thanks for sharing more intel on this problem, we should definitely add this to our documentation (cc @katharinalisalin) |
I had this issue too (MBP3), and the suggested workaround didn't work, it kept trying to find the files in a diff. path. I am using my solution was to symlink the curr project directory & where the files were. |
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:
These libraries installed without issue. However, upon running
mkdocs serve
I receive the following error: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:
Related links
Reproduction
example.zip
Steps to reproduce
pip install -r requirements.lock.txt
mkdocs serve
ormkdocs build
Browser
Other
Before submitting
The text was updated successfully, but these errors were encountered: