Unable to open new R Markdown document in Rstudio

I'm trying to open a new R Markdown document in the RStudio IDE, but it keeps giving me the following message: "Creating R Markdown documents requires updated versions of the following packages: htmltools, rmarkdown. Do you want to install these packages now?"

I've clicked yes, the installations apparently didn't work correctly, and no .RMD file opens. I've tried multiple times and I still get the same message. Below is the output.

** Installing R Package Dependencies for R Markdown: 'htmltools', 'rmarkdown'
[1/4] Installing htmltools...
Installing package into ‘/home/fgootkind/R/x86_64-pc-linux-gnu-library/4.2’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/htmltools_0.5.4.tar.gz'
Content type 'application/x-gzip' length 131047 bytes (127 KB)
==================================================
downloaded 127 KB

gcc -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-a3XuZ5/r-base-4.2.2.20221110=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c init.c -o init.o
* installing *source* package ‘htmltools’ ...
** package ‘htmltools’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-a3XuZ5/r-base-4.2.2.20221110=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c template.c -o template.o
gcc -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o htmltools.so init.o template.o -L/usr/lib/R/lib -lR
installing to /home/fgootkind/R/x86_64-pc-linux-gnu-library/4.2/00LOCK-htmltools/00new/htmltools/libs
** R
** inst
** byte-compile and prepare package for lazy loading
Error: package ‘digest’ was installed before R 4.0.0: please re-install it
Execution halted
[2/4] Installing bslib...
ERROR: lazy loading failed for package ‘htmltools’
* removing ‘/home/fgootkind/R/x86_64-pc-linux-gnu-library/4.2/htmltools’

The downloaded source packages are in
	‘/tmp/RtmpgS2enz/downloaded_packages’
Installing package into ‘/home/fgootkind/R/x86_64-pc-linux-gnu-library/4.2’
(as ‘lib’ is unspecified)
also installing the dependencies ‘htmltools’, ‘sass’, ‘jquerylib’

trying URL 'https://cloud.r-project.org/src/contrib/htmltools_0.5.4.tar.gz'
Content type 'application/x-gzip' length 131047 bytes (127 KB)
==================================================
downloaded 127 KB

trying URL 'https://cloud.r-project.org/src/contrib/sass_0.4.4.tar.gz'
Content type 'application/x-gzip' length 3024862 bytes (2.9 MB)
==================================================
downloaded 2.9 MB

trying URL 'https://cloud.r-project.org/src/contrib/jquerylib_0.1.4.tar.gz'
Content type 'application/x-gzip' length 520207 bytes (508 KB)
==================================================
downloaded 508 KB

trying URL 'https://cloud.r-project.org/src/contrib/bslib_0.4.2.tar.gz'
Content type 'application/x-gzip' length 4830133 bytes (4.6 MB)
==================================================
downloaded 4.6 MB

gcc -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-a3XuZ5/r-base-4.2.2.20221110=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c init.c -o init.o
* installing *source* package ‘htmltools’ ...
** package ‘htmltools’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-a3XuZ5/r-base-4.2.2.20221110=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c template.c -o template.o
gcc -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o htmltools.so init.o template.o -L/usr/lib/R/lib -lR
installing to /home/fgootkind/R/x86_64-pc-linux-gnu-library/4.2/00LOCK-htmltools/00new/htmltools/libs
** R
** inst
** byte-compile and prepare package for lazy loading
Error: package ‘digest’ was installed before R 4.0.0: please re-install it
Execution halted
ERROR: lazy loading failed for package ‘htmltools’
* removing ‘/home/fgootkind/R/x86_64-pc-linux-gnu-library/4.2/htmltools’
ERROR: dependency ‘htmltools’ is not available for package ‘sass’
* removing ‘/home/fgootkind/R/x86_64-pc-linux-gnu-library/4.2/sass’
ERROR: dependency ‘htmltools’ is not available for package ‘jquerylib’
* removing ‘/home/fgootkind/R/x86_64-pc-linux-gnu-library/4.2/jquerylib’
[3/4] Installing jquerylib...
ERROR: dependencies ‘htmltools’, ‘sass’, ‘jquerylib’ are not available for package ‘bslib’
* removing ‘/home/fgootkind/R/x86_64-pc-linux-gnu-library/4.2/bslib’

The downloaded source packages are in
	‘/tmp/RtmpgS2enz/downloaded_packages’
Installing package into ‘/home/fgootkind/R/x86_64-pc-linux-gnu-library/4.2’
(as ‘lib’ is unspecified)
also installing the dependency ‘htmltools’

trying URL 'https://cloud.r-project.org/src/contrib/htmltools_0.5.4.tar.gz'
Content type 'application/x-gzip' length 131047 bytes (127 KB)
==================================================
downloaded 127 KB

trying URL 'https://cloud.r-project.org/src/contrib/jquerylib_0.1.4.tar.gz'
Content type 'application/x-gzip' length 520207 bytes (508 KB)
==================================================
downloaded 508 KB

