Same as Rstudio wont load packages with tcltk details. geoR can load in terminal but not in rstudio .onLoad failed in loadNamespace() for 'tcltk', details:

in my case:

  • openSuSE Leap 15.2
  • Microsoft R Open 4.0.2
  • RStudio desktop 1.3.1093

When opening 'tcltk' or 'summarytools' packages when starting R in the console...

> library(summarytools)
Registered S3 method overwritten by 'pryr':
  method      from
  print.bytes Rcpp
No protocol specified
For best results, restart R session and update pander using devtools:: or remotes::install_github('rapporter/pander')
> library(tcltk)
> .libPaths()
[1] "/home/vkelim/R/x86_64-pc-linux-gnu-library/4.0"
[2] "/opt/microsoft/ropen/4.0.2/lib64/R/library"    
> version
               _                           
platform       x86_64-pc-linux-gnu         
arch           x86_64                      
os             linux-gnu                   
system         x86_64, linux-gnu           
status                                     
major          4                           
minor          0.2                         
year           2020                        
month          06                          
day            22                          
svn rev        78730                       
language       R                           
version.string R version 4.0.2 (2020-06-22)
nickname       Taking Off Again    

But from inside RStudio...

> library(summarytools)
Registered S3 method overwritten by 'pryr':
  method      from
  print.bytes Rcpp
Error: package or namespace load failed for ‘summarytools’:
 .onLoad failed in loadNamespace() for 'tcltk', details:
  call: fun(libname, pkgname)
  error: Can't find a usable init.tcl in the following directories: 
    /builddir/vendor/build/lib/tcl8.6 ./lib/tcl8.6 ./lib/tcl8.6 ./library ./library ./tcl8.6.9/library ./tcl8.6.9/library



This probably means that Tcl wasn't installed properly.
> library(tcltk)
Error: package or namespace load failed for ‘tcltk’:
 .onLoad failed in loadNamespace() for 'tcltk', details:
  call: fun(libname, pkgname)
  error: Can't find a usable init.tcl in the following directories: 
    /builddir/vendor/build/lib/tcl8.6 ./lib/tcl8.6 ./lib/tcl8.6 ./library ./library ./tcl8.6.9/library ./tcl8.6.9/library



This probably means that Tcl wasn't installed properly.
> .libPaths()
[1] "/home/vkelim/R/x86_64-pc-linux-gnu-library/4.0" "/opt/microsoft/ropen/4.0.2/lib64/R/library"    
> version
               _                           
platform       x86_64-pc-linux-gnu         
arch           x86_64                      
os             linux-gnu                   
system         x86_64, linux-gnu           
status                                     
major          4                           
minor          0.2                         
year           2020                        
month          06                          
day            22                          
svn rev        78730                       
language       R                           
version.string R version 4.0.2 (2020-06-22)
nickname       Taking Off Again            

In openSuSE, tcl and tk RPMs are installed (both version 8.6.7)

Microsoft R Open has its own tcltk in /opt/microsoft/ropen/4.0.2/lib64/R/share/tcl8.6 (which contains the required init.tcl file)

The above error message can be 'fixed' by using a command like

ln -s /opt/microsoft/ropen/4.0.2/lib64/R/share/tcl8.6 /builddir/vendor/build/lib/tcl8.6/

but that requires root privileges, appears messy, and is probably not what is intended!

I note that in /etc/alternatives/R, which is used to start Microsoft R, that environment variable $R_SHARE_DIR is set to (effectively) /opt/microsoft/ropen/4.0.2/lib64/R/share and $TCL_LIBRARY is set to (effectively) /opt/microsoft/R/open/4.0.2/lib64/R/share/tcl8.6, but in RStudio

> Sys.getenv("TCL_LIBRARY")
[1] ""

(by contrast, the same command from the command line does have [1] "/opt/microsoft/ropen/4.0.2/lib64/R/share/tcl8.6/"

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.