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

Graphviz cgraph.h not found #155

Closed
parthi2929 opened this issue May 7, 2018 · 27 comments
Closed

Graphviz cgraph.h not found #155

parthi2929 opened this issue May 7, 2018 · 27 comments
Milestone

Comments

@parthi2929
Copy link

parthi2929 commented May 7, 2018

Hi

I tried installing pygraphviz with below command and different variations but all in vain

pip install pygraphviz --install-option="--include-path=C:\Program Files (x86)\Graphviz2.38\include\graphviz" --install-option="--library-path=C:\Program Files (x86)\Graphviz2.38\lib" 

Error:

pygraphviz/graphviz_wrap.c(2954): fatal error C1083: Cannot open include file: 'graphviz/cgraph.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.13.26128\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2

Kindly help

@SaintNazaire
Copy link

SaintNazaire commented May 10, 2018

Reproduced the error independently.
Clearly c_graph.h header file missing.
@hagberg, @mmarkov do you have copy of it?
Any information as to portability to Python 3.6?

@parthi2929
Copy link
Author

parthi2929 commented May 11, 2018

The cgraph files is available in the path mentioned.
also note that, installed graphviz is x86 (which is only officially available).

@SaintNazaire
Copy link

SaintNazaire commented May 11, 2018

@parthi2929, sorry bu the cgraph.h file isn't available on my end.
Could you let me know in which folder you found it?
Roger on x86.

@parthi2929
Copy link
Author

parthi2929 commented May 12, 2018

you could find it here
C:\Program Files (x86)\Graphviz2.38\include\graphviz

@Frackup
Copy link

Frackup commented Sep 20, 2018

Hi,
Same issue for me. I tried all I could find through the web (and I checked many threads about that problem).
I tried installing pygraphviz through pip (not working, same issue),
python -m pip install --global-option=build_ext --global-option="-IC:\Program Files (x86)\Graphviz2.38\include" --global-option="-LC:\Program Files (x86)\Graphviz2.38\lib\release\lib" pygraphviz

tried donwloading it and installing it (not working).
python setup.py install --include-path="C:\Program Files (x86)\Graphviz2.38\include\graphviz" --library-path="C:\Program Files (x86)\Graphviz2.38\lib\release\lib"

Tried also to modify the files as mentionned here (not working, same issue).

I tried downloading and replacing files in graphviz (not pygraphviz) with a x64 version (not working).

As mentionned by Parthi2929, the file is present in the include folder

This issue is making me slightly mad, please help :).

@tribbloid
Copy link

tribbloid commented Feb 7, 2019

