Paul Johnson
2006-Jan-20 16:27 UTC
[R] cron job install/update problems: tcltk can't find display (installing e.g., pbatR)
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. * Installing *source* package 'pbatR' ... ** libs g++ -I/usr/lib/R/include -I/usr/local/include -fPIC -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -c wait.cpp -o wait.o wait.cpp: In function 'int runCommands()': wait.cpp:77: warning: ignoring return value of 'int system(const char*)', declared with attribute warn_unused_result g++ -shared -L/usr/local/lib -o pbatR.so wait.o -L/usr/lib/R/lib -lR ** R ** save image Loading required package: survival Loading required package: splines Loading required package: tcltk Loading Tcl/Tk interface ... Error in fun(...) : no display name and no $DISPLAY environment variable Error: .onLoad failed in 'loadNamespace' for 'tcltk' Error: package 'tcltk' could not be loaded Execution halted ERROR: execution of package source for 'pbatR' failed ** Removing '/usr/lib/R/library/pbatR' ** Restoring previous '/usr/lib/R/library/pbatR' -------------------------------------------------------------- Here's the R code that runs from the Cron job # Paul Johnson <pauljohn at 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
Prof Brian Ripley
2006-Jan-20 17:56 UTC
[Rd] [R] cron job install/update problems: tcltk can't find display (installing e.g., pbatR)
This really is an R-devel question, so moved there. (Just what would you use R-devel for?) On Fri, 20 Jan 2006, Paul Johnson wrote:> 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?Yes. At least for tcltk this is solved in R-devel, so it will start without X11. Some of your `black list' will work if you update your gcc to the current version (4.0.2).> 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.Yes, if you run an X server (e.g. Xvfb) to which a cron job has access.> 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.It is unreasonable that some packages expect X11 to be running to be installed or checked. So if the issue is not tcltk, please complain to the maintainer(s). -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Peter Dalgaard
2006-Jan-20 18:09 UTC
[R] cron job install/update problems: tcltk can't find display (installing e.g., pbatR)
Paul Johnson <pauljohn32 at gmail.com> writes:> 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.The procedure used by CRAN (e.g.) for the automated testing involves running a virtual X server (Xvfb). On FC4 you'll need to install the RPM xorg-x11-Xvfb-6.8.2-37.FC4.49.2, start it as part of the cron job and point your DISPLAY variable at it. -- O__ ---- Peter Dalgaard ??ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907