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

Cannot install pygraphviz on Mac OS 10.11.6 #100

Closed
manthis opened this issue Aug 3, 2016 · 21 comments
Closed

Cannot install pygraphviz on Mac OS 10.11.6 #100

manthis opened this issue Aug 3, 2016 · 21 comments

Comments

@manthis
Copy link

manthis commented Aug 3, 2016

I have installed graphviz on my Mac using:

brew install graphviz

Every time I'm trying to install pygraphviz with:

pip install pygraphviz

I get the following results:

          Your Graphviz installation could not be found.

          1) You don't have Graphviz installed:
             Install Graphviz (http://graphviz.org)

          2) Your Graphviz package might incomplete.
             Install the binary development subpackage (e.g. libgraphviz-dev or similar.)

          3) You are using Windows
             There are no PyGraphviz binary packages for Windows but you might be
             able to build it from this source.  See
             http://networkx.lanl.gov/pygraphviz/reference/faq.html

          If you think your installation is correct you will need to manually
          change the include_dirs and library_dirs variables in setup.py to
          point to the correct locations of your graphviz installation.

          The current setting of library_dirs and include_dirs is:
          library_dirs=None
          include_dirs=None

          error: Error locating graphviz.

I have tried to specify library_path and include_path with the following command:

pip install graphviz --install-option="--include-path=/usr/local/include/graphviz/" --install-option="--library-path=/usr/local/lib/graphviz"

But it tells me:

error: option --include-path not recognized

I have tried with "include-dirs" and "library_dirs" too but without success.
How can I install it successfully? Should I built it from source?

@jiangpengnju
Copy link

$ pip install --install-option="--include-path=/usr/local/include/" --install-option="--library-path=/usr/local/lib/" pygraphviz

Both path in bold should NOT contain "graphviz".

@manthis
Copy link
Author

manthis commented Aug 5, 2016

@jiangpengnju

Actually paths should include "graphviz". My mistake was that I was trying to install graphviz with pip instead of pygraphviz. Sorry for the inconvenience.

@szeitlin
Copy link

fwiw I just had the same problem - was following the dask tutorial and initially tried installing pygraphviz and graphviz inside a conda env. That didn't work - but installing them both globally seems to have solved it. I also added the graphviz path to my .bash_profile, not sure if that was really necessary.

@hagberg hagberg closed this as completed Nov 4, 2016
@iamihgam
Copy link

iamihgam commented Apr 6, 2018

Use
conda install pygraphviz.
It solved the problem for me.

@jolespin
Copy link

@iamihgam what conda, python, and operating system/version do you have?

I have

(python3_test) jespinozlt-osx:~ jespinoz$ conda install pygraphviz
Solving environment: failed

UnsatisfiableError: The following specifications were found to be in conflict:
  - defaults/osx-64::dbus==1.12.2=h5243cc1_1
  - pygraphviz
  - r/osx-64::r-xtable==1.8_2=r342hb9d8108_0
Use "conda info <package>" to see the dependencies for each package.

Here are my versions:

(python3_test) jespinozlt-osx:~ jespinoz$ conda --version
conda 4.4.10
(python3_test) jespinozlt-osx:~ jespinoz$ python --version
Python 3.6.4 :: Anaconda, Inc.
(python3_test) jespinozlt-osx:~ jespinoz$ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.11.6

@iamihgam
Copy link

@jolespin
conda version : conda 4.5.0
Python 3.6.4 :: Anaconda custom (x86_64)
Mac version : El capitan version : 10.11.6

@iamihgam
Copy link

tryp updating conda

@jolespin
Copy link