also affects me (except that I'm using Ubuntu 18.04 + virtualenv, with graphviz already installed):

$ pip install pygraphviz
Collecting pygraphviz
  Using cached https://files.pythonhosted.org/packages/7e/b1/d6d849ddaf6f11036f9980d433f383d4c13d1ebcfc3cd09bc845bda7e433/pygraphviz-1.5.zip
Installing collected packages: pygraphviz
  Running setup.py install for pygraphviz ... error
    Complete output from command /home/peng/git/convnet-abstraction/venv/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-_7wwjl1o/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 /tmp/pip-record-xl7438zl/install-record.txt --single-version-externally-managed --compile --install-headers /home/peng/git/convnet-abstraction/venv/include/site/python3.6/pygraphviz:
    running install
    Trying dpkg
    include_dirs=None
    library_dirs=/usr/lib/python3/dist-packages/pygraphviz
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.6
    creating build/lib.linux-x86_64-3.6/pygraphviz
    copying pygraphviz/agraph.py -> build/lib.linux-x86_64-3.6/pygraphviz
    copying pygraphviz/graphviz.py -> build/lib.linux-x86_64-3.6/pygraphviz
    copying pygraphviz/version.py -> build/lib.linux-x86_64-3.6/pygraphviz
    copying pygraphviz/__init__.py -> build/lib.linux-x86_64-3.6/pygraphviz
    copying pygraphviz/release.py -> build/lib.linux-x86_64-3.6/pygraphviz
    creating build/lib.linux-x86_64-3.6/pygraphviz/tests
    copying pygraphviz/tests/test_unicode.py -> build/lib.linux-x86_64-3.6/pygraphviz/tests
    copying pygraphviz/tests/test_drawing.py -> build/lib.linux-x86_64-3.6/pygraphviz/tests
    copying pygraphviz/tests/test_node_attributes.py -> build/lib.linux-x86_64-3.6/pygraphviz/tests
    copying pygraphviz/tests/test_attribute_defaults.py -> build/lib.linux-x86_64-3.6/pygraphviz/tests
    copying pygraphviz/tests/test_setup.py -> build/lib.linux-x86_64-3.6/pygraphviz/tests
    copying pygraphviz/tests/test_attributes.py -> build/lib.linux-x86_64-3.6/pygraphviz/tests
    copying pygraphviz/tests/test_string.py -> build/lib.linux-x86_64-3.6/pygraphviz/tests
    copying pygraphviz/tests/test.py -> build/lib.linux-x86_64-3.6/pygraphviz/tests
    copying pygraphviz/tests/test_graph.py -> build/lib.linux-x86_64-3.6/pygraphviz/tests
    copying pygraphviz/tests/test_subgraph.py -> build/lib.linux-x86_64-3.6/pygraphviz/tests
    copying pygraphviz/tests/test_clear.py -> build/lib.linux-x86_64-3.6/pygraphviz/tests
    copying pygraphviz/tests/test_layout.py -> build/lib.linux-x86_64-3.6/pygraphviz/tests
    copying pygraphviz/tests/test_html.py -> build/lib.linux-x86_64-3.6/pygraphviz/tests
    copying pygraphviz/tests/test_readwrite.py -> build/lib.linux-x86_64-3.6/pygraphviz/tests
    copying pygraphviz/tests/__init__.py -> build/lib.linux-x86_64-3.6/pygraphviz/tests
    copying pygraphviz/tests/test_edge_attributes.py -> build/lib.linux-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 files found matching '*.png' under directory 'doc'
    warning: no files found matching '*.html' under directory 'doc'
    warning: no files found matching '*.txt' under directory 'doc'
    warning: no files found matching '*.css' under directory 'doc'
    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.linux-x86_64-3.6/pygraphviz
    copying pygraphviz/graphviz_wrap.c -> build/lib.linux-x86_64-3.6/pygraphviz
    running build_ext
    building 'pygraphviz._graphviz' extension
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/pygraphviz
    gcc -pthread -B /home/shared/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/peng/git/convnet-abstraction/venv/include -I/home/shared/anaconda3/include/python3.6m -c pygraphviz/graphviz_wrap.c -o build/temp.linux-x86_64-3.6/pygraphviz/graphviz_wrap.o
    pygraphviz/graphviz_wrap.c:2987:10: fatal error: graphviz/cgraph.h: No such file or directory
     #include "graphviz/cgraph.h"
              ^~~~~~~~~~~~~~~~~~~
    compilation terminated.
    error: command 'gcc' failed with exit status 1
    
    ----------------------------------------
Command "/home/peng/git/convnet-abstraction/venv/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-_7wwjl1o/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 /tmp/pip-record-xl7438zl/install-record.txt --single-version-externally-managed --compile --install-headers /home/peng/git/convnet-abstraction/venv/include/site/python3.6/pygraphviz" failed with error code 1 in /tmp/pip-install-_7wwjl1o/pygraphviz/

@kitaev-chen
Copy link

kitaev-chen commented Apr 3, 2019

conda install pygraphviz might be easier

@tan-wei
Copy link

tan-wei commented Apr 22, 2019

The same for me. Clearly, I have told python setup.py install --include-path="C:\Program Files (x86)\Graphviz2.38\include\", however, it still complains that "Cannot open include file: 'graphviz/cgraph.h'".

@tom-rethink
Copy link

tom-rethink commented May 17, 2019

To install on ubuntu 18.04, I had to also install graphviz-dev: sudo apt install graphviz-dev

@shoeffner
Copy link

shoeffner commented Jun 11, 2019

I had the same problem (MacOS). To resolve it, just copy the files from /include/graphviz to /include/graphviz/graphviz. Should work on all systems like that.

The problem is, that the graphviz directory is searched for a file with the pattern graphviz/cgraph.h, but there is only cgraph.h, so adding an additional directory resolves it.

An alternative solution is to set the -I flag properly (i.e. removing the graphviz there), but I didn't dive into that.

@Khris777
Copy link

Khris777 commented Jun 17, 2019

Same problem here on Windows 10 on anaconda/conda using pip.

After I added C:\Program Files (x86)\Graphviz2.38\include\graphviz into my PATH the installation succeeded in the anaconda root environment, but I can't get it to install into another conda virtual environment, it always throws the same error that it can't find its includes. When I echo the PATH variable inside of the activated environment everything is there and it should be able to locate the files.

I also added C:\Program Files (x86)\Graphviz2.38\include into my PATH as well to no avail.

And pygraphviz is not on conda, at least not in the common channels.

@willismonroe
Copy link

willismonroe commented Sep 9, 2019

Ubuntu 19.04 here, had to run:
sudo apt install libgraphviz-dev

@rastaxe
Copy link

rastaxe commented Oct 14, 2019

I had to install also python3.7-dev

@litchfield
Copy link

litchfield commented Nov 11, 2019

Quick fix for Mac OSX + homebrew graphviz --

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

@ubiq-x
Copy link

ubiq-x commented Feb 11, 2020

This has worked for me on a MacOS Catalina with HomeBrew 2.2.5:

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

@setarehz
Copy link

setarehz commented Nov 22, 2020

Windows 10

I had the same problem with Windows 10
Also, I installed GraphViz2.38 manually, but it didn't work.
PyGraphviz 1.5 is a build on the Anaconda channel for Windows 64 bit running Python 3.6, Python 3.7 or Python 3.8. If you're running Anaconda, you can install it with:
conda install -c alubbock pygraphviz

the ref is: here

It worked for me

@jarrodmillman jarrodmillman added this to the 1.7 milestone Dec 25, 2020
dhimmel added a commit to related-sciences/nxontology that referenced this issue Jan 5, 2021
@Gabri-TeamSight
Copy link

Gabri-TeamSight commented Jan 13, 2021

I had the same problem (MacOS). To resolve it, just copy the files from /include/graphviz to /include/graphviz/graphviz. Should work on all systems like that.

The problem is, that the graphviz directory is searched for a file with the pattern graphviz/cgraph.h, but there is only cgraph.h, so adding an additional directory resolves it.

An alternative solution is to set the -I flag properly (i.e. removing the graphviz there), but I didn't dive into that.

Hi, I have MacOs BigSur on MacBook Air ARM M1, I have the same issue with pzgraphviz 2.44.1
I think your contrite better the point as from the log the gcc compiler cannot find Graphviz/cgraph.h, so I created another directory called graphviz inside the directory include/graphviz where I copied all the files in the upper-directory, including cgraph.h, but again the same issues appears. I tried all the other Mac work-around here but nothing worked... Any help? Thanks

Here's the log:

Installing collected packages: pygraphviz Running setup.py install for pygraphviz ... error ERROR: Command errored out with exit status 1: command: /Users/gabrielevolpi/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/mq/s1y1l_617z9181khd2q83wlw0000gn/T/pip-install-fgaoghun/pygraphviz/setup.py'"'"'; __file__='"'"'/private/var/folders/mq/s1y1l_617z9181khd2q83wlw0000gn/T/pip-install-fgaoghun/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 /private/var/folders/mq/s1y1l_617z9181khd2q83wlw0000gn/T/pip-record-txxowdye/install-record.txt --single-version-externally-managed --compile --install-headers /Users/gabrielevolpi/anaconda3/include/python3.8/pygraphviz cwd: /private/var/folders/mq/s1y1l_617z9181khd2q83wlw0000gn/T/pip-install-fgaoghun/pygraphviz/ Complete output (61 lines): running install Trying dpkg Failed to find dpkg Trying pkg-config include_dirs=/opt/homebrew/Cellar/graphviz/2.44.1/include/graphviz:/opt/homebrew/Cellar/graphviz/2.44.1/include library_dirs=/opt/homebrew/Cellar/graphviz/2.44.1/lib running build running build_py creating build creating build/lib.macosx-10.9-x86_64-3.8 creating build/lib.macosx-10.9-x86_64-3.8/pygraphviz copying pygraphviz/release.py -> build/lib.macosx-10.9-x86_64-3.8/pygraphviz copying pygraphviz/version.py -> build/lib.macosx-10.9-x86_64-3.8/pygraphviz copying pygraphviz/graphviz.py -> build/lib.macosx-10.9-x86_64-3.8/pygraphviz copying pygraphviz/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/pygraphviz copying pygraphviz/agraph.py -> build/lib.macosx-10.9-x86_64-3.8/pygraphviz creating build/lib.macosx-10.9-x86_64-3.8/pygraphviz/tests copying pygraphviz/tests/test_setup.py -> build/lib.macosx-10.9-x86_64-3.8/pygraphviz/tests copying pygraphviz/tests/test_unicode.py -> build/lib.macosx-10.9-x86_64-3.8/pygraphviz/tests copying pygraphviz/tests/test_readwrite.py -> build/lib.macosx-10.9-x86_64-3.8/pygraphviz/tests copying pygraphviz/tests/test_string.py -> build/lib.macosx-10.9-x86_64-3.8/pygraphviz/tests copying pygraphviz/tests/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/pygraphviz/tests copying pygraphviz/tests/test_html.py -> build/lib.macosx-10.9-x86_64-3.8/pygraphviz/tests copying pygraphviz/tests/test_node_attributes.py -> build/lib.macosx-10.9-x86_64-3.8/pygraphviz/tests copying pygraphviz/tests/test.py -> build/lib.macosx-10.9-x86_64-3.8/pygraphviz/tests copying pygraphviz/tests/test_drawing.py -> build/lib.macosx-10.9-x86_64-3.8/pygraphviz/tests copying pygraphviz/tests/test_subgraph.py -> build/lib.macosx-10.9-x86_64-3.8/pygraphviz/tests copying pygraphviz/tests/test_close.py -> build/lib.macosx-10.9-x86_64-3.8/pygraphviz/tests copying pygraphviz/tests/test_edge_attributes.py -> build/lib.macosx-10.9-x86_64-3.8/pygraphviz/tests copying pygraphviz/tests/test_clear.py -> build/lib.macosx-10.9-x86_64-3.8/pygraphviz/tests copying pygraphviz/tests/test_layout.py -> build/lib.macosx-10.9-x86_64-3.8/pygraphviz/tests copying pygraphviz/tests/test_attribute_defaults.py -> build/lib.macosx-10.9-x86_64-3.8/pygraphviz/tests copying pygraphviz/tests/test_graph.py -> build/lib.macosx-10.9-x86_64-3.8/pygraphviz/tests copying pygraphviz/tests/test_attributes.py -> build/lib.macosx-10.9-x86_64-3.8/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 files found matching '*.png' under directory 'doc' warning: no files found matching '*.html' under directory 'doc' warning: no files found matching '*.txt' under directory 'doc' warning: no files found matching '*.css' under directory 'doc' 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.8/pygraphviz copying pygraphviz/graphviz_wrap.c -> build/lib.macosx-10.9-x86_64-3.8/pygraphviz running build_ext building 'pygraphviz._graphviz' extension creating build/temp.macosx-10.9-x86_64-3.8 creating build/temp.macosx-10.9-x86_64-3.8/pygraphviz gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/gabrielevolpi/anaconda3/include -arch x86_64 -I/Users/gabrielevolpi/anaconda3/include -arch x86_64 -I/opt/homebrew/Cellar/graphviz/2.44.1/include/graphviz:/opt/homebrew/Cellar/graphviz/2.44.1/include -I/Users/gabrielevolpi/anaconda3/include/python3.8 -c pygraphviz/graphviz_wrap.c -o build/temp.macosx-10.9-x86_64-3.8/pygraphviz/graphviz_wrap.o pygraphviz/graphviz_wrap.c:2676:10: fatal error: 'graphviz/cgraph.h' file not found #include "graphviz/cgraph.h" ^~~~~~~~~~~~~~~~~~~ 1 error generated. error: command 'gcc' failed with exit status 1 ---------------------------------------- ERROR: Command errored out with exit status 1: /Users/gabrielevolpi/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/mq/s1y1l_617z9181khd2q83wlw0000gn/T/pip-install-fgaoghun/pygraphviz/setup.py'"'"'; __file__='"'"'/private/var/folders/mq/s1y1l_617z9181khd2q83wlw0000gn/T/pip-install-fgaoghun/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 /private/var/folders/mq/s1y1l_617z9181khd2q83wlw0000gn/T/pip-record-txxowdye/install-record.txt --single-version-externally-managed --compile --install-headers /Users/gabrielevolpi/anaconda3/include/python3.8/pygraphviz Check the logs for full command output.

@shoeffner
Copy link

shoeffner commented Jan 14, 2021

It seems you are using anaconda, can you try conda install pygraphviz?

If not, have you tried adjusting the paths to your brew installation?

$ pip install --install-option="--include-path=$(brew --prefix graphviz)/include" --install-option="--library-path=$(brew --prefix graphviz)/lib" pygraphviz

Alternatively, please double-check your paths and report back to us – your log mentions /opt/homebrew/Cellar/graphviz/2.44.1/, but at least on my system homebrew installs stuff to /usr/local/Cellar/graphviz/2.44.1/.

@Gabri-TeamSight
Copy link

Gabri-TeamSight commented Jan 14, 2021

It seems you are using anaconda, can you try conda install pygraphviz?

If not, have you tried adjusting the paths to your brew installation?

$ pip install --install-option="--include-path=$(brew --prefix graphviz)/include" --install-option="--library-path=$(brew --prefix graphviz)/lib" pygraphviz

Alternatively, please double-check your paths and report back to us – your log mentions /opt/homebrew/Cellar/graphviz/2.44.1/, but at least on my system homebrew installs stuff to /usr/local/Cellar/graphviz/2.44.1/.

Hi, thank you for your help.

I tried with Honda but it seems it doesn't allow me to install with because of my python version (Do you confirm pygraphviz doesn't support python 3.8?):

