[R-SIG-Mac] loading Rcmdr, R-Tcl/Tk errors due to X11

stefano iacus stefano.iacus at unimi.it
Wed Oct 19 19:08:19 CEST 2005


On 19/ott/05, at 18:23, Dan Putler wrote:

> Hi Stefano,
>
> One problem that I ran into is that an R workspace (if it has been
> saved after a prior session where R Commander was used) will load the
> tcltk package at startup. This causes a fatal error in R, and the R
> Console application will never come up if X11 isn't already running.
> How I dealt with this problem was to write an applescript that
> launched X11 followed by R. This worked under Panther, but my
> applescript stopped working under Tiger, and I haven't taken the time
> yet to diagnose the problem. However, I'm about to start working on R
> Commander related things for class, and one of my goals is to look at
> ways to make things easier for Mac users.

why you don't put X11.app in the startup app preferences? (if you  
have x11 running, you can even do this from the doc).

Unfortunately X11.app must be installed by the end as it is not  
installed by the OS X Apple's installer by default (don't ask me why!!!)

For several reasons we decided not to run the X11.app at R launch  
but, given that this is becoming a faq, I'm thinking about adding a  
Preference setting into R.app to launch X1.app at startup. At the  
moment R.app just sets the DISPLAY env var to :0 so that R can  
connect to the X11 server if present.

>
> As things stand now, it is far easier to get a novice Windows user up
> and running with R Commander (they just need to double-click on a
> customized installer, and after that when they launch R, R Commander
> is automatically loaded along with all its support packages) than it
> is for a Mac user (who may need to install X11, Xcode tools, and
> download and compile libpng if they want access to rgl under R
> Commander).

this is no longer true as libpng is statically linked to R. XCode  
tools and company are not needed as well, only if users want to build  
packages their own (but this is also true for Windog R I guess)

btw next release (have a look on CRAN or wait for the official  
announcement ;) ) is now less dependent on external libraries


