From 8493d00925fc81f769cd02bce846807b7fca50c7 Mon Sep 17 00:00:00 2001 From: Yassine Ilmi <9211413+yilmi@users.noreply.github.com> Date: Fri, 15 Sep 2023 01:01:17 +0200 Subject: [PATCH] MacOS fix pygraphviz missing headers --- docs/Troubleshooting.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/Troubleshooting.md b/docs/Troubleshooting.md index bccfbad2..750d463d 100644 --- a/docs/Troubleshooting.md +++ b/docs/Troubleshooting.md @@ -34,11 +34,25 @@ echo "C:\Program Files\Graphviz\bin" >> $PATH ``` Installing the `pygraphviz` lib setting the OS files location: - ```shell pip install --global-option=build_ext --global-option="-IC:\Program files\Graphviz\include" --global-option="-LC:\Program files\Graphviz\lib" pygraphviz ``` +When on MacOS the pygraphviz compilation steps may fail because it can't find the graphviz headers. + +First, make sure you have graphviz installed, for homebrew run: +```shell +brew install graphviz +``` + +Export the compilation flags to tell pip's build process where to find the headers: +```shell +export CFLAGS="-I $(brew --prefix graphviz)/include" +export LDFLAGS="-L $(brew --prefix graphviz)/lib" +``` + +You can now either try installing startleft (which will pull pygraphviz as a dependency) or install pygraphviz with `pip install pygraphviz`, in the same terminal. + --- ### `pygraphviz/graphviz_wrap.c:154:11: fatal error: Python.h: No such file or directory`