[R-pkg-devel] how to make "r-release-osx-x86_64-mavericks" machine support rgl 3D plots

Duncan Murdoch murdoch.duncan at gmail.com
Wed Aug 12 15:07:15 CEST 2015


On 12/08/2015 8:26 AM, Dirk Eddelbuettel wrote:
> 
> Hi Søren,
> 
> On 12 August 2015 at 11:44, Søren Havelund Welling wrote:
> | Dear all
> | 
> | I have a package(forestFloor) which produces an test error when built on the "r-release-osx-x86_64-mavericks" machine. I'm quite sure it's due to Xquartz(or similar) graphical resources have to be installed for 3D plotting. I tried with no luck, to screen the source code of ~15 other packages importing rgl to get some inspiration. Most packages did not run any rgl examples or tests.
> | 
> | See the error message below
> | 
> | Questions:
> | 1. I there a fix for "r-release-osx-x86_64-mavericks" machine? Could I e.g. specify Xquartz to be installed?
> | 2. Should I in general just assume no OSX user has installed Xquartz and link to a OSX install-guide from source in description file?
> | 3.  Can I in general test builds on "r-release-osx-x86_64-mavericks" machine somehow without spamming CRAN with submissions?
> 
> 
> I don't know about 1) to 3) but may I plead with you to not run rgl code
> during R CMD check?
> 
> I frequently tests against all reverse dependencies against some of my
> packages, ie Rcpp, RcppArmadillo, ... and packages using rgl generally fail
> during these tests.
> 
> A simple wrapper like
> 
>   if (interactive()) {
>       # do something
>   }
> 
> can help in demos or examples. 
> 
> | Thanks in advance
> | Soren H Welling
> | 
> | Check DetailsVersion: 1.8.3 
> | Check: tests 
> | Result: ERROR 
> |     Running the tests in ‘tests/stdUsage.R’ failed.
> |     Last 13 lines of output:
> |      > plot(ffTest42,col=Col,plot_GOF=TRUE,speed=T) 
> |      [1] "compute goodness-of-fit with leave-one-out k-nearest neighbor(guassian kernel), kknn package"
> |      > 
> |      > #if ever needed, k-nearest neighbor parameters for goodness-of-fit can be access through convolute_ff
> |      > #a new fit will be calculated and added to forstFloor object as ffTest42$FCfit
> |      > ffTest42 = convolute_ff(ffTest42,userArgs.kknn=alist(kernel="epanechnikov",kmax=5))
> |      > plot(ffTest42,col=Col,plot_GOF=TRUE)
> |      > 
> |      > #in 3D the interaction between X3 and X reveals itself completely
> |      > show3d(ffTest42,3:4,col=Col,plot.rgl=list(size=5),sortByImportance=FALSE) 
> |      Error in rgl.open(useNULL) : rgl.open failed
> |      Calls: show3d ... plot3d.default -> next3d -> .check3d -> open3d -> rgl.open
> |      Execution halted 
> | Flavor: r-release-osx-x86_64-mavericks
> 
> 
> Yes, I see lots of that on Linux too as the tests run 'headless' without a
> controlling terminal.

A while ago I added support in rgl to run on headless machines.  Set the
environment variable RGL_USE_NULL=TRUE before loading rgl, and should
never try to call X11 (or whatever graphics system you're using).
(It's also possible to use options(rgl.useNULL = TRUE) within R.  That's
no help to you, but is useful when embedding rgl plots in knitr documents.)

Duncan Murdoch



More information about the R-package-devel mailing list