Just updated my conda :(

(python3_test) jespinozlt-osx:~ jespinoz$ conda --version
conda 4.5.0
(python3_test) jespinozlt-osx:~ jespinoz$ conda install pygraphviz
Solving environment: failed

UnsatisfiableError: The following specifications were found to be in conflict:
  - defaults/osx-64::dbus==1.12.2=h5243cc1_1
  - pygraphviz
  - r/osx-64::r-xtable==1.8_2=r342hb9d8108_0
Use "conda info <package>" to see the dependencies for each package.

I think it has to do with my backend?

@abrahamrhoffman
Copy link

abrahamrhoffman commented Apr 27, 2018

For me, brew install placed the bin appropriately, but when I attempted to pip3 install pygraphviz in my virtualenv, I got the error: Error locating graphviz. error. The fix was installing with the appropriate --install-options (as mentioned by @jiangpengnju):

pip3 install --install-option="--include-path=/usr/local/include/" --install-option="--library-path=/usr/local/lib/" pygraphviz

Thank you for the help!

@jolespin
Copy link

jolespin commented Apr 27, 2018

Thanks @abrahamrhoffman I tried my version of this but still got an error:

pip install --install-option="--include-path=~/anaconda/envs/python3_test/include/graphviz/" --install-option="--library-path=~/anaconda/envs/python3_test/lib/graphviz/" pygraphviz

It looks like the original source for this is:
https://pygraphviz.github.io/documentation/development/install.html

Installation error:

(python3_test) jespinozlt-osx:~ jespinoz$ pip install --install-option="--include-path=~/anaconda/envs/python3_test/include/graphviz/" --install-option="--library-path=~/anaconda/envs/python3_test/lib/graphviz/" pygraphviz
/Users/jespinoz/anaconda/envs/python3_test/lib/python3.6/site-packages/pip/commands/install.py:194: UserWarning: Disabling all use of wheels due to the use of --build-options / --global-options / --install-options.
  cmdoptions.check_install_build_global(options)
Collecting pygraphviz
  Downloading https://files.pythonhosted.org/packages/98/bb/a32e33f7665b921c926209305dde66fe41003a4ad934b10efb7c1211a419/pygraphviz-1.3.1.tar.gz (103kB)
    100% |████████████████████████████████| 112kB 1.4MB/s
Skipping bdist_wheel for pygraphviz, due to binaries being disabled for it.
Installing collected packages: pygraphviz
  Running setup.py install for pygraphviz ... error
    Complete output from command /Users/jespinoz/anaconda/envs/python3_test/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/6z/5vbtz_gmkr76ftgc3149dvtr0003c0/T/pip-build-cb44s6jl/pygraphviz/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/6z/5vbtz_gmkr76ftgc3149dvtr0003c0/T/pip-kyj15wnc-record/install-record.txt --single-version-externally-managed --compile --include-path=~/anaconda/envs/python3_test/include/graphviz/ --library-path=~/anaconda/envs/python3_test/lib/graphviz/:
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.9-x86_64-3.6
    creating build/lib.macosx-10.9-x86_64-3.6/pygraphviz
    copying pygraphviz/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz
    copying pygraphviz/agraph.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz
    copying pygraphviz/graphviz.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz
    copying pygraphviz/release.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz
    copying pygraphviz/version.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz
    creating build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
    copying pygraphviz/tests/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
    copying pygraphviz/tests/test.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
    copying pygraphviz/tests/test_attribute_defaults.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
    copying pygraphviz/tests/test_attributes.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
    copying pygraphviz/tests/test_clear.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
    copying pygraphviz/tests/test_drawing.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
    copying pygraphviz/tests/test_edge_attributes.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
    copying pygraphviz/tests/test_graph.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
    copying pygraphviz/tests/test_html.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
    copying pygraphviz/tests/test_layout.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
    copying pygraphviz/tests/test_node_attributes.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
    copying pygraphviz/tests/test_readwrite.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
    copying pygraphviz/tests/test_string.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
    copying pygraphviz/tests/test_subgraph.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
    copying pygraphviz/tests/test_unicode.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
    running egg_info
    writing pygraphviz.egg-info/PKG-INFO
    writing dependency_links to pygraphviz.egg-info/dependency_links.txt
    writing top-level names to pygraphviz.egg-info/top_level.txt
    reading manifest file 'pygraphviz.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    warning: no previously-included files matching '*~' found anywhere in distribution
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    warning: no previously-included files matching '.svn' found anywhere in distribution
    no previously-included directories found matching 'doc/build'
    writing manifest file 'pygraphviz.egg-info/SOURCES.txt'
    copying pygraphviz/graphviz.i -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz
    copying pygraphviz/graphviz_wrap.c -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz
    running build_ext
    building 'pygraphviz._graphviz' extension
    creating build/temp.macosx-10.9-x86_64-3.6
    creating build/temp.macosx-10.9-x86_64-3.6/pygraphviz
    x86_64-apple-darwin13.4.0-clang -DNDEBUG -fwrapv -O2 -Wall -Wstrict-prototypes -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9 -I~/anaconda/envs/python3_test/include/graphviz/ -I/Users/jespinoz/anaconda/envs/python3_test/include/python3.6m -c pygraphviz/graphviz_wrap.c -o build/temp.macosx-10.9-x86_64-3.6/pygraphviz/graphviz_wrap.o
    pygraphviz/graphviz_wrap.c:2954:10: fatal error: 'graphviz/cgraph.h' file not found
    #include "graphviz/cgraph.h"
             ^~~~~~~~~~~~~~~~~~~
    1 error generated.
    error: command 'x86_64-apple-darwin13.4.0-clang' failed with exit status 1

    ----------------------------------------
Command "/Users/jespinoz/anaconda/envs/python3_test/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/6z/5vbtz_gmkr76ftgc3149dvtr0003c0/T/pip-build-cb44s6jl/pygraphviz/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/6z/5vbtz_gmkr76ftgc3149dvtr0003c0/T/pip-kyj15wnc-record/install-record.txt --single-version-externally-managed --compile --include-path=~/anaconda/envs/python3_test/include/graphviz/ --library-path=~/anaconda/envs/python3_test/lib/graphviz/" failed with error code 1 in /private/var/folders/6z/5vbtz_gmkr76ftgc3149dvtr0003c0/T/pip-build-cb44s6jl/pygraphviz/

@abrahamrhoffman
Copy link

You're welcome @jolespin : Try removing graphviz and reinstalling it. Might do the trick.

@jolespin
Copy link

Finally got it working :) for my conda environment

