Installing PygraphViz on Windows, Python 2.6

前端 未结 8 1211
轮回少年
轮回少年 2020-12-09 10:03

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

相关标签:
8条回答
  • 2020-12-09 10:14

    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...

    0 讨论(0)
  • 2020-12-09 10:15

    I appreciate this may be an obsolete thread by now, but to update it for others currently hitting this wall, the installer at Christoph Gohlke's Unofficial Windows Binaries for Python Extension Packages has just worked for me..

    0 讨论(0)
  • 2020-12-09 10:16

    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?

    0 讨论(0)
  • 2020-12-09 10:17

    This works for me, Python 2.7 32 bit, PyGraphViz 2.38, VCForPython27, Windows 10 64 bit.

    First, install VCForPython27, see http://aka.ms/vcpython27.

    Then, execute the following command, so that distutils.msvc9compiler can find the VC compiler. (This needs Administrator privilege. And if your Windows is 32 bit, you need to adjust the registry key.)

    reg add HKLM\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\9.0\Setup\VC -v productdir -t REG_SZ -d "%LocalAppData%\Programs\Common\Microsoft\Visual C++ for Python\9.0" -f
    

    Finally, install PyGraphViz.

    set INCLUDE=C:\Program Files (x86)\Graphviz2.38\include
    set LIB=C:\Program Files (x86)\Graphviz2.38\lib\release\lib
    pip install pygraphviz
    
    0 讨论(0)
  • Alternately, you can try to use easy_install and avoid compiling. I installed "distribute", a fork of easy_install. But it also requires pkg-config, and you either have to compile that or get an older version. Furthermore, you also have to add pkg-config to the application path.

    0 讨论(0)
  • 2020-12-09 10:23

    Hat the same problem and I finally got it to work! The problem was actually in Python's msvc9compiler.py (yes you do need VS8's vc9 to compile, too). The error comes on line 698 in the function runtime_library_dir_option(). Instead of having it throw an error, have it return the same string as library_dir_option():

    def runtime_library_dir_option(self, dir):
        return "/LIBPATH:" + dir
    

    Then compile and it should work.

    0 讨论(0)
提交回复
热议问题