0

I've been having problems installing pygraphviz for Windows using pip. Python 2.7 works fine and I have done other installations using pip without an error. I have already installed graphviz.

When executing pip install pygraphviz I get the following output:

Collecting pygraphviz
  Using cached pygraphviz-1.3.1.zip
Building wheels for collected packages: pygraphviz
  Running setup.py bdist_wheel for pygraphviz ... error
  Complete output from command c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\cnh004\\appdata\\local\\temp\\pip-build-onw9wy\\pygraphviz\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d c:\users\cnh004\appdata\local\temp\tmpcdsmtypip-wheel- --python-tag cp27:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win32-2.7
  creating build\lib.win32-2.7\pygraphviz
  copying pygraphviz\agraph.py -> build\lib.win32-2.7\pygraphviz
  copying pygraphviz\graphviz.py -> build\lib.win32-2.7\pygraphviz
  copying pygraphviz\release.py -> build\lib.win32-2.7\pygraphviz
  copying pygraphviz\version.py -> build\lib.win32-2.7\pygraphviz
  copying pygraphviz\__init__.py -> build\lib.win32-2.7\pygraphviz
  creating build\lib.win32-2.7\pygraphviz\tests
  copying pygraphviz\tests\test.py -> build\lib.win32-2.7\pygraphviz\tests
  copying pygraphviz\tests\test_attributes.py -> build\lib.win32-2.7\pygraphviz\tests
  copying pygraphviz\tests\test_attribute_defaults.py -> build\lib.win32-2.7\pygraphviz\tests
  copying pygraphviz\tests\test_clear.py -> build\lib.win32-2.7\pygraphviz\tests
  copying pygraphviz\tests\test_drawing.py -> build\lib.win32-2.7\pygraphviz\tests
  copying pygraphviz\tests\test_edge_attributes.py -> build\lib.win32-2.7\pygraphviz\tests
  copying pygraphviz\tests\test_graph.py -> build\lib.win32-2.7\pygraphviz\tests
  copying pygraphviz\tests\test_html.py -> build\lib.win32-2.7\pygraphviz\tests
  copying pygraphviz\tests\test_layout.py -> build\lib.win32-2.7\pygraphviz\tests
  copying pygraphviz\tests\test_node_attributes.py -> build\lib.win32-2.7\pygraphviz\tests
  copying pygraphviz\tests\test_readwrite.py -> build\lib.win32-2.7\pygraphviz\tests
  copying pygraphviz\tests\test_string.py -> build\lib.win32-2.7\pygraphviz\tests
  copying pygraphviz\tests\test_subgraph.py -> build\lib.win32-2.7\pygraphviz\tests
  copying pygraphviz\tests\test_unicode.py -> build\lib.win32-2.7\pygraphviz\tests
  copying pygraphviz\tests\__init__.py -> build\lib.win32-2.7\pygraphviz\tests
  running egg_info
  writing pygraphviz.egg-info\PKG-INFO
  writing top-level names to pygraphviz.egg-info\top_level.txt
  writing dependency_links to pygraphviz.egg-info\dependency_links.txt
  reading manifest file 'pygraphviz.egg-info\SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  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.win32-2.7\pygraphviz
  copying pygraphviz\graphviz_wrap.c -> build\lib.win32-2.7\pygraphviz
  running build_ext
  building 'pygraphviz._graphviz' extension
  error: Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27

  ----------------------------------------
  Failed building wheel for pygraphviz
  Running setup.py clean for pygraphviz
Failed to build pygraphviz
Installing collected packages: pygraphviz
  Running setup.py install for pygraphviz ... error
    Complete output from command c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\cnh004\\appdata\\local\\temp\\pip-build-onw9wy\\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 c:\users\cnh004\appdata\local\temp\pip-wa7pph-record\install-record.txt --single-version-externally-managed --compile:
    running install
    include_dirs=None
    library_dirs=None
    running build
    running build_py
    creating build
    creating build\lib.win32-2.7
    creating build\lib.win32-2.7\pygraphviz
    copying pygraphviz\agraph.py -> build\lib.win32-2.7\pygraphviz
    copying pygraphviz\graphviz.py -> build\lib.win32-2.7\pygraphviz
    copying pygraphviz\release.py -> build\lib.win32-2.7\pygraphviz
    copying pygraphviz\version.py -> build\lib.win32-2.7\pygraphviz
    copying pygraphviz\__init__.py -> build\lib.win32-2.7\pygraphviz
    creating build\lib.win32-2.7\pygraphviz\tests
    copying pygraphviz\tests\test.py -> build\lib.win32-2.7\pygraphviz\tests
    copying pygraphviz\tests\test_attributes.py -> build\lib.win32-2.7\pygraphviz\tests
    copying pygraphviz\tests\test_attribute_defaults.py -> build\lib.win32-2.7\pygraphviz\tests
    copying pygraphviz\tests\test_clear.py -> build\lib.win32-2.7\pygraphviz\tests
    copying pygraphviz\tests\test_drawing.py -> build\lib.win32-2.7\pygraphviz\tests
    copying pygraphviz\tests\test_edge_attributes.py -> build\lib.win32-2.7\pygraphviz\tests
    copying pygraphviz\tests\test_graph.py -> build\lib.win32-2.7\pygraphviz\tests
    copying pygraphviz\tests\test_html.py -> build\lib.win32-2.7\pygraphviz\tests
    copying pygraphviz\tests\test_layout.py -> build\lib.win32-2.7\pygraphviz\tests
    copying pygraphviz\tests\test_node_attributes.py -> build\lib.win32-2.7\pygraphviz\tests
    copying pygraphviz\tests\test_readwrite.py -> build\lib.win32-2.7\pygraphviz\tests
    copying pygraphviz\tests\test_string.py -> build\lib.win32-2.7\pygraphviz\tests
    copying pygraphviz\tests\test_subgraph.py -> build\lib.win32-2.7\pygraphviz\tests
    copying pygraphviz\tests\test_unicode.py -> build\lib.win32-2.7\pygraphviz\tests
    copying pygraphviz\tests\__init__.py -> build\lib.win32-2.7\pygraphviz\tests
    running egg_info
    writing pygraphviz.egg-info\PKG-INFO
    writing top-level names to pygraphviz.egg-info\top_level.txt
    writing dependency_links to pygraphviz.egg-info\dependency_links.txt
    reading manifest file 'pygraphviz.egg-info\SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    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.win32-2.7\pygraphviz
    copying pygraphviz\graphviz_wrap.c -> build\lib.win32-2.7\pygraphviz
    running build_ext
    building 'pygraphviz._graphviz' extension
    error: Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27

    ----------------------------------------
Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\cnh004\\appdata\\local\\temp\\pip-build-onw9wy\\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 c:\users\cnh004\appdata\local\temp\pip-wa7pph-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\cnh004\appdata\local\temp\pip-build-onw9wy\pygraphviz\

I also looked at the solution given for Mac, but when I tried to install cgraph as suggested, it again said Failed building wheel for cgraph. If anyone has any suggestions that would appreciated. Thank you.

1 Answers1

0
Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27

Perfecttly self-evident explanation that even includes a solution. See also https://wiki.python.org/moin/WindowsCompilers and https://stackoverflow.com/a/18045219/7976758

phd
  • 82,685
  • 13
  • 120
  • 165