pygraphviz installation error in Google Colab

595 views Asked by At

Installing Pygraphviz on Google Colab using pip **pip install pygraphviz** gives the following error:

Preparing metadata (setup.py) ... done
Building wheels for collected packages: pygraphviz
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  Building wheel for pygraphviz (setup.py) ... error
  ERROR: Failed building wheel for pygraphviz
  Running setup.py clean for pygraphviz
Failed to build pygraphviz
Installing collected packages: pygraphviz
  error: subprocess-exited-with-error
  
  × Running setup.py install for pygraphviz did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  Running setup.py install for pygraphviz ... error
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> pygraphviz

note: This is an issue with the package mentioned above, not pip.

The command used should ideally work, however installation of pygraphviz fails by throwing the error "python setup.py bdist_wheel did not run successfully"

1

There are 1 answers

1
Bipin Babu On

I was able to install pygraphviz in Google Colab by running the following commands:

!apt install libgraphviz-dev
!pip install pygraphviz

An Explanation for this from anyone is much appreciated.