housegan icon indicating copy to clipboard operation
housegan copied to clipboard

Unable to install pygraphviz (windows)

Open ZeynabRostami opened this issue 4 years ago • 5 comments

Hi First of all, thanks for such an amazing project. I want to run the pretrained models but when I do It keeps showing this error:

Traceback (most recent call last): File "C:\Python39\lib\site-packages\networkx\drawing\nx_agraph.py", line 279, in pygraphviz_layout import pygraphviz File "C:\Python39\lib\site-packages\pygraphviz_init_.py", line 56, in from .agraph import AGraph, Node, Edge, Attribute, ItemAttribute, DotError File "C:\Python39\lib\site-packages\pygraphviz\agraph.py", line 20, in from . import graphviz as gv File "C:\Python39\lib\site-packages\pygraphviz\graphviz.py", line 13, in from . import _graphviz ImportError: DLL load failed while importing _graphviz: The specified module could not be found.

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "C:\Users\z.rostami\PycharmProjects\housegan\variation_bbs_with_target_graph_segments_suppl.py", line 232, in graph_arr = draw_graph([real_nodes, eds.detach().cpu().numpy()]) File "C:\Users\z.rostami\PycharmProjects\housegan\variation_bbs_with_target_graph_segments_suppl.py", line 70, in draw_graph pos = nx.nx_agraph.graphviz_layout(G_true, prog='neato') File "C:\Python39\lib\site-packages\networkx\drawing\nx_agraph.py", line 237, in graphviz_layout return pygraphviz_layout(G, prog=prog, root=root, args=args) File "C:\Python39\lib\site-packages\networkx\drawing\nx_agraph.py", line 281, in pygraphviz_layout raise ImportError("requires pygraphviz " "http://pygraphviz.github.io/") from e ImportError: requires pygraphviz http://pygraphviz.github.io/

I spend a lot of time setting up Graphviz and pygraphviz successfully and I think I did! But the problem with pygraphviz still exists. Isn't there any way to setup these libraries on Windows? Should I install Anaconda just for one library? Or install a VMware and clone the project in Linux ?! Has anyone installed pygraphviz in Windows?

ZeynabRostami avatar Jan 09 '21 14:01 ZeynabRostami

Hello @ZeinabRostami, I am not a windows user so I may not be able to help much, but I would try installing Anaconda. Overall I find Anaconda good for installing new packages so it could be helpful not only for pygrahviz, but for other packages you may want to install in the future.

ennauata avatar Jan 11 '21 18:01 ennauata

1 - Make sure you downloaded Visual C/C++, e.g. from here: https://visualstudio.microsoft.com/visual-cpp-build-tools/

image

2 - Download and Install graphviz packagefiles https://gitlab.com/graphviz/graphviz/-/package_files/6164164/download

3 - Run in terminal python -m pip install --global-option=build_ext --global-option="-IC:\Program Files\Graphviz\include" --global-option="-LC:\Program Files\Graphviz\lib" pygraphviz

image

---------------- I made it using a conda enviroment

other sugestions like conda install graphviz pygraphviz did not work out.

rickkk856 avatar Feb 10 '21 18:02 rickkk856

Hi rickkk856 I really appreciate your attention! I managed to run your awesome project using google colab and it helped me a lot with my project. I will try your recent suggestion as it's more efficient to run the project locally. Thanks again 😁

On Wed, Feb 10, 2021, 9:44 PM Ricardo Cesar Rodrigues < [email protected]> wrote:

1 - Make sure you downloaded Visual C/C++, e.g. from here: https://visualstudio.microsoft.com/visual-cpp-build-tools/

[image: image] https://user-images.githubusercontent.com/62864640/107552221-edec4580-6bb1-11eb-8255-68b6e785fc83.png

2 - Download and Install graphviz packagefiles https://gitlab.com/graphviz/graphviz/-/package_files/6164164/download

3 - Run in terminal python -m pip install --global-option=build_ext --global-option="-IC:\Program Files\Graphviz\include" --global-option="-LC:\Program Files\Graphviz\lib" pygraphviz

[image: image] https://user-images.githubusercontent.com/62864640/107552670-94d0e180-6bb2-11eb-9524-ee44da910cbc.png

---------------- I made it using a conda enviroment

other sugestions like conda install graphviz pygraphviz did not work out.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ennauata/housegan/issues/15#issuecomment-776908939, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJ774SMMSFFWKEEHDECMTOTS6LEHZANCNFSM4V3TUWBQ .

ZeynabRostami avatar Feb 10 '21 18:02 ZeynabRostami

Shouldn't there be a "pip install graphviz 64" or something like that?

lbertolotti avatar Jun 05 '21 21:06 lbertolotti

See also https://github.com/pygraphviz/pygraphviz/issues/186

hhoppe avatar Feb 09 '24 02:02 hhoppe