title: How to install R-packages not in the conda repositories?
body: <p>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.</p>
  
  <p>I have tried a few different approaches, all listed below together with their error output.</p>
  
  <h3>1. <code>install.packages('rafalib')</code></h3>
  
  <p>Suggested to work here <a href="https://stackoverflow.com/questions/34705917/conda-how-to-install-r-packages-that-are-not-available-in-r-essentials">conda - How to install R packages that are not available in &quot;R-essentials&quot;?</a>. My <code>.libPaths()</code> points to <code>'/home/user/anaconda2/lib/R/library'</code>.</p>
  
  <p>Out:</p>
  
  <pre><code>--- 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.
  </code></pre>
  
  <p>I installed <code>tcl</code> from the conda channel <code>r-old</code>, but <code>install.packages()</code> still threw the same error message.</p>
  
  <h3>2. <code>options(menu.graphics=FALSE)</code> and then <code>install.packages('rafalib')</code></h3>
  
  <p>I got a list of mirrors and chose one.</p>
  
  <p>Out:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>Both 2 and 3 are from <a href="https://stackoverflow.com/questions/7430452/disable-suppress-tcltk-popup-for-cran-mirror-selection-in-r">Disable/suppress tcltk popup for CRAN mirror selection in R</a></p>
  
  <h3>3. Setting the mirror in <code>~/.Rprofile</code></h3>
  
  <p>Before trying <code>install.packages()</code>, I added the following to my <code>~/.Rprofile</code>.</p>
  
  <pre><code>## Default repo
  local({r &lt;- getOption("repos");
         r["CRAN"] &lt;- "http://cran.us.r-project.org"; 
         options(repos=r)})
  </code></pre>
  
  <p>Out:</p>
  
  <pre><code>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
  </code></pre>
  
  <h3>4. Setting the download method to 'curl' or 'wget'.</h3>
  
  <p>While keeping the new <code>~/.Rprofile configuration</code>. I guess this wasn't necessary since the package seems to be downloading fine now, but I tested it just in case.</p>
  
  <p>Out:</p>
  
  <pre><code>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
  </code></pre>
  
  <h3>5. Manual <a href="https://cran.r-project.org/web/packages/rafalib/index.html" rel="noreferrer">download of rafalib</a></h3>
  
  <p><code>install.packages('../Downloads/rafalib_1.0.0.tar.gz', repos=NULL, type='source')</code></p>
  
  <p>Out:</p>
  
  <pre><code>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
  </code></pre>
  
  <h3>6. Building a conda package from <code>rafalib</code></h3>
  
  <p>I opened a separate issue for this <a href="https://stackoverflow.com/questions/36651189/errors-building-r-packages-for-conda">Errors building R-packages for conda</a>. In short, it complains about missing dependencies that I already have installed. <strong>Update</strong> I got a round the dependency problem and I am now stuck at the same <code>rl_signal_event_hook</code>-error as for my other approaches.</p>
  
  <h3>7. <code>sudo ln /usr/lib/libncursesw.so.6 /usr/lib/libncursesw.so.5</code></h3>
  
  <p>As per <a href="https://github.com/conda/conda/issues/1679" rel="noreferrer">https://github.com/conda/conda/issues/1679</a>, but it didn't fix the issue for me.</p>
  
  <hr>
  
  <p>So it seems like I can now download the package fine, but installing it fails. I have seen the error message <code>sh: symbol lookup error: sh: undefined symbol: rl_signal_event_hook</code> previously when using R with <code>irkernel</code> in the <code>Jupyter Notebook</code>, but it has never obstructed my work. I have never seen anything relating to that error message when running python through anaconda.</p>
  
  <p>I'm out of ideas. Does anyone know how I can install R-packages not provided by anaconda, such as <code>rafalib</code> or <code>swirl</code>?</p>
  
  <p>I am on Linux (Antergos, an Arch derivative) with kernel 4.4.5-1-ARCH.</p>
  
  <hr>
  
  <p><strong>UPDATE 2016/04/15</strong></p>
  
  <p>There is some <a href="https://github.com/ContinuumIO/anaconda-issues/issues/455" rel="noreferrer">related discussion in this thread</a>. I have tried to get around this error by installing different versions of ncurses, including <a href="https://github.com/MaxNoe/conda-recipes" rel="noreferrer">this patched version</a>, and I have tried to link the readline libraries, <a href="https://github.com/conda/conda/issues/1679" rel="noreferrer">as suggested here</a>, 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.</p>