rkrug / plantuml

R package to build UML graphs using plantuml
https://rkrug.github.io/plantuml/index.html
GNU General Public License v3.0
76 stars 8 forks source link

Graphviz must also be installed #13

Closed erex closed 4 years ago

erex commented 4 years ago

Running in Windows 10. Followed plantuml installation instructions, including updatePlantumlJar(), but received error message (in RStudio viewer window) that graphviz needed to be installed.

After doing so, diagram successfully created (message about graphvis in background of viewer window): image but only if argument vector is set to FALSE in plot(x, vector=FALSE). Otherwise this error is returned to console:

> plot(x)
Error in grImport::PostScriptTrace(file = fn, outfilename = fnrgl) : 
  status 127 in running command 'gswin32c.exe -q -dBATCH -dNOPAUSE -dNOSAFER -sDEVICE=ps2write -sOutputFile=C:\Users\erexs\AppData\Local\Temp\RtmpUrUguc\file1854704f28a4 -sstdout=C:\Users\erexs\AppData\Local\Temp\RtmpUrUguc\file185465d725d8.rgml C:\Users\erexs\AppData\Local\Temp\RtmpUrUguc\file18542755602.ps'

I now see this comment in readme.md

make selection dependant on installed packages, as vector = TRUE requires postscript to be installed!

It would be nice if there could be a more gentle failure of the plot function.

rkrug commented 4 years ago

Yes - graphviz needs to be installed. There are other dependencies depending on the output format, notably pdf.

This seems to be a problem with the Ghostscript installation / grImport package. I assume, this is a problem in grImport. Could you try ´library(grImport)´ and see if that works?

erex commented 4 years ago

No success:

 library(plantuml)

> x <- '
+ (*) --> "Initialization"
+ 
+ if "Some Test" then
+   -->[true] "Some Activity"
+   --> "Another activity"
+   -right-> (*)
+ else
+   ->[f .... [TRUNCATED] 

> x <- plantuml( 
+   x
+ )

> library(grImport)
Loading required package: grid
Loading required package: XML

> plot(x)
Error in grImport::PostScriptTrace(file = fn, outfilename = fnrgl) : 
  status 127 in running command 'gswin32c.exe -q -dBATCH -dNOPAUSE -dNOSAFER -sDEVICE=ps2write -sOutputFile=C:\Users\erexs\AppData\Local\Temp\RtmpuwQJVJ\file484848456c21 -sstdout=C:\Users\erexs\AppData\Local\Temp\RtmpuwQJVJ\file48485f561d39.rgml C:\Users\erexs\AppData\Local\Temp\RtmpuwQJVJ\file484878094897.ps'
rkrug commented 4 years ago

This is a grImport proble. See e.g. https://stackoverflow.com/questions/35256501/windows-rgrimport-ghostscript-error-status-127

status 127 seems to indicate, that the command has not been found. So it is a problem with the Ghostscript installation or the grImport package. I have no idea why this is happening - please enquire with the maintainer of grImport or on stackexchange.

Sorry about this.

erex commented 4 years ago

I have no past experience with Ghostscript being on a Windows box. I note with interest there is a package grImport2.

Meanwhile, given I can successfully produce output, I'm not too bothered.

rkrug commented 4 years ago

Good.

grImport2 works with svg files - not eps. It was easier to work with eps, as for the svg files, an additional dependency is needed. But you can circumvent all this by using the knit engine supplied - check out the issue #10 for a discussion. It works now.

grImport is only used to display the graph in a graphics device.

rkrug commented 4 years ago

Sorry - issue #10