(base) gabrielevolpi@Air-di-Gabriele NetworkAnalysis %  conda install pygraphviz
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: \ 
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed                                                                                                                                                                                                    

UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

  - pygraphviz -> python[version='>=2.7,<2.8.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.5,<3.6.0a0']

Your python: python=3.8

If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.

Using instead the adjusted paths of brew with pip seemed work:

(base) gabrielevolpi@Air-di-Gabriele NetworkAnalysis % pip install --install-option="--include-path=$(brew --prefix graphviz)/include" --install-option="--library-path=$(brew --prefix graphviz)/lib" pygraphviz
/Users/gabrielevolpi/anaconda3/lib/python3.8/site-packages/pip/_internal/commands/install.py:235: UserWarning: Disabling all use of wheels due to the use of --build-option / --global-option / --install-option.
  cmdoptions.check_install_build_global(options)
Collecting pygraphviz
  Using cached pygraphviz-1.6.zip (117 kB)
Skipping wheel build for pygraphviz, due to binaries being disabled for it.
Installing collected packages: pygraphviz
    Running setup.py install for pygraphviz ... done
Successfully installed pygraphviz-1.6

but than it raises me error when I try to import the library in python;

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-44-e9ec173dab0d> in <module>
----> 1 import pygraphviz

~/anaconda3/lib/python3.8/site-packages/pygraphviz/__init__.py in <module>
     54 __license__ = release.license
     55 
