[R] tcltk installation problem in R (Mac OS X version)

peter dalgaard pdalgd at gmail.com
Fri Sep 14 07:47:41 CEST 2012


On Sep 14, 2012, at 06:48 , David Winsemius wrote:

> 
> On Sep 13, 2012, at 8:05 PM, Nitin Bhardwaj wrote:
> 
>> Hi all, I just installed R on my Mac OS X machine
> 
> How did you do that?  (... and please don't reply to this message in r-help. It should go to R-SIG-Mac and I am adding that address. You should delete the r=help address when you reply)
> 
>> and wanted to installed
>> tcl/tk. So, I installed tcl/tk from this page:
>> http://cran.r-project.org/bin/macosx/tools/
>> 
>> It gets placed in /usr/local dir.
>> and then I installed R.
>> 
>> Next, in R, I set the TCL_LIBRARY variable by saying
>> Sys.setenv(TCL_LIBRARY="/usr/local/lib/tcl8.5")
>> and
>> Sys.setenv(TK_LIBRARY="/usr/local/lib/tk8.5")
> 
> When I do 
>> Sys.getenv("TK_LIBRARY")
> #I get an empty string
> [1] ""
>> 
>> But still when I try to run any GUI-based program,
> 
> Exactly what does "any" mean or can you give a specific example?
> 
>> it gives me the error
>> that TCL/TK were not istalled.
>> 
>> In tclRequire(tclPkg) : Tcl package 'BWidget' not found
>> 
>> I have a suspicion that I am not setting the TCL_LIBRARY right. When I try
>> to set the TCL_VARIABLE to /usr/bin  even then it does not work. What am I
>> doing wrong? Please help.
> 
> I'm pretty sure that tcltk is one of the default packages that come with the standard MacOS R package. I don't remember needing to any separate install and tcltk gets loaded with many of the packages that need it but it doesn't appear in the package installer menu (as do not stats or base of grDevices). It's listed as a base package:
> 
> ( From my sessionIfo() : )
> 
> attached base packages:
> [1] tcltk     grDevices datasets  splines   graphics  utils     stats     methods   base     
> 
> I think you need to follow protocol:
> 
> post to the right list
> and
> post sessionInfo()

In this case, actually reading the error message also helps!

>> In tclRequire(tclPkg) : Tcl package 'BWidget' not found

If tcltk as such didn't work, you'd never get as far as getting an error from tclRequire. The issue is that the Tcl/Tk install doesn't include the _Tcl_ package 'BWidget'. How to install it on OSX was described in a post on R-sig-mac on July 4 2012.

(Retaining r-help in cc: since missing Tcl packages could happen on all platforms although perhaps not specifically BWidget. In general, you need to sort out what the preferred method of installation is on your platform. That is not an R issue.)

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com




More information about the R-help mailing list