I am exploring tree plots with the following library and code:
from dsplot.graph import Graph
graph = Graph(
{0: [1, 4, 5], 1: [3, 4], 2: [1], 3: [2, 4], 4: [], 5: []}, directed=True
)
graph.plot()
When I run the code, I get the following error:
from dsplot.graph import Graph
ModuleNotFoundError: No module named 'dsplot'
I have tried pip installing the dsplot
library with this command on the PyCharm terminal:
pip install dsplot
But this then causes another error:
Collecting dsplot
Using cached dsplot-0.9.0-py3-none-any.whl (8.8 kB)
Collecting pygraphviz<2.0,>=1.7
Using cached pygraphviz-1.12.tar.gz (104 kB)
ERROR: Error [WinError 3] The system cannot find the path specified while executing command pip subprocess to install build dependencies
Installing build dependencies ... error
ERROR: Could not install packages due to an OSError: [WinError 3] The system cannot find the path specified
What is the reason for this problem installing the library and how can I resolve it?
It looks like you have not installed pygraphviz
.
Install pygraphviz
Try downloading it from their official website and make sure its added to your path by clicking "Add Graphviz to the System PATH for the current user". In your terminal, run dot -V
and if it outputs your version of pygraphviz
, you should be all set to run pip install dsplot
.
If dot -V
does not return the Version:
Make sure you checked this box during installation:
If you checked the box and it is still not in your PATH:
After adding Graphviz
to your path, open a terminal and once again try dot -V
. If that returns the version, then you should be able to run pip install dsplot
.