---> 56 from .agraph import AGraph, Node, Edge, Attribute, ItemAttribute, DotError
     57 
     58 __all__ = ["AGraph", "Node", "Edge", "Attribute", "ItemAttribute", "DotError"]

~/anaconda3/lib/python3.8/site-packages/pygraphviz/agraph.py in <module>
     18 from collections.abc import MutableMapping
     19 
---> 20 from . import graphviz as gv
     21 
     22 _DEFAULT_ENCODING = "UTF-8"

~/anaconda3/lib/python3.8/site-packages/pygraphviz/graphviz.py in <module>
     11 # Import the low-level C/C++ module
     12 if __package__ or "." in __name__:
---> 13     from . import _graphviz
     14 else:
     15     import _graphviz

ImportError: dlopen(/Users/gabrielevolpi/anaconda3/lib/python3.8/site-packages/pygraphviz/_graphviz.cpython-38-darwin.so, 2): Symbol not found: _Agdirected
  Referenced from: /Users/gabrielevolpi/anaconda3/lib/python3.8/site-packages/pygraphviz/_graphviz.cpython-38-darwin.so
  Expected in: flat namespace
 in /Users/gabrielevolpi/anaconda3/lib/python3.8/site-packages/pygraphviz/_graphviz.cpython-38-darwin.so

