[R] cron job install/update problems: tcltk can't find display (installing e.g., pbatR)

From: Paul Johnson <pauljohn32_at_gmail.com>
Date: Sat 21 Jan 2006 - 03:27:53 EST

On Fedora Core Linux 4, I have a cron job that causes R to update all packages and install new ones. Lately, I notice in the log that some packages fail to install. These are ones that assume X is running. For example, the pbatR install requires tcltk to be loaded, and then the install fails because in a cron job, there is no DISPLAY environment. I suppose the same happens if you try to install R packages in the console, without X running?

Error output is pasted here. I wonder if you can advise me whether this is the kind of thing that can be fixed in the cron job or not. I've verified that pbatR does install interactively (because tcltk does start). If you think this is a pbatR-specific problem, i will contact the author directly. When I have the repos option set, the interactive install does not cause any tcltk widgets to pop up, so I wonder if it is really necessary.

Here's the R code that runs from the Cron job

# Paul Johnson <pauljohn@ku.edu> 2005-08-31
# This should update and then install all packages, except for
# ones I exclude because they don't work or we don't want them.

#options(repos = "http://lib.stat.cmu.edu/R/CRAN/")
options(repos = "http://cran.cnr.berkeley.edu/")

#failPackages is the "black list".
# Things that don't build cleanly with FC4, but I
# hope it will build someday soon.

failPackages <-
c("deldir","frailtypack","fSeries","fCalendar","fExtremes","fPortfolio","hmm.discnp","knncat","labdsv","survrec", "SciViews","RGrace","uroot","fMultivar","fOptions","gcmrec","rcom","Rlsf")

#list of all currently installed packages
installedPackages <- rownames (installed.packages() )

#do any installed packages need removal because they are on the blacklist?
needRemoval <- installedPackages %in% failPackages

# remove any blacklisted packages if they are already installed.
if (sum(needRemoval) >0) remove.packages(installedPackages[needRemoval] )

#update the ones you want to keep

update.packages(ask=F, checkBuilt=T)

#get list of all new packages on CRAN

theNew <- new.packages()

#do any of the new packages belong to the black list?
shouldFail <- theNew %in% failPackages

#install non blacklisted packages that are in theNew list
if (sum(!shouldFail) > 0) install.packages( theNew[!shouldFail],dependencies=T)

Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas

R-help@stat.math.ethz.ch mailing list
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Sat Jan 21 04:05:06 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:42:08 EST