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

Open
parthi2929 opened this issue May 7, 2018 · 15 comments
Open

Graphviz cgraph.h not found #155

parthi2929 opened this issue May 7, 2018 · 15 comments

Comments

@parthi2929
Copy link

@parthi2929 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

This comment has been minimized.

Copy link

@SaintNazaire 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

This comment has been minimized.

Copy link
Author

@parthi2929 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

This comment has been minimized.

Copy link

@SaintNazaire 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

This comment has been minimized.

Copy link
Author

@parthi2929 parthi2929 commented May 12, 2018

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

@Frackup

This comment has been minimized.

Copy link

@Frackup 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

This comment has been minimized.

Copy link

@tribbloid 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

This comment has been minimized.

Copy link

@kitaev-chen kitaev-chen commented Apr 3, 2019

conda install pygraphviz might be easier

@tan-wei

This comment has been minimized.

Copy link

@tan-wei 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

This comment has been minimized.

Copy link

@tom-rethink 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

This comment has been minimized.

Copy link

@shoeffner 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

This comment has been minimized.

Copy link

@Khris777 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

This comment has been minimized.

Copy link

@willismonroe willismonroe commented Sep 9, 2019

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

@rastaxe

This comment has been minimized.

Copy link

@rastaxe rastaxe commented Oct 14, 2019

I had to install also python3.7-dev

@litchfield

This comment has been minimized.

Copy link

@litchfield 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

This comment has been minimized.

Copy link

@ubiq-x 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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
You can’t perform that action at this time.