PlantUML extension for Visual Studio Code on Windows only working with sequence diagrams
Asked Answered
H

5

27

I installed the PlantUML extension (by jebbs) in Visual Studio Code for Windows and everything is working perfectly for sequence diagrams.

However when I try to render a class diagram I get the message:

Dot Executable: \opt\local\bin\dot
File does not exist
Cannot find Graphviz

Screencap of full error message:

Dot Executable does not exist error

When I try the example @startuml testdot @enduml code specified I get the following error:

The environment variable GRAPHVIZ_DOT has been set to /opt/local/bin/dot
Dot executable is \opt\local\bin\dot

Screencap of full error message:

GRAPHVIZ_DOT has been set error

Any ideas where this has been specified such that I can override it (assuming this is what the problem is)? It hasn't been added to the system or user environment variables that I can see.

Heroin answered 19/12, 2018 at 17:20 Comment(0)
H
41

The GRAPHVIZ_DOT environment variable is specified in File > Preferences > Settings > Plantuml: Command Args. Click on the link to "Edit in settings.json".

Settings dialog

settings.json

Additionally the VSCode PlantUML extension doesn't appear to include the graphviz "dot.exe" executable, so this needs to be downloaded and installed (e.g. via chocolatey OR download and unzip from https://graphviz.gitlab.io/_pages/Download/Download_windows.html)

Following this, update the path and save.

{
    "plantuml.commandArgs": [
        "-DGRAPHVIZ_DOT=D:\\Tools\\graphviz-2.38\\release\\bin\\dot.exe",
    ]
}

Also see https://github.com/qjebbs/vscode-plantuml/issues/94

Heroin answered 19/12, 2018 at 17:20 Comment(0)
B
2

This is how I managed to fix the graphviz dot: null issue:

From VSC: Goto EXTENSIONS: MARKETPLACE ( you can find the option on the left side)

enter image description here

Select the graphviz extension that you have installed e.g. @ext:tintinweb.graphviz-interactive-preview

Click the Settings

Graphviz-interactive-preview: Render Lock  (Uncheck this one)
Graphviz-interactive-preview: Render Lock Additional Timeout: -1

If VSC is on Windows, then create a variable pointing to the location where dot.exe of graphviz has been installed.

enter image description here

Bum answered 18/5, 2021 at 8:56 Comment(1)
For those attempting to utilise PlantUML from the toolbox on Fedora Silverblue/Kinoite, the absence of graphviz is the problem. Just install graphviz by running sudo dnf install graphviz and the errors will disappear.Duckbill
S
1

The prerequisite of PlantUML is Java and Graphviz (https://plantuml.com/starting)

You need these things to run PlantUML: Java Graphviz (optional if you only need sequence diagrams and activity (beta) diagrams)

, in Windows machine, we can download and extract the Graphviz and then put it in the user path.

Silversmith answered 1/12, 2020 at 3:4 Comment(0)
B
0

I'm on linux, rigth now @Claire Furney's answer didn't work for me. After installing the required tool you need to specify dot path correct.

Official documentation is correct now. Go there and install by following any of these:

Fedora packages: sudo yum install graphviz

Ubuntu packages: sudo apt install graphviz

Debian packages: sudo apt install graphviz

then add dot variable like following:

{
  "plantuml.commandArgs": [
    "-DGRAPHVIZ_DOT=/usr/bin/dot",
  ]
}

After that it must work.

Barber answered 10/1 at 18:4 Comment(0)
S
0

For Mac, it should like the below:

"-DGRAPHVIZ_DOT=/opt/homebrew/bin/dot"

Serajevo answered 17/3 at 4:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.