Install pygraphviz on windows

After installing the last image file (2.26.3) on my 64-bit Windows 7 Ultimate, I get the following error:

C:> easy_install pygraphviz Search for piggraphviz Read http://pypi.python.org/simple/pygraphviz/ read http://networkx.lanl.gov/pygraphviz read http://networkx.lanl.gov/wiki/download read http://networkx.lanl.gov/download/pygraphviz reading http://sourceforge.net/project/showfiles.php?group_id=122233&package_id=161979 reading http://networkx.lanl.gov/download Best match: pygraphviz 1.1 .dev1947 loading http://networkx.lanl.gov/download/pygraphviz/pygraphviz-1.1.dev1947.tar.gz processing pygraphviz-1.1.dev1947.tar.gz Running pygraphviz-1.1.dev1947 \ setup.py -q bdist_egg - -dist-dir C: \ Users \ Jonathan \ AppData \ Local \ Temp \ easy_install-apywwk \ pygraphviz-1.1.dev1947 \ egg-DIST-tmp-nvd0pa Attempt pkg-config Could not find pkg-config Attempt dotneato-config Failed find dotneato-config

Failed to install graphical installation.

Either the graphviz package is missing by incomplete (are the binary graphviz-dev or graphviz-devel packages missing?).

If you think your installation is correct, you will need to manually change the include_path and library_path variables in the setup.py file to specify the correct locations for your GUI installation.

Current setting library_path and include_path: library_path = None include_path = None

error: None

Any thoughts on how to fix this?
This is apparently a different problem than described here.
Has anyone had success installing pygraphviz on windows? How?

+4
source share
5 answers

Here is what worked for me. Prerequisite: install mingw32 (included in the pythonxy distribution if you use it), Graphviz

1) Download pygraphviz sources

2) Modify setup.py to change smth paths as

library_path=r"c:\Program Files (x86)\Graphviz 2.28\bin" include_path=r"c:\Program Files (x86)\Graphviz 2.28\include\graphviz" 

Note that this is \ bin, not \ lib. Linking to libs did not help me.

3) run python setup.py build -c mingw32

The result of step 3:

 c:\Python27\Lib\site-packages\pygraphviz-1.1>python setup.py build -c mingw32 library_path=c:\Program Files (x86)\Graphviz 2.28\bin include_path=c:\Program Files (x86)\Graphviz 2.28\include\graphviz running build running build_py running build_ext building 'pygraphviz._graphviz' extension C:\MinGW32-xy\bin\gcc.exe -mno-cygwin -mdll -O -Wall "-Ic:\Program Files (x86)\G raphviz 2.28\include\graphviz" -Ic:\Python27\include -Ic:\Python27\PC -c pygraph viz/graphviz_wrap.c -o build\temp.win32-2.7\Release\pygraphviz\graphviz_wrap.o pygraphviz/graphviz_wrap.c: In function 'agattr_label': pygraphviz/graphviz_wrap.c:2855:5: warning: return makes integer from pointer wi thout a cast writing build\temp.win32-2.7\Release\pygraphviz\_graphviz.def C:\MinGW32-xy\bin\gcc.exe -mno-cygwin -shared -s build\temp.win32-2.7\Release\py graphviz\graphviz_wrap.o build\temp.win32-2.7\Release\pygraphviz\_graphviz.def " -Lc:\Program Files (x86)\Graphviz 2.28\bin" -Lc:\Python27\libs -Lc:\Python27\PCb uild "-Wl,-Rc:\Program Files (x86)\Graphviz 2.28\bin" -lcgraph -lcdt -lpython27 -lmsvcr90 -o build\lib.win32-2.7\pygraphviz\_graphviz.pyd 

4) copy the result from the newly created lib.win32-2.7 (the only subfolder called pygraphviz ) into the folder with the folders of the Python site

Enjoy it!

+5
source

for Windows 64-bit:

similar to what Andrew Filev wrote, except you NEED to use pythonxy, and YOU NEED to install Graphviz in a folder that does not contain spaces (including the root folder of the program: "Graphviz 2.28" => "Graphviz2 0.28"

So:

1) remove python 2.7

2) install pythonxb (http://code.google.com/p/pythonxy/wiki/Downloads)

3) install Graphviz 2.28 (only the one I tested), making sure that there are no spaces in the installation path. A good example would be: "C: \ Graphviz2.28"

4) download pygraphviz as zip (sources) and unzip.

5) change setup.py at the top to have

 library_path=r"c:\Graphviz2.28\bin" include_path=r"c:\Graphviz2.28\include\graphviz" 

6) run: python setup.py build -c mingw32

7) after seeing this result (much better than the previous one):

 >python setup.py build -c mingw32 library_path=c:\Graphviz2.28\bin include_path=c:\Graphviz2.28\include\graphviz running build running build_py running build_ext 

copy the result from the newly created lib.win32-2.7 (one subfolder called pygraphviz ) to the Python site-packages folder, which you may have to do yourself +, bind the new pygraphviz root folder to the environment variable PYTHONPATH

For example, the final library may be located here:

 C:\Python27\libs\site_packages\pygraphviz 
+3
source

PyGraphviz uses the C language extension module (generated by SWIG). So you need a compiler to create the extension. You may need the same compiler that created your Python executable.

There is some information in this question. Creating Python C extension modules for Windows

as well as at http://www.swig.org/Doc1.3/Python.html#Python_nn12

+1
source

I just spent half an hour trying to understand why the answers above do not work for me, and it turns out that they are deprecated, since library_path and include_path no longer the names of the corresponding variables. Here's what worked for me on Windows 7, 32-bit Python 2.7:

setup.py

 library_dirs = r'C:\PROGRA~2\Graphviz2.38\bin' include_dirs = r'C:\PROGRA~2\Graphviz2.38\include' 

then run python setup.py build -c mingw32

+1
source

An old question, but I just did it and did not find a specific answer for Python 3, and I did not have to do half of the material mentioned above. So there it is. I am on Win7 64-bit, 64-bit Python3.4 and am using a virtual environment. I use it to create database schemas from django models, using django-extensions is very useful!

  • Download graphviz-2.38.msi from the graph website Graphviz
  • Install msi (I used cmd with administrator privileges)

    msiexec /a graphviz-2.38.msi

  • For some reason, this does not add Graphviz to your system path, so you need to do this manually. For me it was

    SET PATH=%PATH%;C:\Program Files (x86)\Graphviz2.38\bin

  • Then I had to get the specific pygraphviz Windows wheel from this really useful site , in particular pygraphviz-1.3.1-cp34- nor-win_amd64.whl

  • After that I installed it using pip / mingw32 in my virtual environment

    $ pip install pygraphviz-1.3.1-cp34-none-win_amd64.whl

Now everything works fine.

+1
source

Source: https://habr.com/ru/post/1333900/


All Articles