DavideChicco.it
DavideChicco.it

Reputation: 3470

Tcl not working with R on Linux CentOS 7, how to solve it?

I've been using R and Rscript on my Linux CentOS 7 system and everything worked fine for years.

Today I tried to install a package, clusterSim, but my R environment does not seem to work anymore. Here's the error I get:

install.packages("clusterSim");

--- Please select a CRAN mirror for use in this session --- Warning: failed to download mirrors file (internet routines cannot be loaded); using local file '/home/davide/miniconda3/lib/R/doc/CRAN_mirrors.csv' Error: .onLoad failed in loadNamespace() for 'tcltk', details: call: fun(libname, pkgname) error: Can't find a usable init.tcl in the following directories: /opt/anaconda1anaconda2anaconda3/lib/tcl8.5 ./lib/tcl8.5 ./lib/tcl8.5 ./library ./library ./tcl8.5.18/library ./tcl8.5.18/library

This probably means that Tcl wasn't installed properly.

I tried to install tcl, and I got this message:

sudo yum -y install tcl

Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: centos.mirror.rafal.ca * epel: mirror.math.princeton.edu * extras: mirror2.evolution-host.com * ius: mirror.team-cymru.org * nux-dextop: li.nux.ro * updates: centos.mirror.iweb.ca Package 1:tcl-8.5.13-8.el7.x86_64 already installed and latest version Nothing to do

Any idea on how to solve this problem? Thanks

Upvotes: 2

Views: 1890

Answers (3)

DavideChicco.it
DavideChicco.it

Reputation: 3470

Thanks to some friends on GitHub, I was able to solve this problem.

The problem is that now I have multiple versions of R on my laptop:

  1. /usr/bin/R: the standard version I would like to use;

  2. ~/miniconda3/bin/R: the version installed by Miniconda that is causing me all the troubles.

First of all I had to understand what version is used by default by my system. I can do it with the which R command, that returned ~/miniconda3/bin/R

Then I realized I could have solve the problem by telling the system to stop using that R Miniconda version, and to employ the /usr/bin/R version instead.

I did this by editing the ~/.bashrc file. In the $PATH, my favourite R version path must be written before the Miniconda one.

Therefore my ~/.bashrc file now is something like this:

PATH=/usr/local/bin:$PATH
PATH=/usr/bin:$PATH
...
export PATH="$PATH:/home/davide/miniconda3/bin"

That's it; I hope this helps!

Upvotes: 1

mmoisse
mmoisse

Reputation: 150

To me it looks like you are using R installed by conda. Do you also get this issue when you open R with /usr/bin/R in your terminal, because I believe which R will point to you conda repository.

See How to install R-packages not in the conda repositories? for extra info.

I solved this problem by using one of the following two approaches:

  1. Prior to install a package I choose my CRAN mirror manually chooseCRANmirror(graphics=F)

  2. Prior to install I turn off the graphical menu options("menu.graphics"=F)

  3. Make sure conda in after /usr/bin in you PATH, check your ~/.bashrc

Upvotes: 0

Nikhil Fadnis
Nikhil Fadnis

Reputation: 797

Something related to this is already reported as a bug but is closed off as partially corrected.

Have you tried this ?

install.packages("clusterSim", repos='http://cran.us.r-project.org')

Check out this for more !!!

Upvotes: 2

Related Questions