0

I'm currently using Jupyter Notebook to do some R work (since it can do markdown at the same time.).

However when I try to install a package fGarch, I encountered this problem.

> install.packages('fGarch')
Warning message in install.packages("fGarch"):
 “installation of package ‘fGarch’ had non-zero exit status ”Updating HTML index of packages in '.Library'
Making 'packages.html' ... done

and when I load it by

> library('fGarch')
Error in library("fGarch"): there is no package called ‘fGarch’
Traceback:
  1. library("fGarch")
  2. stop(txt, domain = NA)

i.e., it didn't install it at the first place. I googled, but all methods mentioned did not work for me, including methods provided in: 'How to install R packages that are not available in “R-essentials”?' For example, I tried to use RStudio to install this package into the directory for Jupyter notebook, but I got a error saying that the directory is not writable(even if I opened RStudio by sudo command, I'm a Mac user so I can not really right click to open an app as admin). I even tried to copy and paste the library from RStudio directory into Jupyter Notebook one, but still, this not working.

Can anyone help me install packages for R in Jupyter notebook that are not 'R-essentials' ?

alistaire
  • 42,459
  • 4
  • 77
  • 117
  • Did you install R with conda? (That's a bad idea.) And you shouldn't be installing packages to particular directories unless you're messing with `.libPaths()` deliberately for some reason (which I don't recommend). Unless you mainly use Python and only occasionally dip into R, you may find [R notebooks](https://bookdown.org/yihui/rmarkdown/notebook.html), which work well in RStudio, are a lot simpler, as they're plaintext. – alistaire Jan 21 '19 at 23:38
  • You cannot load packages when they were not installed correctly. The initial warning doesn't help me very much. I note that yoiu failed to include the parameter `dependencies=TRUE` and "fGarch" has several. – IRTFM Jan 22 '19 at 01:04
  • @alistaire Yep, I'm using the R notebook in RStudio now, it works just fine, thank you so much! – David Xie Jan 23 '19 at 16:41
  • @42 Your are right, I shouldn't mess up with those packages. But there do exists problem when you install these R packages in Jupyter notebook, if you do it the same way you do in RStudio. I tried to include the parameter you mentioned, but still... Thanks for your help indeed, and like alistaire said, I'm using R notebook new so that I don't need to mess up with all these packages. – David Xie Jan 23 '19 at 16:41

0 Answers0