Hi

I would like to install Graphviz for use with R. I have Windows 10. I couldn’t find any instructions on how to do this (there are no executable files - only the console). I’d be grateful for any help on installation as I’m not sure. I emailed John Ellison but he didn’t know. Many thanks I’m advance!

Sara

Sorry about the badly documented way to do this. We are in the process of remaking this completely. Here are more detailed instructions on how to do it:

1. Locate a build at https://ci.appveyor.com/project/ellson/graphviz-pl238/history
2. Click on the build you want.
3. Select configuration by clicking on the job you want to install from
4. Click on artifacts
5. Download the .exe and run (CMake) or the .zip and unpack (MSBuild)
6. Run dot -c to install plugins

How do I know which build and whether Debug or Release?
I downloaded [Environment: build_system=cmake, generator=Visual Studio 14 2015; Configuration: Release] but don’t know if it’s correct.
Where do I find CMake and where do I run dot -c? Sorry for my questions but I’m not very IT oriented.

In path, I specified the installation path C:\Program Files (x86)\Graphviz 2.45.20200623.1728\bin; and R does not recognise it. I would l really appreciate further advice as I can’t proceed with my analysis without Graphviz. Many thanks!

Choose Release if you aren’t going to debug software that you have written yourself that integrates with Graphviz libraries (If you aren’t IT oriented, you definitely aren’t doing that).

That’s one option, but if you aren’t IT oriented you should probably choose one of the cmake release builds since they come with an installer. If you know you have a 64-bit computer you can select Environment: build_system=cmake, generator=Visual Studio 14 2015 Win64; Configuration: Release, otherwise chose Environment: build_system=cmake, generator=Visual Studio 14 2015; Configuration: Release which will always work.

Then you’ll get an installer that you can run just by clicking on it. Make sure you select Add Graphviz top the system PATH for current user during the installation.

You don’t need CMake. After the installation is finished search for CMD using normal Windows search and Run as Administrator. In the Window that opens run dot -c. Now you are set to go.

Fantastic! Thank you for such a detailed response. I couldn’t have figured all that out alone. Will give it a go now.

1 Like

@magjac Hi Magnus. I followed your instructions and no joy. Am I meant to see any message after typing dot -c? There was no message at all.

This is the error message: in R:

1: In getGraphVizPath(“programfiles(x86)”) : NAs introduced by coercion 2: running command ‘C:\WINDOWS\system32\cmd.exe /c " “C:\Program Files (x86)\bin\dot.exe” -Tpng -otmpseqtree27f811426ed0.png tmpseqtree27f811426ed0.dot "’ had status 1

I have Graphviz installed here - C:\Program Files (x86)\Graphviz 2.45.20200623.1728. Is R looking in the wrong place?

No. No messages unless there are errors.

Yes.

1. Try to restart R or RStudio or what you are using. If that doesn’t help;
2. Restart the computer. If that doesn’t help;
3. Uninstall all Graphviz installations though the Control Panel -> Programs: Uninstall a program
4. Repeat the installation
5. Repeat the steps above if necessary.

Hi magjac,

I have followed the instructions you have given here and I installed graphviz but I have another error: pydotplus.graphviz.InvocationException: Program terminated with status: 1. stderr follows: Format: “png” not recognized. Use one of:

You need to run dot -c as an administrator to install all plugins. Without it there are no formats available, hence the empty list of formats you get.

I tried your suggestions and no joy. I tried the whole process on another computer and R isn’t recognizing the installation. Same error message. Not sure where to go from here.

I didn’t notice this before, but you need to change this to the path where Graphviz is installed. Is this part of R code that you have written yourself? If not, you need to find a way to configure R to use the correct path.

I might be able so give more detailed instructions if you can show your R code. Preferably, the whole program and data so I can execute it. If that is not possible; as large a portion of it has possible.

Thank you Magnus! May I send you files via email?

Yes. I’ve sent my email address as a private message to you.

If you put this in the beginning of your R program it should work:

Sys.setenv("GVPATH" = "C:\\Program Files (x86)\\Graphviz 2.45.20200623.1728")


This is what it renders for me:

Initially, I got a slightly different error message that you, so if it still doesn’t work for you, check your RStudio version. I have Version 1.3.959. You might need to upgrade.

My error message was:

> seqtreedisplay(st, type = "d", border = NA)
The system cannot find the path specified.
Error in disstreedisplayInternal(tree = tree, filename = filename, tmpdisstree = tmpdisstree,  :
[!] GraphViz was not found. If you haven't, please install GraphViz to use this function: see http://www.graphviz.org
[!] If GraphViz is installed on your computer, you need to specify the GraphViz installation directory using the argument gvpath='installdir'
[!] You can also add this directory to the PATH environment variable
[!] GraphViz installation directory usually looks like 'C:\Program Files\GraphViz'


I checked my PATH and it was:

> Sys.getenv("PATH")
[1] "C:\\Program Files\\R\\R-4.0.2\\bin\\x64;C:\\Python38\\Scripts\\;C:\\Python38\\;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files\\PuTTY\\;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Git\\mingw64\\bin;C:\\Program Files\\Git\\usr\\bin;C:\\ProgramData\\chocolatey\\bin;C:\\Program Files\\Docker\\Docker\\resources\\bin;C:\\ProgramData\\DockerDesktop\\version-bin;C:\\Users\\magja\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\magja\\Bin;C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\MSBuild\\Current\\Bin;C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Auxiliary\\Build;C:\\Users\\magja\\graphviz-helpers\\Bin;C:\\Program Files (x86)\\Graphviz 2.45.20200623.1728\\bin"


It looks correct, but for some reason it doesn’t work without the solution above.

I got it from reading the source code for TraMineR's disstree2dot.R

Thank you so much Magnus! This solved the issue.

1 Like

This what solved the issue for me.

1. Install Graphviz
1.2. -> Stable Windows install packages
1.3.-> 10
1.4. -> cmake/
1.5 -> Release/
1.6 -> x64 (orWin32)
1.7 -> graphviz-install-2.44.1-win64.exe (or a later version)

2. Go to PowerShell as admistrator via windows search and run dot -c.
There will not be any messages if things go well. (CMD did not work for me, had to use powershell)

3. Run this line in R after restarting R
Sys.setenv(gvpath="C:/Program Files/Graphviz 2.44.1")
This will solve the path issues. I did not succeed adding Graphviz to path.

4. Then your code should work seqtreedisplay(tree)

1 Like