# PyGraphViz
conda install graphviz --yes
pip download git+git://github.com/pygraphviz/pygraphviz.git#egg=pygraphviz
unzip pygraphviz*.zip
cd pygraphviz
python setup.py install --include-path=$CONDA_PREFIX/include --library-path=$CONDA_PREFIX/lib
pip install pydot

@ddahan
Copy link

ddahan commented Sep 12, 2018

I have the same problem but I'm using pipenv. How to solve this in that case?

@newwhitecheng
Copy link

conda install pygraphviz
thank me later

@jolespin
Copy link

conda install pygraphviz
thank me later

lol, look at my comment from Apr 10, 2018. They may have changed it since then but I doubt it.

@VikiMoney
Copy link

fwiw, I had these same issues on my mac today. I found that I wasn't able to install pygraphviz using pip, but pip3 worked. I don't use conda. :)

@rsska
Copy link

rsska commented Nov 12, 2019

anybody had luck with MacPorts?
pip install previously mentioned end up with

...
  pip install pygraphviz --install-option="--include-path=/usr/include/graphviz" --install-option="--library-path=/usr/lib/graphviz/"
    
            The current setting of library_dirs and include_dirs is:
    library_dirs=None
    include_dirs=None
    
    error: Error locating graphviz."

when I try:
pip install pygraphviz --install-option="--include-path=/usr/include/graphviz" --install-option="--library-path=/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/graphviz"

I get

...
pygraphviz/graphviz_wrap.c:2987:10: fatal error: 'graphviz/cgraph.h' file not found
    #include "graphviz/cgraph.h"
             ^
    1 error generated.
    error: command 'gcc' failed with exit status 1

@rsska
Copy link

rsska commented Nov 12, 2019

... answering myself... was did the port py37-pygraphviz - (but did not have the sys.path set to the right directory, so was stuck somewhere between what was said above.)

@em1208
Copy link

em1208 commented Aug 16, 2021

I tried

pip install --install-option="--include-path=/usr/local/include/" --install-option="--library-path=/usr/local/lib/" pygraphviz

but it didn't work, got the error

error: option --include-path not recognized

with pip 21.2.4 on macOS 11.5. Instead the command

pip install pygraphviz --global-option=build_ext --global-option="-I/usr/local/include" --global-option="-L/usr/local/lib"

worked like a charm.

@as595
Copy link

as595 commented Nov 17, 2021

Thank you @em1208! This solution worked for me too.

@xxdsgllysltjjyyds
Copy link

The brew install did not worked any more on MacOS.
https://reimbar.org/dev/graphviz/
This worked for me!

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

No branches or pull requests