How to install R-packages not in the conda repositories?

joelostblom

I am using Anaconda to manage my R-installation. It works great for packages available in the R-channels provided by Anaconda, but I am having troubles installing packages not contained in the Anaconda repos.

I have tried a few different approaches, all listed below together with their error output.

1. install.packages('rafalib')

Suggested to work here conda - How to install R packages that are not available in "R-essentials"?. My .libPaths() points to '/home/user/anaconda2/lib/R/library'.

Out:

--- Please select a CRAN mirror for use in this session ---
Error in download.file(url, destfile = f, quiet = TRUE) : 
  unsupported URL scheme
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 installed tcl from the conda channel r-old, but install.packages() still threw the same error message.

2. options(menu.graphics=FALSE) and then install.packages('rafalib')

I got a list of mirrors and chose one.

Out:

Selection: 15
trying URL 'http://cran.utstat.utoronto.ca/src/contrib/rafalib_1.0.0.tar.gz'
Content type 'application/x-gzip' length 11798 bytes (11 KB)
==================================================
downloaded 11 KB

sh: symbol lookup error: sh: undefined symbol: rl_signal_event_hook

The downloaded source packages are in
        ‘/tmp/Rtmphwpta0/downloaded_packages’
Warning message:
In install.packages("rafalib") :
  installation of package ‘rafalib’ had non-zero exit status

Both 2 and 3 are from Disable/suppress tcltk popup for CRAN mirror selection in R

3. Setting the mirror in ~/.Rprofile

Before trying install.packages(), I added the following to my ~/.Rprofile.

## Default repo
local({r <- getOption("repos");
       r["CRAN"] <- "http://cran.us.r-project.org"; 
       options(repos=r)})

Out:

trying URL 'http://cran.us.r-project.org/src/contrib/rafalib_1.0.0.tar.gz'
Content type 'application/x-gzip' length 11798 bytes (11 KB)
==================================================
downloaded 11 KB

sh: symbol lookup error: sh: undefined symbol: rl_signal_event_hook

The downloaded source packages are in
        ‘/tmp/RtmppIz9rT/downloaded_packages’
Warning message:
In install.packages("rafalib") :
  installation of package ‘rafalib’ had non-zero exit status

4. Setting the download method to 'curl' or 'wget'.

While keeping the new ~/.Rprofile configuration. I guess this wasn't necessary since the package seems to be downloading fine now, but I tested it just in case.

Out:

