1

Update: Okay, I got it running now. I hadnt set up the path for Rtools. It still didnt work after doing that. Then I updated my R version, after which R was able to download and install the required packages automatically. Thanks for the help!

I need to run R markdown to hand in some code for an assignment and cant even open a new R markdown file. When I click on opening a new file, R asks me:

"Creating R Markdown documents requires updated versions of the following packages: rmarkdown, tinytex. Do you want to install these packages now"

When I click yes, R starts doing some stuff in the console and then I get an error message.

I alrady tried installing Rtools and the packages xfun, digest, tinytex and rmarkdown manually, which doesnt help either. I still get the error message. Re-starting R and uninstalling didnt help either, so I´m kind of stuck here.

Anyone knows how to get this running?

The output in the console I get when clicking on yes is:

** Installing R Package Dependencies for R Markdown: 'rmarkdown', 'tinytex'



[1/2] Installing tinytex...

also installing the dependency 'xfun'


  There are binary versions available but the source versions are later:
        binary source needs_compilation
xfun      0.22   0.28              TRUE
tinytex   0.31   0.35             FALSE

  Binaries will be installed
versuche URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/xfun_0.22.zip'
Content type 'application/zip' length 323923 bytes (316 KB)
===============================================package 'xfun' successfully unpacked and MD5 sums checked
===
downloaded 316 KB


The downloaded binary packages are in
    C:\Users\Uni\AppData\Local\Temp\RtmpA3XedU\downloaded_packages
installing the source package 'tinytex'

versuche URL 'https://cran.rstudio.com/src/contrib/tinytex_0.35.tar.gz'
Content type 'application/x-gzip' length 30624 bytes (29 KB)
==================================================
downloaded 29 KB

* installing *source* package 'tinytex' ...
** Paket 'tinytex' erfolgreich entpackt und MD5 Summen �berpr�ft
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Fehler in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
  namespace 'xfun' 0.22 is being loaded, but >= 0.23 is required
Ruft auf: <Anonymous> ... namespaceImportFrom -> asNamespace -> loadNamespace
Ausf�hrung angehalten


[2/2] Installing rmarkdown...

ERROR: lazy loading failed for package 'tinytex'
* removing 'D:/R-3.6.0/library/tinytex'

The downloaded source packages are in
    'C:\Users\Uni\AppData\Local\Temp\RtmpA3XedU\downloaded_packages'
also installing the dependencies 'xfun', 'tinytex'

versuche URL 'https://cran.rstudio.com/src/contrib/xfun_0.28.tar.gz'
Content type 'application/x-gzip' length 119800 bytes (116 KB)
==================================================
downloaded 116 KB

versuche URL 'https://cran.rstudio.com/src/contrib/tinytex_0.35.tar.gz'
Content type 'application/x-gzip' length 30624 bytes (29 KB)
==================================================
downloaded 29 KB

versuche URL 'https://cran.rstudio.com/src/contrib/rmarkdown_2.11.tar.gz'
Content type 'application/x-gzip' length 3212367 bytes (3.1 MB)
==================================================
downloaded 3.1 MB

* installing *source* package 'xfun' ...
** Paket 'xfun' erfolgreich entpackt und MD5 Summen �berpr�ft
** using staged installation
** libs

*** arch - i386
Warnung in system(cmd) 'make' not found
ERROR: compilation failed for package 'xfun'
* removing 'D:/R-3.6.0/library/xfun'
* restoring previous 'D:/R-3.6.0/library/xfun'
* installing *source* package 'tinytex' ...
** Paket 'tinytex' erfolgreich entpackt und MD5 Summen �berpr�ft
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Fehler in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
  namespace 'xfun' 0.22 is being loaded, but >= 0.23 is required
Ruft auf: <Anonymous> ... namespaceImportFrom -> asNamespace -> loadNamespace
Ausf�hrung angehalten
ERROR: lazy loading failed for package 'tinytex'
* removing 'D:/R-3.6.0/library/tinytex'
ERROR: dependency 'tinytex' is not available for package 'rmarkdown'
* removing 'D:/R-3.6.0/library/rmarkdown'

The downloaded source packages are in
    'C:\Users\Uni\AppData\Local\Temp\RtmpA3XedU\downloaded_packages'


<U+2714> Packages successfully installed.
Warnmeldungen:
1: In utils::install.packages("tinytex", repos = "https://cran.rstudio.com/") :
  installation of package 'tinytex' had non-zero exit status
2: In utils::install.packages("rmarkdown", repos = "https://cran.rstudio.com/",  :
  installation of package 'xfun' had non-zero exit status
3: In utils::install.packages("rmarkdown", repos = "https://cran.rstudio.com/",  :
  installation of package 'tinytex' had non-zero exit status
4: In utils::install.packages("rmarkdown", repos = "https://cran.rstudio.com/",  :
  installation of package 'rmarkdown' had non-zero exit status
  • 2
    What is the result of calling, `Sys.which("make")`? When you installed Rtools, did you add the path to your environment? See section "Putting Rtools on the PATH" at [this link](https://cran.r-project.org/bin/windows/Rtools/). Also, please post your `sessionInfo()` – Jessica Burnett Nov 24 '21 at 20:28
  • Remove all traces of the tinytex - > install TexLive https://tug.org/texlive/ and after rmarkdown – manro Nov 24 '21 at 20:48
  • Okay, I got it running now. I hadnt set up the path for Rtools. It still didnt work after doing that. Then I updated my R version, after which R was able to download and install the required packages automatically. Thanks for the help! – this_is_not_easy Nov 26 '21 at 08:19

1 Answers1

0

You should check carefully the following messages

  There are binary versions available but the source versions are later:
        binary source needs_compilation
xfun      0.22   0.28              TRUE
Fehler in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
  namespace 'xfun' 0.22 is being loaded, but >= 0.23 is required

R is not installing 'xfun' probably because it needs compilation. Your problem is similar to this.

I suggest you check the documentation of install.packages. Specially here

"Using packages with type = "source" always works provided the package contains no C/C++/Fortran code that needs compilation. Otherwise, on Windows you will need to have installed the Rtools collection as described in the ‘R for Windows FAQ’ and you must have the PATH environment variable set up as required by Rtools."

And here:

"When installing a binary package, install.packages will abort the install if it detects that the package is already installed and is currently in use."

Thus, you can try this before checking that Rtools is updated and you haven't load the package in your session:

install.packages("xfun", type = "source)

I highly recommend that you also upgrade your R-version before update the packages.

Jose
  • 421
  • 3
  • 10