Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhelpful error message when using install.packages #1512

Closed
astrojuanlu opened this issue Mar 9, 2017 · 7 comments
Closed

Unhelpful error message when using install.packages #1512

astrojuanlu opened this issue Mar 9, 2017 · 7 comments

Comments

@astrojuanlu
Copy link

astrojuanlu commented Mar 9, 2017

When trying to install R packages in a newly created environment, the prompt complains about tcl not being available.

jlcano@jlcano ~ $ conda create -n test_r
Fetching package metadata .........
Solving package specifications: 
Package plan for installation in environment /home/jlcano/.miniconda36/envs/test_r:

Proceed ([y]/n)? y

#
# To activate this environment, use:
# > source activate test_r
#
# To deactivate this environment, use:
# > source deactivate test_r
#

jlcano@jlcano ~ $ source activate test_r
(test_r) jlcano@jlcano ~ $ conda install -c r r-essentials
Fetching package metadata ...........
Solving package specifications: .

Package plan for installation in environment /home/jlcano/.miniconda36/envs/test_r:

[...]
(test_r) jlcano@jlcano ~ $ which R
/home/jlcano/.miniconda36/envs/test_r/bin/R
(test_r) jlcano@jlcano ~ $ R

R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

[Previously saved workspace restored]

> install.packages("quanteda")
Installing package into ‘/home/jlcano/R/x86_64-pc-linux-gnu-library/3.3’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
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.

This has already been reported in other places:

However, when specifying an R mirror, everything works as expected:

> install.packages("quanteda", repos='http://cran.us.r-project.org')
Installing package into ‘/home/jlcano/R/x86_64-pc-linux-gnu-library/3.3’
(as ‘lib’ is unspecified)
also installing the dependencies ‘slam’, ‘SnowballC’, ‘wordcloud’, ‘proxy’, ‘RcppParallel’, ‘ca’, ‘fastmatch’, ‘RcppArmadillo’

[...]

installing to /home/jlcano/R/x86_64-pc-linux-gnu-library/3.3/quanteda/libs
** R
** data
*** moving datasets to lazyload DB
** demo
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (quanteda)

The downloaded source packages are in
	‘/tmp/Rtmpu1aRJS/downloaded_packages’

I guess I don't need to do anything special with Tcl now but I am not sure.

@astrojuanlu
Copy link
Author

Update: I guess Tcl is required for R to automatically pick a mirror.

(I am new to R)

@astrojuanlu
Copy link
Author

Installing Tcl from conda-forge fixed the issue.

@jjramsey
Copy link

jjramsey commented Jun 7, 2017

Unless there was a change in the Anaconda distribution that fixes this problem, this bug report was closed prematurely. First, installing a third-party package, especially one that replaces functionality in the base Anaconda distribution, is a workaround at best. Second, the proposed solution given appears to have been misstated, since there does not appear to be a "tcl" package in the conda-forge channel. Rather, there are several packages, such as Eumetsat/tcl, intel/tcl, etc., in various repositories.

As one might have guessed, I've stumbled upon the same problem as Juanlu001, but in my case, there already is an installation of Tcl/Tk, from the "tk" package in the regular Anaconda distribution. Also, my environment is a clone of the root environment.

So far, the least worst solution has been to set the environment variable TCL_LIBRARY to the relevant part of the installation of Tcl that I already have, which for me is in "$HOME/.conda/envs/local/lib/tcl8.5".

@davidechicco
Copy link

Hi @Juanlu001 and @jjramsey
I'm having the same problem with R and Anaconda. R has always been working properly on my laptop (Dell Latitude 3540 with a Linux CentOS 7), until the moment I installed Conda.

Since that, R stopped working properly. Now I'm not able to install packages anymore.
I tried to install the clusterSim package (install.packages("clusterSim");), but the R environment says this:

--- 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.

Do you guys have any suggestion on how to solve this problem? Thanks!

@astrojuanlu
Copy link
Author

@davidechicco looks like a problem with your $PATH, probably. Check if $ which R gives an anaconda path or your working R installation.

Other than that, I agree with @jjramsey that this issue deserves more attention.

@davidechicco
Copy link

Hi @Juanlu001
thanks for your help.

I tried to run which R and it returned: ~/miniconda3/bin/R

My original R installation is in /usr/bin/R

This is my current ~/.bashrc file:

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=

# User specific aliases and function

alias sshfs_mordor='./sshfs dchicco@mordor: ~/mordor_home -C -p 10100 -o allow_other'

alias lll='ls -lah'
alias update_upgrade='sudo yum -y update; sudo yum -y upgrade;'

PATH=/home/davide/torch/install/bin/torch-activate:$PATH
PATH=$PATH:/home/davide/bedtools2/bin/
PATH=$PATH:/usr/local/MATLAB/MATLAB_Compiler_Runtime/
PATH=$PATH:/home/davide/bedtools/
PATH=$PATH:/usr/lib64/python3.3/
PATH=$PATH:/usr/lib64/python3.5/

ort LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/runtime/glnxa64:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/sys/os/glnxa64:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/sys/java/jre/glnxa64/jre/lib/amd64/native_threads:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/sys/java/jre/glnxa64/jre/lib/amd64/server:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/sys/java/jre/glnxa64/jre/lib/amd64

export XAPPLRESDIR=/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/X11/app-defaults

export PATH+=:/usr/local/bin
export MCRROOT=/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/


. /home/davide/torch/install/bin/torch-activate

# added by Miniconda3 4.0.5 installer
export PATH="/home/davide/miniconda3/bin:$PATH"


You can see the Miniconda installer at the bottom. What do you suggest me to do? How to edit my bashrc file?

Thanks!

@davidechicco
Copy link

A colleague helped me and told me that the problem is in the PATH: the /usr/bin must be written in the PATH before the miniconda path:

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

Now the system correctly finds the /usr/bin/R by default and the problem is solved!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants