Error ".Onload Failed in Loadnamespace() for 'Tcltk'"

Error .onLoad failed in loadNamespace() for 'tcltk'

tcltk is not a typical package. It's probably already installed on your system and it cannot be installed using the usual install.packages procedure because it is not on CRAN (just like the base packages that come with R, like stats, etc.). Also, tcltk2 is not the same as tcltk; that is a package that expands upon (and depends on) the functionality of tcltk.

So, start with this:

> capabilities("tcltk")
tcltk
TRUE

If that comes back FALSE it means that your R was not built with tcltk support. You don't say what OS you're using, so it's a little bit difficult to help you.

That said, if you're on Linux, you need to rebuild R with tcltk support. This should be relatively straightforward. Basically, make sure Tcl and tk are available on your system in a standard location (something like sudo apt-get install tcl8.5-dev tk8.5-dev) and then rebuild R per usual procedures.

If you're on Mac OS, you're encountering the same error that John Fox describes here in relation to Rcmdr. In short, it's probably one of two things:

  1. A file permission issue related to the directory where you have Tcl installed. To quote Fox: "You can verify the source of this problem by issuing the following command at the R command prompt:

    system("ls -ld /usr/local /usr/local/lib /usr/local/lib/libtcl*")
    # ls: /usr/local/lib: Permission denied
    # ls: /usr/local/lib/libtcl*: Permission denied
    # drwx------ 8 root wheel 272 Sep 24 10:21 /usr/local

If the output of the system command looks like the above, you should go to Terminal and do the following: sudo chmod -R a+rX /usr/local and enter your password to change directory permissions.


  1. You have an out-dated version of X-Windows. Try running Mac OS Software Update.

It may also be solvable by creating a symbolic link as described in this answer.

This should never come up on Windows, unless you built R from source without tcl/tk support.

Error: .onLoad failed in loadNamespace() for 'tcltk', details:

Archlinux offers the needed package your system is searching for.

  1. Install this package on your system
  2. Subsequent install tcltk in R via install.packages("tcltk").
  3. Now you are able to install the package zoo completely: install.packages("zoo").

This should solve your problem.

Error : .onLoad failed in loadNamespace() for 'tcltk', details:call: fun(libname, pkgname)

In general, the first thing to do when you get an error like this is to read everything that it says thoroughly. In many cases, like this one, you will learn something that either completely solves your problem or gets you close to it.

Take a look at this line, near the end:

  error: X11 library is missing: install XQuartz from xquartz.macosforge.org

Hence, you should probably install XQuartz from that website!

package or namespace load failed error in loading R package litteR

You need to install the commando line tools. Open the Terminal.app and run the following line xcode-select --install

I am having a problem loading library soiltexture in R

tcl/tk was a popular UI scripting language before python became popular.

Looking at your error, I assume you are on Windows. The package is missing the tcl shared libraries. See here - https://wiki.tcl-lang.org/page/How+to+compile+Tcl+and+related+C+extensions+on+Windows

Step 1 - is tcl/tk working without R: Find wish.exe of tcltk and start it. Does it work ?

Step 2 - Check the value of the environment variable MY_TCLTK
Does it point to the bin folder of Tcl/Tk? If not: Fix it.

If not defined: Set value to bin folder.

See here - https://mirrors.dotsrc.org/cran/bin/windows/base/rw-FAQ.html#Package-TclTk-does-not-work_002e



Related Topics



Leave a reply



Submit