It is pheraps connected to my incompatible version of Python?
Thank you again

@rossbar
Copy link
Contributor

rossbar commented Jan 14, 2021

There is a release candidate (1.7rc1) out now that tries to address some of these issues. If you are on a mac and have installed Graphviz with homebrew, then installation of pygraphviz should work out-of-the-box. You can try the pre-release with pip: pip install --pre pygraphviz==1.7rc1.

The install instructions for macOS have also been updated to provide recipes that should work for users who have installed Graphviz via macports as well.

@jarrodmillman jarrodmillman modified the milestones: 1.7, 1.8 Feb 1, 2021
@rossbar
Copy link
Contributor

rossbar commented Feb 2, 2021

Pygraphviz 1.7 has been released which includes and updated installation procedures for installing on all platforms including Windows and macOS. Please see the updated installation guide for details on your specific platform. If you are still having problems or your use-case is not covered in the documentation, please open a new issue with info about your platform and how Graphviz was installed.

@rossbar rossbar closed this as completed Feb 2, 2021
@mahoriES
Copy link

mahoriES commented May 19, 2021

Ubuntu 20 here.

This worked for me

sudo apt install libgraphviz-dev

@JonasFreireAlcantara
Copy link

JonasFreireAlcantara commented May 25, 2021

Ubuntu 20 here.

