I cannot update "rmarkdown" package

I tried to update the "rmarkdown" package, but it failed, and showed:

There is a binary version available but the source version is later:
binary source needs_compilation
rmarkdown 1.13 1.14 FALSE

I thought the old version restricted the updating process, so I clicked the cross on the right side of "rmarkdown" package in the RStudio "Packages" window, then re-do the installation process: install.packages("rmarkdown").

However, after removing the package, the re-installation failed too.

The log is:

Installing package into ‘C:/Users/Harry Lu's X1/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)

There is a binary version available but the source version is later:
binary source needs_compilation
rmarkdown 1.13 1.14 FALSE

installing the source package ‘rmarkdown’

trying URL 'https://cran.rstudio.com/src/contrib/rmarkdown_1.14.tar.gz'
Content type 'application/x-gzip' length 3163022 bytes (3.0 MB)
downloaded 3.0 MB

* installing *source* package 'rmarkdown' ...
** package 'rmarkdown' successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Error: unexpected symbol in "tools:::makeLazyLoading("rmarkdown", "C:/Users/Harry Lu's X1/Documents/R/win-library/3.6/00LOCK-rmarkdown/00new", keep.source = FALSE, keep.parse.data = FALSE, set.install.dir = 'C:/Users/Harr"
Execution halted
ERROR: lazy loading failed for package 'rmarkdown'
* removing 'C:/Users/Harry Lu's X1/Documents/R/win-library/3.6/rmarkdown'
Warning in install.packages :
installation of package ‘rmarkdown’ had non-zero exit status

The downloaded source packages are in
‘C:\Users\Harry Lu's X1\AppData\Local\Temp\RtmpKKU6u3\downloaded_packages’

Note: I have installed the Rtools35 already.

Someone please help! I cannot click the Knit button right now.

1 Like

It's been a while for me with Windows, but you can choose to install binary version, right? If it fails to compile for whatever reason, this might be a solution for now. In near future CRAN will update and binary for new version of rmarkdown will become available.

Also, maybe try updating Rtools to 3.6?

1 Like

The problem is that the compiler is having problems with the empty space in your Windows user name, one walk-around solution would be to install in the global library instead of per user, with something like this:

install.packages("rmarkdown", lib = "C:/Program Files/R/R-3.6.1/library")
1 Like

I tried the code your shared, but it did not work. It showed:

Warning in install.packages :
'lib = "C:/Program Files/R/R-3.6.1/library"' is not writable

and popped a window to ask "Would you like to use a personal library instead?"

If yes, it gave the same error message that stopped at the spaced directory.

If no, it gave:

Error in install.packages : unable to install packages

Could you please give more details about how to install the binary version? I have no clue on that.

Thanks a lot

1 Like

I gave you that as an example, you have to modify accordingly to your R version, are you also using R 3.6.1 version? Also, you have to run rstudio as administrator to have write permissions in that folder

2 Likes

I tried install_version("rmarkdown",version = "1.13")

However, it gave:

Downloading package from url: https://cran.rstudio.com//src/contrib/Archive/rmarkdown/rmarkdown_1.13.tar.gz
Installing package into ‘C:/Users/Harry Lu's X1/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
* installing *source* package 'rmarkdown' ...
** package 'rmarkdown' successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Error: unexpected symbol in "tools:::makeLazyLoading("rmarkdown", "C:/Users/Harry Lu's X1/Documents/R/win-library/3.6/00LOCK-rmarkdown/00new", keep.source = FALSE, keep.parse.data = FALSE, set.install.dir = 'C:/Users/Harr"
Execution halted
ERROR: lazy loading failed for package 'rmarkdown'
* removing 'C:/Users/Harry Lu's X1/Documents/R/win-library/3.6/rmarkdown'
Error: Failed to install 'unknown package' from URL:
(converted from warning) installation of package ‘C:/Users/HARRYL~1/AppData/Local/Temp/RtmpIhVCJe/remotes33a05e093dc6/rmarkdown’ had non-zero exit status

Thank you so much! It worked! I installed the package into the System Library.

@Harry.L To avoid problems like this in the future, you can have R always install the latest binary version by setting options(pkgType = "binary"). This might install a slightly older version, but the CRAN servers are pretty good about building a Windows binary within a week or so of a new package release.

To make this your default behavior every time you start R, you can add it to your .Rprofile. The line below does this:

cat("options(pkgType = 'binary')", file = "~/.Rprofile", sep = "\n", append = TRUE)
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.