* installing *source* package ‘htmltools’ ...
** package ‘htmltools’ successfully unpacked and MD5 sums checked
** using staged installation
gcc -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-a3XuZ5/r-base-4.2.2.20221110=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c init.c -o init.o
** libs
gcc -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-a3XuZ5/r-base-4.2.2.20221110=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c template.c -o template.o
gcc -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o htmltools.so init.o template.o -L/usr/lib/R/lib -lR
installing to /home/fgootkind/R/x86_64-pc-linux-gnu-library/4.2/00LOCK-htmltools/00new/htmltools/libs
** R
** inst
** byte-compile and prepare package for lazy loading
Error: package ‘digest’ was installed before R 4.0.0: please re-install it
Execution halted
ERROR: lazy loading failed for package ‘htmltools’
* removing ‘/home/fgootkind/R/x86_64-pc-linux-gnu-library/4.2/htmltools’
[4/4] Installing rmarkdown...
ERROR: dependency ‘htmltools’ is not available for package ‘jquerylib’
* removing ‘/home/fgootkind/R/x86_64-pc-linux-gnu-library/4.2/jquerylib’

The downloaded source packages are in
	‘/tmp/RtmpgS2enz/downloaded_packages’
Installing package into ‘/home/fgootkind/R/x86_64-pc-linux-gnu-library/4.2’
(as ‘lib’ is unspecified)
also installing the dependencies ‘sass’, ‘bslib’, ‘htmltools’, ‘jquerylib’

trying URL 'https://cloud.r-project.org/src/contrib/sass_0.4.4.tar.gz'
Content type 'application/x-gzip' length 3024862 bytes (2.9 MB)
==================================================
downloaded 2.9 MB

trying URL 'https://cloud.r-project.org/src/contrib/bslib_0.4.2.tar.gz'
Content type 'application/x-gzip' length 4830133 bytes (4.6 MB)
==================================================
downloaded 4.6 MB

trying URL 'https://cloud.r-project.org/src/contrib/htmltools_0.5.4.tar.gz'
Content type 'application/x-gzip' length 131047 bytes (127 KB)
==================================================
downloaded 127 KB

trying URL 'https://cloud.r-project.org/src/contrib/jquerylib_0.1.4.tar.gz'
Content type 'application/x-gzip' length 520207 bytes (508 KB)
==================================================
downloaded 508 KB

trying URL 'https://cloud.r-project.org/src/contrib/rmarkdown_2.19.tar.gz'
Content type 'application/x-gzip' length 3243575 bytes (3.1 MB)
==================================================
downloaded 3.1 MB

* installing *source* package ‘htmltools’ ...
** package ‘htmltools’ successfully unpacked and MD5 sums checked
** using staged installation
gcc -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-a3XuZ5/r-base-4.2.2.20221110=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c init.c -o init.o
** libs
gcc -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-a3XuZ5/r-base-4.2.2.20221110=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c template.c -o template.o
gcc -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o htmltools.so init.o template.o -L/usr/lib/R/lib -lR
installing to /home/fgootkind/R/x86_64-pc-linux-gnu-library/4.2/00LOCK-htmltools/00new/htmltools/libs
** R
** inst
** byte-compile and prepare package for lazy loading
Error: package ‘digest’ was installed before R 4.0.0: please re-install it
Execution halted
ERROR: lazy loading failed for package ‘htmltools’
* removing ‘/home/fgootkind/R/x86_64-pc-linux-gnu-library/4.2/htmltools’
ERROR: dependency ‘htmltools’ is not available for package ‘sass’
* removing ‘/home/fgootkind/R/x86_64-pc-linux-gnu-library/4.2/sass’
ERROR: dependency ‘htmltools’ is not available for package ‘jquerylib’
* removing ‘/home/fgootkind/R/x86_64-pc-linux-gnu-library/4.2/jquerylib’
ERROR: dependencies ‘htmltools’, ‘sass’, ‘jquerylib’ are not available for package ‘bslib’
* removing ‘/home/fgootkind/R/x86_64-pc-linux-gnu-library/4.2/bslib’
ERROR: dependencies ‘bslib’, ‘htmltools’, ‘jquerylib’ are not available for package ‘rmarkdown’
* removing ‘/home/fgootkind/R/x86_64-pc-linux-gnu-library/4.2/rmarkdown’

The downloaded source packages are in
	‘/tmp/RtmpgS2enz/downloaded_packages’


✔ Packages successfully installed.
There were 12 warnings (use warnings() to see them)

You have updated your R version but not your package library, it seems several packages in your library are compiled for 4.0.0. To reinstall those run this command.

update.packages(checkBuilt = TRUE)

If you have a site-library you might need to run this as a super user.

You opted for the "later source version," it looks like. There's seldom a need to do that and it introduces additional opportunity for trouble. The binary version will have necessarily sorted the compile time dependencies. Try that.

The OP is on Linux and downloading from a CRAN mirror, "source" is the only option in that scenario.

@fgootkind, be aware there are other package repository alternatives that provide precompiled binaries for some Linux distributions. I'm aware of two mainstream options, the public Posit Package Manager and r2u (for the last two Ubuntu LTS releases only) and one option for ARM architectures, the R4Pi Project (currently only for Raspberry Pi OS).

Even if you decide to try with one of these, you would still need to reinstall your R packages compiled for an older R version.

2 Likes

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.