Catlab.jl : Facing error while creating simple graphs

I was following the AlgebraicJulia blog for Graphs and C-sets where I am encountering an IOError for the ‘dot -Tsvg’ file missing when trying to generate graph interface using the 'to_graphviz() function. I could not debug the error as it is not very clear to me. I am using the same code as mentioned in the blog, but for ease posting the code:

using Catlab

using Catlab.CategoricalAlgebra

using Catlab.Theories

using Catlab.Graphs

using Catlab.Graphics

@present SchGraph(FreeSchema) begin

V::Ob

E::Ob

src::Hom(E,V)

tgt::Hom(E,V)

end

g = Graph()

add_parts!(g, :V, 3)

add_parts!(g, :E, 4, src=[1,2,2,3], tgt=[2,3,3,3])

g

to_graphviz(g)

Error message:

ERROR: IOError: could not spawn `dot -Tsvg`: no such file or directory (ENOENT)

Any help would be very much appreciated.

Guessing from the error message it seems you don’t have Graphviz installed (dot is one of the command line tools from graphviz).

As a matter of fact, I do have it.
image

Ok, that seems to be another Julia package wrapping Graphviz. I was thinking of the Graphviz library/tools which are run under the hood.
Can you run dot from the command line, i.e., outside of Julia?

1 Like

Yep, this was the problem, I installed Graphviz from the link you gave.
It works now.
Thanks for the help, really appreciated.

Even though the problem has been solved, as a fellow Catlab user I’ll just point out that Catlab assumes one of two things 1. the user has installed graphviz_jll, or 2. Graphviz (the software itself, not necessarily the julia package of the same name) itself has been installed and is accessible from the command line.

See the comments/code here Catlab.jl/src/graphics/Graphviz.jl at 2092b5b3610dbaec921bd840da952ae27dbc97e9 · AlgebraicJulia/Catlab.jl (github.com)

1 Like