> When you want to just run things under an application
> GUI (like R Commander or James's  limmaGUI and affylmGUI) it might be
> the case that taking Jan's approach of running the console in an X11
> terminal, using the X11 graphics devise (instead of Quartz), and
> using aqua Tcl/Tk (to make the GUI feel more like a Mac app) works
> best in terms of developing a simple configuration for novice users.

if you run R from the terminal and you assume you can use X11 for  
graphics instead of quartz, then I don't see why this is easier for  
the dummy user. He needs to run X11.app anyway before R. So why not  
telling him: please launch X11.app and then R (if you need Rcommander)
In my opinion Jan's approach is probably the best approach if you  
need to  run R from Emacs but not for dummy user

> Over the next month I'll experiment with a few things, and post what
> I find works best to the list.
thanks for this
stefano

>
> Dan
>
> On 19-Oct-05, at 1:16 AM, stefano iacus wrote:
>
>
>>
>> On 19/ott/05, at 09:21, James Wettenhall wrote:
>>
>>
>>
>>
>>> Thanks Jan,
>>>
>>> That makes some sense to me.  But I'm still not really clear on how
>>> best
>>> to advise a user of my R-Tcl/Tk package who says "I'm just a dumb  
>>> GUI
>>> user.  I don't want to use the R command-line, I only want to use
>>> your
>>> Tcl/Tk GUI.  And I don't want to learn what an environment variable
>>> is.
>>> etc."
>>>
>>>
>>>
>>>
>>
>> if this is the case, your user is probably an R.app user. Then this
>> use will find on the R.app toolbar an icon with "X11" in it. Just
>> click on it before launching your package (or any tcltk based
>> package). That's all.
>> One other option for your user is to read the OS X Faq, but I know
>> this is rarely the case...
>>
>>
>>
>>
>>
>>
>>> It's very unlikely that the sort of user I'm talking about would be
>>> using
>>> emacs (and I don't use it either).  I'm more interested in making
>>> it as
>>> easy as possible for a user to get started with an R-Tcl/Tk GUI who
>>> doesn't know how to use the R command-line and who doesn't know  
>>> about
>>> things like environment variables and .Rprofile files etc.  So
>>> that's why
>>> I was wondering whether it would be possible for tcltk's .First.lib
>>> () or
>>> equivalent to test whether X11 is running, and if not, give a
>>> friendly
>>> error message.
>>>
>>> Best wishes,
>>> James
>>>
>>>
>>>
>>>
>>>
>>>
>>>> I run R from the terminal, from the Aqua GUI, from Carbon/Cocoa
>>>> emacs, or from X11 emacs. In order to make sure that X11 is
>>>> always available I start X11.app from the login items in system
>>>> preferences. This is not enough, because running R from carbon/ 
>>>> cocoa
>>>> emacs cannot
>>>> find $DISPLAY even if X11.app is running and it is defined
>>>> in .tcshrc
>>>> -- so in addition my Rprofile.site has
>>>>
>>>> local({
>>>>         options(device="x11")
>>>>         options(repos="http://cran.r-project.org")
>>>>         options(pkgType="source")
>>>>         Sys.putenv(DISPLAY=":0.0")
>>>>      })
>>>>
>>>> .First <- function() {
>>>>     cat("\n   Welcome to Jan's R-2.3.0 !\n\n")
>>>>     }
>>>>
>>>> This guarantees that library(tkrplot) or library(tcltk) always
>>>> works in all my different GUI's.
>>>>
>>>> On Oct 18, 2005, at 19:24 , James Wettenhall wrote:
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>> Hi,
>>>>>
>>>>> This problem of getting Tcl/Tk errors in R on MacOSX because X11
>>>>> isn't
>>>>> running seems to be quite common, and unfortunately R's tcltk
>>>>> package is
>>>>> currently unable to check whether X11 is running (if the operating
>>>>> system
>>>>> is Darwin) and if not, give a friendly error message advising the
>>>>> user to
>>>>> run X11.  My expertise on this is limited, but do people think it
>>>>> would be
>>>>> possible for the tcltk package to automatically check for X11?
>>>>> Obviously
>>>>> this is platform dependent - X11 is not required on Windows.
>>>>>
>>>>> A colleague of mine had Tcl/Tk errors and she found that she could
>>>>> only
>>>>> start R-Tcl/Tk applications when her network cable was removed  
>>>>> from
>>>>> her
>>>>> laptop.  When the network cable was plugged in, X11 appeared to
>>>>> start OK,
>>>>> but then it silently froze up due to some network problem.  So the
>>>>> R-Tcl/Tk interface failed to initalize as a result.
>>>>>
>>>>> Hope this was of interest to some people.
>>>>> Best wishes,
>>>>> James
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> Hi Cormac,
>>>>>>
>>>>>> The error you are getting is because X11 isn't launched prior to
>>>>>> when
>>>>>> you are launching the tcltk package in R. Try rebooting, and
>>>>>> attempt
>>>>>> to launch X11 before loading R. If X11 still doesn't launch, then
>>>>>> your problem isn't with R, and you might reinstalling X11.
>>>>>>
>>>>>> You also probably want to look at the OS X installation
>>>>>> instructions
>>>>>> for R Commander (http://socserv.socsci.mcmaster.ca/jfox/Misc/
>>>>>> Rcmdr/
>>>>>> installation-notes.html).
>>>>>>
>>>>>> Dan
>>>>>>
>>>>>> On 18-Oct-05, at 3:54 PM, Cormac Lawler wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>> (originally posted to R-Help - advised to post here)
>>>>>>> Hi,
>>>>>>> I'm using a Mac, I've downloaded R (base), and I'm trying to
>>>>>>> download
>>>>>>> the package R Commander. I thought I had already done this (both
>>>>>>> from
>>>>>>> the web and from within R) but it doesn't seem to be working -
>>>>>>> it's
>>>>>>> not there as a "search()" reveals. However, there are plenty of
>>>>>>> files
>>>>>>> on my system linked with Rcmdr - located in
>>>>>>> HD>Library>Frameworks>R.framework>Versions>2.1.1>Resources>Libra 
>>>>>>> r
>>>>>>> y
>>>>>>>
>>>>>>>
>>>>>>>> R
>>>>>>>>
>>>>>>>>
>>>>>>> cm
>>>>>>> dr.
>>>>>>> Is it simply in the wrong location to use it? The other
>>>>>>> possibility is
>>>>>>> that I keep getting a tcltk error whenever I try to load up the
>>>>>>> package from the Package Manager from within R - and when I
>>>>>>> try to
>>>>>>> upload the tcltk package, this also gives the same error [1]. I
>>>>>>> also
>>>>>>> get a "Couldn't launch application" error whenever I try to
>>>>>>> launch the
>>>>>>> X11.app.
>>>>>>>
>>>>>>> This is probably so basic it's staring me in the eyes, but I  
>>>>>>> need
>>>>>>> your
>>>>>>> help please. I'd be happy to give any extra info you need.
>>>>>>>
>>>>>>> Thanks
>>>>>>> Cormac
>>>>>>>
>>>>>>> [1] Loading required package: tcltk
>>>>>>> Loading Tcl/Tk interface ... Error in dyn.load(x, as.logical
>>>>>>> (local),
>>>>>>> as.logical(now)) :
>>>>>>>        unable to load shared library
>>>>>>> '/Library/Frameworks/R.framework/Resources/library/tcltk/libs/
>>>>>>> tcltk.so':
>>>>>>>  dlcompat: dyld: /Applications/R.app/Contents/MacOS/R can't open
>>>>>>> library: /usr/local/lib/libtk8.4.dylib  (No such file or
>>>>>>> directory,
>>>>>>> errno = 2)
>>>>>>> In addition: Warning messages:
>>>>>>> 1: cannot create HTML package index in: make.packages.html()
>>>>>>> 2: cannot create HTML package index in: make.packages.html()
>>>>>>> Error: .onLoad failed in 'loadNamespace' for 'tcltk'
>>>>>>> Error: package 'tcltk' could not be loaded
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> R-SIG-Mac mailing list
>>>>>>> R-SIG-Mac at stat.math.ethz.ch
>>>>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> R-SIG-Mac mailing list
>>>>>> R-SIG-Mac at stat.math.ethz.ch
>>>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> R-SIG-Mac mailing list
>>>>> R-SIG-Mac at stat.math.ethz.ch
>>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> ===
>>>> Jan de Leeuw; Distinguished Professor and Chair, UCLA Department of
>>>> Statistics;
>>>> Editor: Journal of Multivariate Analysis, Journal of Statistical
>>>> Software
>>>> US mail: 8130 Math Sciences Bldg, Box 951554, Los Angeles, CA
>>>> 90095-1554
>>>> phone (310)-825-9550;  fax (310)-206-5658;  email:
>>>> deleeuw at stat.ucla.edu
>>>> .mac: jdeleeuw ++++++  aim: deleeuwjan ++++++ skype: j_deleeuw
>>>> homepages: http://gifi.stat.ucla.edu ++++++ http://
>>>> www.cuddyvalley.org
>>>>
>>>> ------------------------------------------------------------------- 
>>>> -
>>>> -
>>>> ---
>>>> -------------------------
>>>>            No matter where you go, there you are. --- Buckaroo
>>>> Banzai
>>>>                     http://gifi.stat.ucla.edu/sounds/nomatter.au
>>>>
>>>> ------------------------------------------------------------------- 
>>>> -
>>>> -
>>>> ---
>>>> -------------------------
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>> _______________________________________________
>>> R-SIG-Mac mailing list
>>> R-SIG-Mac at stat.math.ethz.ch
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>>
>>>
>>>
>>>
>>>
>>
>> _______________________________________________
>> R-SIG-Mac mailing list
>> R-SIG-Mac at stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>
>>
>
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>
>



More information about the R-SIG-Mac mailing list