This worked for me

sudo apt install libgraphviz-dev

Thank you guy, it worked for me too, Ubuntu 20.04.

@isaquebc
Copy link

isaquebc commented Jan 10, 2022

On mac osx M1

I just did

brew install graphviz

@dp1889
Copy link

dp1889 commented Apr 23, 2022

This worked for me (Mac OS ver 12.3.1, homebrew 3.4.7, homebrew graphviz 3.0.0)
pip3 install --global-option=build_ext --global-option="-I$(brew --prefix graphviz)/include" --global-option="-L$(brew --prefix graphviz)/lib" pygraphviz

@smoquet
Copy link

smoquet commented May 4, 2022

this was the final straw: sudo apt-get install python3.6-dev

@HHMathewCHan
Copy link

HHMathewCHan commented Jul 22, 2022

It seems you are using anaconda, can you try conda install pygraphviz?

If not, have you tried adjusting the paths to your brew installation?

$ pip install --install-option="--include-path=$(brew --prefix graphviz)/include" --install-option="--library-path=$(brew --prefix graphviz)/lib" pygraphviz

Alternatively, please double-check your paths and report back to us – your log mentions /opt/homebrew/Cellar/graphviz/2.44.1/, but at least on my system homebrew installs stuff to /usr/local/Cellar/graphviz/2.44.1/.

Thx your command work for me as well

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