I am working with a R script within a wider pipeline that seems to not work with some versions of Rscript but with others. The call fails due to being unable to connect to X11, which is understandable because this is on a server. But my local installation of Rscript is able to handle this fine?
My local installation is version 3.0.1, while the one that other users that are reporting this problem are on 3.0.2.
Here is a simple test case - first the .R file:
#!/usr/bin/env Rscript
capabilities()
png("abc")
dev.off()
Run with my local env:
-bash-4.1$ ./test.R
jpeg png tiff tcltk X11 aqua http/ftp sockets
TRUE TRUE TRUE TRUE FALSE FALSE TRUE TRUE
libxml fifo cledit iconv NLS profmem cairo
TRUE TRUE FALSE TRUE TRUE FALSE TRUE
null device
1
Run on the installation of Rscript others are trying to use:
jpeg png tiff tcltk X11 aqua http/ftp sockets
TRUE TRUE FALSE TRUE FALSE FALSE TRUE TRUE
libxml fifo cledit iconv NLS profmem cairo
TRUE TRUE FALSE TRUE TRUE FALSE TRUE
Error in .External2(C_X11, paste("png::", filename, sep = ""), g$width, :
unable to start device PNG
Calls: png
In addition: Warning message:
In png("abc") : unable to open connection to X11 display ''
Execution halted
In case anyone ever finds this on google, the solution is
png("abc", type="cairo")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With