1

When I go File-New File-R Notebook, it tells me to install some packages, but then it fails giving me this message:

Notebook Creation Failed: "One of more packages required for R Notebook creation were not installed"

I'm trying to install those packages manually, but the package installation window disappears so quickly that I can't even see which ones I should install.

I googled it around, but couldn't fine any resource. Can anyone help me with this? Maybe at least provide a list of packages required to run R Notebook?

IRTFM
  • 258,963
  • 21
  • 364
  • 487
user61146
  • 11
  • 1
  • 3
  • have you tried to install the packages by typing `install.packages('packagename')` in the console? – loki Jan 27 '17 at 19:18

7 Answers7

3

R notebooks are actually not created with a package named either RNotebook or notebook or anything similar but rather with the rmarkdown package, and it needs to be a current version. So the command would be:

install.packages("rmarkdown", dependencies=TRUE)   # needs to be >= version 1.3

Then your pulldown menu selections should succeed in a current version of RStudio. .... at least that is if you have the system requirements listed in the CRAN webpage:

SystemRequirements: pandoc (>= 1.12.3) - http://pandoc.org
IRTFM
  • 258,963
  • 21
  • 364
  • 487
1

This worked for me:

  • Install latest version of R from cran website
  • Start RStudio pointing to this version of R.
  • On Mac set env variable as show below and start RStudio from terminal
  • Then "Install Package" in RStudio for "markdown" and other ppackages will work properly installing latest required packages to open notebook
➜  export RSTUDIO_WHICH_R=/usr/local/bin/R
tomerpacific
  • 4,704
  • 13
  • 34
  • 52
love2d--
  • 11
  • 1
1

Don't press the error message, and read whatever you can from the installation popup under it. In my case the last message was that it has problems compiling "digest". I installed "digest" manually (install.packages("digest",type = "binary")). Then it all worked. Mac, R version 3.6, Rstudio desktop 1.2.

alexherm
  • 1,362
  • 2
  • 18
  • 31
1

I had exactly the same problem. By reading the error logs, I found g++ command not found. So just installed it and it worked fine next time I've tried.

Raf
  • 1,628
  • 3
  • 21
  • 40
  • Indeed; in the "R Markdown" tab (near where your terminal is), you might see a message about missing packages or packages that need to be updated. Attend to these and try again. – Nova Feb 24 '21 at 19:47
0

I faced the same problem. I am using the latest version of R and RStudio and all of the installed packages are up-to-date.

Now, talking about the error in installation of packages. Follow the steps below and you will have R Notebook up and running:

  1. Run the command

install.packages("rmarkdown", dependencies=TRUE)

You will observe several messages on the console during installation. Browse through them and jot the ones where there is ERROR in installation of some other dependent package. In my case, it was 'backports'. The error message will be like this:

ERROR: compilation failed for package 'backports'

It can be different in your case but the point is to note down the name of the package that is facing compilation issues. Use an editor(npp) to save the name of the package.

  1. Once you get the name of the package, execute the following command:

install.packages("backports", type="binary")

  1. After successful execution of the above command, go to File drop down and select R Markdown. Go with auto installation of the rmarkdown and rprojroot packages. They will be successfully installed and you can now use R Notebook

Let us know if this solution worked for you.

Saurabh Jain
  • 1,600
  • 1
  • 20
  • 30
-1

I just found the answer myself so I'm posting. I guess there was something wrong with the server. I went into tools-global options-packages and chose different CRAN mirror, then it worked.

user61146
  • 11
  • 1
  • 3
  • This is not really an answer, since it shows nothing that is likely to work when the system requirements and necessary packages are missing. – IRTFM Jan 27 '17 at 19:42
-1

UPDATE YOUR VERSION OF R - that was my solution, I had the same problem.

( First two commands ensure you get the MOST RECENT version of R which I found on a Digital Ocean page)

$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
$ sudo add-apt-repository 'deb [arch=amd64,i386] https://cran.rstudio.com/bin/linux/ubuntu xenial/'

$ sudo apt-get update
$ sudo apt-get install r-base

WITHOUT the first two lines I ended up with R version 3.2.3 (2015-12-10) -- "Wooden Christmas-Tree"

WITH the first two lines I got R version 3.4.4 (2018-03-15) -- "Someone to Lean On"

After reinstalling R Studio, the Files -> RMarkdown was able to install all those subpackages and WORK. Hurray!

Kate Amon
  • 1
  • 1