# Catlab.jl : Facing error while creating simple graphs

**URL:** https://discourse.julialang.org/t/catlab-jl-facing-error-while-creating-simple-graphs/100415
**Category:** Graphs
**Tags:** question, graphs, catlab
**Created:** [June 15, 2023, 6:39pm UTC](https://discourse.julialang.org/t/catlab-jl-facing-error-while-creating-simple-graphs/100415 "2023-06-15T18:39:56Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![nikit\_goku](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nikit_goku/32/49765_2.png) [@nikit\_goku](https://discourse.julialang.org/u/nikit_goku)
#### Post date: [June 15, 2023, 6:39pm UTC](https://discourse.julialang.org/t/catlab-jl-facing-error-while-creating-simple-graphs/100415/1 "2023-06-15T18:39:56Z")

</div>

I was following the AlgebraicJulia blog for [Graphs and C-sets](https://blog.algebraicjulia.org/post/2020/09/cset-graphs-1/) 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:

```julia
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:

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

```

Any help would be very much appreciated.

---

<div class="post-metadata">

### Author: ![bertschi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bertschi/32/33462_2.png) [@bertschi](https://discourse.julialang.org/u/bertschi)
#### Post date: [June 15, 2023, 9:19pm UTC](https://discourse.julialang.org/t/catlab-jl-facing-error-while-creating-simple-graphs/100415/2 "2023-06-15T21:19:59Z")

</div>

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

---

<div class="post-metadata">

### Author: ![nikit\_goku](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nikit_goku/32/49765_2.png) [@nikit\_goku](https://discourse.julialang.org/u/nikit_goku)
#### Post date: [June 15, 2023, 11:16pm UTC](https://discourse.julialang.org/t/catlab-jl-facing-error-while-creating-simple-graphs/100415/3 "2023-06-15T23:16:29Z")

</div>

As a matter of fact, I do have it.  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/1/9/19fd194398a663530d312fe728e8cf1996e524fe.png)

---

<div class="post-metadata">

### Author: ![bertschi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bertschi/32/33462_2.png) [@bertschi](https://discourse.julialang.org/u/bertschi)
#### Post date: [June 16, 2023, 7:07am UTC](https://discourse.julialang.org/t/catlab-jl-facing-error-while-creating-simple-graphs/100415/4 "2023-06-16T07:07:03Z")

</div>

Ok, that seems to be another Julia package wrapping `Graphviz`. I was thinking of the [Graphviz](https://graphviz.org/) library/tools which are run under the hood.  
Can you run `dot` from the command line, i.e., outside of Julia?

---

<div class="post-metadata">

### Author: ![nikit\_goku](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nikit_goku/32/49765_2.png) [@nikit\_goku](https://discourse.julialang.org/u/nikit_goku)
#### Post date: [June 16, 2023, 12:38pm UTC](https://discourse.julialang.org/t/catlab-jl-facing-error-while-creating-simple-graphs/100415/5 "2023-06-16T12:38:36Z")

</div>

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

---

<div class="post-metadata">

### Author: ![slwu89](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/slwu89/32/217323_2.png) [@slwu89](https://discourse.julialang.org/u/slwu89)
#### Post date: [June 16, 2023, 4:15pm UTC](https://discourse.julialang.org/t/catlab-jl-facing-error-while-creating-simple-graphs/100415/6 "2023-06-16T16:15:23Z")

</div>

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)](https://github.com/AlgebraicJulia/Catlab.jl/blob/2092b5b3610dbaec921bd840da952ae27dbc97e9/src/graphics/Graphviz.jl#L143)