sh: symbol lookup error: sh: undefined symbol: rl_signal_event_hook
Warning in download.packages(pkgs, destdir = tmpd, available = available,  :
  download of package ‘rafalib’ failed
Warning message:
In download.file(url, destfile, method, mode = "wb", ...) :
  download had nonzero exit status

5. Manual download of rafalib

install.packages('../Downloads/rafalib_1.0.0.tar.gz', repos=NULL, type='source')

Out:

sh: symbol lookup error: sh: undefined symbol: rl_signal_event_hook
Warning message:
In install.packages("../Downloads/rafalib_1.0.0.tar.gz", repos = NULL,  :
  installation of package ‘../Downloads/rafalib_1.0.0.tar.gz’ had non-zero exit status

6. Building a conda package from rafalib

I opened a separate issue for this Errors building R-packages for conda. In short, it complains about missing dependencies that I already have installed. Update I got a round the dependency problem and I am now stuck at the same rl_signal_event_hook-error as for my other approaches.

7. sudo ln /usr/lib/libncursesw.so.6 /usr/lib/libncursesw.so.5

As per https://github.com/conda/conda/issues/1679, but it didn't fix the issue for me.


So it seems like I can now download the package fine, but installing it fails. I have seen the error message sh: symbol lookup error: sh: undefined symbol: rl_signal_event_hook previously when using R with irkernel in the Jupyter Notebook, but it has never obstructed my work. I have never seen anything relating to that error message when running python through anaconda.

I'm out of ideas. Does anyone know how I can install R-packages not provided by anaconda, such as rafalib or swirl?

I am on Linux (Antergos, an Arch derivative) with kernel 4.4.5-1-ARCH.


UPDATE 2016/04/15

There is some related discussion in this thread. I have tried to get around this error by installing different versions of ncurses, including this patched version, and I have tried to link the readline libraries, as suggested here, but I keep running into the same error. I'm quite lost at this point and any help to solve this would be greatly appreciated.

joelostblom

In the end, I got around the rl_event_hookproblems by following the approach recommended here and symlinking anaconda's libreadline to the system one:

mv ~/anaconda3/lib/libreadline.s.6.2 ~/anaconda3/lib/libreadline.s.6.2.bak
ln -s /usr/lib/libreadline.so.6.3 ~/anaconda3/lib/libreadline.s.6.2

I am still having troubles installing some dependency heavy R-packages due to failure to load shared objects when using install.packages() from withing R. However, simpler packages work fine and I can get most of the dependency heavy packages from anacondas R-repositories.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Repositories of conda recipes and packages

From Dev

R - How to set the path of install.packages() for shiny server ? - Ubuntu

From Dev

r install.packages to install downloaded packages

From Dev

R install packages from Shell

From Dev

How to install PyPi packages using anaconda conda command

From Dev

pip install -r: install only new packages

From Dev

How do I pip install packages in a conda environment.yml file?

From Dev

conda - How to install R packages that are not available in "R-essentials"?

From Dev

Errors building R-packages for conda

From Dev

How to make "conda" installer look for "PyPi" packages

From Dev

Unable to install R packages

From Dev

How to get list of installable packages from repositories?

From Dev

How do you create a script to batch add repositories and then batch install packages?

From Dev

How to install Selenium in a conda environment?

From Dev

Why does conda create try to install weird packages?

From Dev

How can I sort packages by file size when searching the repositories?

From Dev

How do you create a script to batch add repositories and then batch install packages?

From Dev

How to get list of installable packages from repositories?

From Dev

How to install software from 14.10 repositories?

From Dev

Arch Linux: How to ignore certain packages for certain repositories using pacman?

From Dev

How can I use Unstable repositories and install only packages in Testing by default (via AptConf)?

From Dev

Is it possible to configure `brew` to install packages from Debian repositories?

From Dev

How to `conda install ipython`?

From Dev

Unable to install R packages

From Dev

R function to install missing packages

From Dev

How can I make apt install packages of a specific release with just apt update and upgrade when I have repositories from buster and sid?

From Dev

How to install packages for racket?

From Dev

How to install boruta in python using conda install

From Dev

Cannot install packages to R after brew install

Related Related

  1. 1

    Repositories of conda recipes and packages

  2. 2

    R - How to set the path of install.packages() for shiny server ? - Ubuntu

  3. 3

    r install.packages to install downloaded packages

  4. 4

    R install packages from Shell

  5. 5

    How to install PyPi packages using anaconda conda command

  6. 6

    pip install -r: install only new packages

  7. 7

    How do I pip install packages in a conda environment.yml file?

  8. 8

    conda - How to install R packages that are not available in "R-essentials"?

  9. 9

    Errors building R-packages for conda

  10. 10

    How to make "conda" installer look for "PyPi" packages

  11. 11

    Unable to install R packages

  12. 12

    How to get list of installable packages from repositories?

  13. 13

    How do you create a script to batch add repositories and then batch install packages?

  14. 14

    How to install Selenium in a conda environment?

  15. 15

    Why does conda create try to install weird packages?

  16. 16

    How can I sort packages by file size when searching the repositories?

  17. 17

    How do you create a script to batch add repositories and then batch install packages?

  18. 18

    How to get list of installable packages from repositories?

  19. 19

    How to install software from 14.10 repositories?

  20. 20

    Arch Linux: How to ignore certain packages for certain repositories using pacman?

  21. 21

    How can I use Unstable repositories and install only packages in Testing by default (via AptConf)?

  22. 22

    Is it possible to configure `brew` to install packages from Debian repositories?

  23. 23

    How to `conda install ipython`?

  24. 24

    Unable to install R packages

  25. 25

    R function to install missing packages

  26. 26

    How can I make apt install packages of a specific release with just apt update and upgrade when I have repositories from buster and sid?

  27. 27

    How to install packages for racket?

  28. 28

    How to install boruta in python using conda install

  29. 29

    Cannot install packages to R after brew install

HotTag

Archive