4

I have always work with R in RStudio and never had problem to install packages. I have recently installed Anaconda to use Jupyter Notebook for a collaborative project. However, when using R in Jupyter notebook, I am unable to install packages other then those in r-essentials. The problem seems to come from the R installed by Anaconda. When I try

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

in its R console, I receive the following error

Warning: unable to access index for repository http://cran.us.r-project.org/src/
contrib:
  internet routines cannot be loaded
Warning message:
package ‘cubature’ is not available (for R version 3.4.1) 

Following this post, I tried to "add new package to the correct R library used by Jupyter", but I receive the same error. I tried to install the package from Github, but I needed devtools, which is not in r-essentials and needs therefore to be installed to. I also tried to import R package with rpy2 as suggested in this post, but the kernel simply died.

I still don't have anyway problem installing package with RStudio though. My (problematic) R version is

>R.Version()
$platform
[1] "x86_64-apple-darwin13.4.0"
$arch
[1] "x86_64"
$os
[1] "darwin13.4.0"
$system
[1] "x86_64, darwin13.4.0"
$status
[1] ""
$major
[1] "3"
$minor
[1] "4.1"
$year
[1] "2017"
$month
[1] "06"
$day
[1] "30"
$`svn rev`
[1] "72865"
$language
[1] "R"
$version.string
[1] "R version 3.4.1 (2017-06-30)"
$nickname
[1] "Single Candle"

Any suggestions? Thx for your help!

  • 1
    Where did you get the "cran.us.r-project.org" URL from? is there a reason you are using that particular repo? And it's odd the error message is missing the "-" in the URL. Maybe a typo? – MrFlick Sep 18 '17 at 19:00
  • I got if from this [post](https://stackoverflow.com/questions/34705917/conda-how-to-install-r-packages-that-are-not-available-in-r-essentials). In fact, I tried many other URL, but it did not seem to help. And yes, the "-" was a typo. My (edited) mistake. – Nicolas Corneau Sep 18 '17 at 20:34
  • If you try other URLs do you still get the exact same error message: "internet routines cannot be loaded"? How exactly did you install R in the first place? – MrFlick Sep 18 '17 at 20:37
  • 1
    Yep, exactly the same error message with others URL, like for example `install.packages("cubature", repos = 'http://cran.uk.r-project.org')`. R is installed with Anaconda when you install it. I tried to uninstall and reinstall Anaconda, but nothing changes. – Nicolas Corneau Sep 18 '17 at 21:09
  • 1
    I couldn't replicate your problem. If you are on a Mac/Linux, could you run `which r` to confirm which distribution of R you are running in the console. Also you could try to reinstall r with `conda install -f r-essentials` and see what happens. – uut Sep 19 '17 at 05:28
  • Still the same error message after `conda install -f r-essentials`. With `which r` I get `/Users/nicot/anaconda/bin/r`. – Nicolas Corneau Sep 19 '17 at 12:17
  • I uninstalled completely Anaconda and run `which r` and got `/usr/local/bin/r`. After reinstalling Anaconda 4.4.0 for Python 3 from [here](https://www.anaconda.com/download/#download), I still have the same error message and `which r` give me `/Users/nicot/anaconda/bin/r` back again. – Nicolas Corneau Sep 19 '17 at 12:33
  • Ok, I uninstalled Ananconda, RStudio and R. I then reinstalled *only* Anaconda for Python 3.4 from [here](https://www.anaconda.com/download/#download) and I run `conda install r-essentials` as suggested [here](https://conda.io/docs/user-guide/tasks/use-r-with-conda.html). Same error message `Installing package into ‘/Users/nicot/Library/R/3.4/library’ (as ‘lib’ is unspecified) Warning message: “unable to access index for repository https://cran.r-project.org/src/contrib: internet routines cannot be loaded”Warning message: “package ‘cubature’ is not available (for R version 3.4.1)”` – Nicolas Corneau Sep 19 '17 at 16:24

1 Answers1

0

You can update r packages within RStudio via the Packages tab in the bottom-right (next to Files, Plots, etc.). Rstudio screenshot

Samsul Islam
  • 2,581
  • 2
  • 17
  • 23
mr_bdbt
  • 1
  • 2