user61146
user61146

Reputation: 11

R Notebook Creation Failed

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?

Upvotes: 1

Views: 10262

Answers (7)

Raf
Raf

Reputation: 1757

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.

Upvotes: 1

Yehudit Hasin
Yehudit Hasin

Reputation: 21

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.

Upvotes: 1

love2d--
love2d--

Reputation: 11

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

Upvotes: 1

Kate Amon
Kate Amon

Reputation: 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!

Upvotes: -1

Saurabh Jain
Saurabh Jain

Reputation: 1712

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.

Upvotes: 0

IRTFM
IRTFM

Reputation: 263332

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

Upvotes: 3

user61146
user61146

Reputation: 11

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.

Upvotes: -1

Related Questions