views:

564

answers:

2

Anybody out there has successfully installed PygraphViz on Windows?

Since there is not an official release for Windows, I'm trying to build it myself, but it fails to compile. I'm not the first one to face this issue, but I could not find an answer.

This is the console output:

C:\Python26\Lib\site-packages\pygraphviz-0.99.1>c:\python26\python.exe setup.py
install
library_path=C:/Program Files/Graphviz2.26.3/lib/debug/dll
include_path=C:/Program Files/Graphviz2.26.3/include/graphviz
running install
running build
running build_py
running build_ext
building 'pygraphviz._graphviz' extension
C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox /MD /W
3 /GS- /DNDEBUG "-IC:/Program Files/Graphviz2.26.3/include/graphviz" -Ic:\python
26\include -Ic:\python26\PC /Tcpygraphviz/graphviz_wrap.c /Fobuild\temp.win32-2.
6\Release\pygraphviz/graphviz_wrap.obj
graphviz_wrap.c
warning: I don't know what to do with 'runtime_library_dirs': ['C:/Program Files
/Graphviz2.26.3/lib/debug/dll']
error: don't know how to set runtime library search path for MSVC++

Any help would be appreciated!

+1  A: 

I've just ran into the same problem myself today. It isn't much of an answer, but I read in their FAQ:

Q:

How do I compile pygraphviz under Windows? And why don’t you distribute a pygraphviz Windows installer?

A:

We don’t have Windows development machines but would like to have pygraphviz work on all platforms. If you have success with Windows or would be willing to help test and distribute a Windows installer please drop us a note.

See also ticket 67: https://networkx.lanl.gov/ticket/67

This, together with multiple unanswered pleas for help on various forums, mailing lists and newsgroups, lead me to believe that running PyGraphviz on Windows isn't something that can be done simply today.

So I did the next obvious thing (*) and fired up my Ubuntu on top of VirtualBox to create Graphviz graphs with Python. Curiously, it fails to install from source on Ubuntu as well, unless you have Graphviz itself installed from source, but it can be installed from a pre-built package with sudo apt-get python-pygraphviz.

So now I'm a happy pygraphviz user. Or at least 90% happy. PGV shows a os.popen3 deprecation warning on Python 2.6, and a 18-month-old ticket with a patch on this issue still hasn't been incorporated. Argh!

(*) I do it more and more lately...

Eli Bendersky
A: 

If you remove the 'runtime_library_dirs' parameter from the extension dictionary in on line 147 in setup.py, your error message goes away. However, it can't find cgraph.lib. If you change your settings to

library_path=r'C:\Program Files\Graphviz2.26.3\lib\debug\lib'

everything complies and installs. You can import the modules, but the moment you try and access anything, it bombs out. In looking at the source for GraphViz, it appears that the windows version is C#/.NET - perhaps that is the source of our problems?

WombatPM