rmarkdown
rmarkdown copied to clipboard
Could not find data file templates / pandoc document conversion failed with error 97
I recently have problems rendering a blastula email which I used to render weekly without problems. It might be caused by having switched from R 4.1.3 to R 4.2.1. I made sure all packages are up-to-date and also tried using the latest rmarkdown
version from github but this did not solve the issue.
Knitting the document leads to an error like this:
"C:/Program Files/RStudio/bin/quarto/bin/tools/pandoc" +RTS -K512m -RTS test.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output test.html --lua-filter "Z:\J6QBFO~T\renv\library\R-4.2\X4WA3Z~2\R3QO3L~A\R3QO3L~A\lua\PFI4N5~T.LUA" --lua-filter "Z:\J6QBFO~T\renv\library\R-4.2\X4WA3Z~2\R3QO3L~A\R3QO3L~A\lua\LO5GZZ~1.LUA" --self-contained --variable bs3=TRUE --standalone --section-divs --template "Z:\J6QBFO~T\renv\library\R-4.2\X4WA3Z~2\R3QO3L~A\rmd\h\D0CS9J~9" --no-highlight --variable highlightjs=1 --variable theme=bootstrap --mathjax --variable "mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" --include-in-header "C:\Users\<MyUser>AppData\Local\Temp\Rtmpuo3BQA\rmarkdown-str39c2dab6184.html"
Could not find data file templates\D0CS9J~9.html4
Error: pandoc document conversion failed with error 97
Execution halted
The error can also be reproduced using a minimal Rmd-file like this:
---
title: "Test Report"
author: Me Myself
data: "2022-07-26"
output: html_document
---
Test
Session Info:
R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)
Matrix products: default
locale:
[1] LC_COLLATE=German_Germany.utf8 LC_CTYPE=German_Germany.utf8 LC_MONETARY=German_Germany.utf8 LC_NUMERIC=C LC_TIME=German_Germany.utf8
attached base packages:
[1] stats graphics grDevices datasets utils methods base
other attached packages:
[1] tidyquant_1.0.4 quantmod_0.4.20 TTR_0.24.3 PerformanceAnalytics_2.0.4 xts_0.12.1 zoo_1.8-10
[7] glue_1.6.2 lubridate_1.8.0 forcats_0.5.1 stringr_1.4.0 purrr_0.3.4 readr_2.1.2
[13] tidyr_1.2.0 tibble_3.1.8 ggplot2_3.3.6 tidyverse_1.3.2 here_1.0.1 rmarkdown_2.14.3
[19] blastula_0.3.2 dplyr_1.0.9
loaded via a namespace (and not attached):
[1] fs_1.5.2 usethis_2.1.6 devtools_2.4.4 httr_1.4.3 rprojroot_2.0.3 tools_4.2.1 profvis_0.3.7 backports_1.4.1
[9] bslib_0.4.0 utf8_1.2.2 R6_2.5.1 DBI_1.1.3 colorspace_2.0-3 urlchecker_1.0.1 withr_2.5.0 tidyselect_1.1.2
[17] prettyunits_1.1.1 processx_3.7.0 curl_4.3.2 compiler_4.2.1 cli_3.3.0 rvest_1.0.2 xml2_1.3.3 labeling_0.4.2
[25] sass_0.4.2 scales_1.2.0 quadprog_1.5-8 callr_3.7.1 digest_0.6.29 pkgconfig_2.0.3 htmltools_0.5.3 sessioninfo_1.2.2
[33] highr_0.9 dbplyr_2.2.1 fastmap_1.1.0 htmlwidgets_1.5.4 rlang_1.0.4 readxl_1.4.0 rstudioapi_0.13 shiny_1.7.2
[41] farver_2.1.1 jquerylib_0.1.4 generics_0.1.3 jsonlite_1.8.0 googlesheets4_1.0.0 magrittr_2.0.3 Quandl_2.11.0 Rcpp_1.0.9
[49] munsell_0.5.0 fansi_1.0.3 lifecycle_1.0.1 stringi_1.7.8 yaml_2.3.5 pkgbuild_1.3.1 grid_4.2.1 promises_1.2.0.1
[57] crayon_1.5.1 miniUI_0.1.1.1 lattice_0.20-45 haven_2.5.0 hms_1.1.1 knitr_1.39 ps_1.7.1 pillar_1.8.0
[65] pkgload_1.3.0 reprex_2.0.1 evaluate_0.15 remotes_2.4.2 renv_0.15.5 modelr_0.1.8 vctrs_0.4.1 tzdb_0.3.0
[73] httpuv_1.6.5 cellranger_1.1.0 gtable_0.3.0 assertthat_0.2.1 cachem_1.0.6 xfun_0.31 mime_0.12 xtable_1.8-4
[81] broom_1.0.0 later_1.3.0 googledrive_2.0.0 gargle_1.2.0 memoise_2.0.1 ellipsis_0.3.2
I am quite puzzled by the command line. The file not found is this one:
--template "Z:\J6QBFO~T\renv\library\R-4.2\X4WA3Z~2\R3QO3L~A\rmd\h\D0CS9J~9"
I am not quite sure why there is no filename at the end. Does this folder means something to you ? Seems you are working on a network drive using renv in the project ?
The particular folder does not mean anything to me. And you are correct: I am working on a network drive using an Rstudio project and renv.
Network drive are known to cause issue with RStudio IDE and Pandoc used by rmarkdown. This one is new to me though as usually mapping the network drive on a letter as here (Z://) solve the issue. However, there should be a .html
template file at --template "Z:\J6QBFO~T\renv\library\R-4.2\X4WA3Z~2\R3QO3L~A\rmd\h\D0CS9J~9"
and this does not seem ok.
So something seems not correct in your specific environment regarding how R resolves paths within this drive.
Can you look into this folder from R ?
What is the result of
list.files(file.path(find.package("rmarkdown"), "rmd", "h"))
Should be something like
list.files(file.path(find.package("rmarkdown"), "rmd", "h"))
#> [1] "_navbar.html" "accessibility" "anchor-sections"
#> [4] "bootstrap" "default.html" "fontawesome"
#> [7] "highlightjs" "ionicons" "jqueryui"
#> [10] "jqueryui-AUTHORS.txt" "navigation-1.1" "pagedtable-1.1"
#> [13] "pandoc" "rmarkdown" "rsiframe-1.1"
#> [16] "shiny-header.html" "tabset" "tocify"
Here are the results:
> list.files(file.path(find.package("rmarkdown"), "rmd", "h"))
[1] "_navbar.html" "accessibility" "anchor-sections" "bootstrap" "default.html" "fontawesome" "highlightjs"
[8] "ionicons" "jqueryui" "jqueryui-AUTHORS.txt" "navigation-1.1" "pagedtable-1.1" "pandoc" "rmarkdown"
[15] "rsiframe-1.1" "shiny-header.html" "tabset" "tocify"
Identical as far as I can see.
Might be related to the use of renv
(v0.15.5). I could render the file using the global library outside the Rstudio-project without problems. I can also render similar files in other Rstudio-projects using the same version of renv
. Inside this project I reinstalled all packages but without effect.
Maybe this is a renv issue then ? 🤔
I don't know what the Z:\J6QBFO~T\renv\library\R-4.2\X4WA3Z~2\R3QO3L~A\rmd\h\D0CS9J~9
special non-word string are in this path. Usually when a ~
this is because of windows shortpath.
If this the result path for find.package("rmarkdown")
within a renv project ?
Can you try normalizing using normalizePath()
Sorry for taking so long in answering. I was on vacation and somehow missed your answer.
In the meantime I upgraded all packages to the latest version including renv
to 0.16.0.
> find.package("rmarkdown")
[1] "Z:/<project-name>/renv/library/R-4.2/x86_64-w64-mingw32/rmarkdown"
I don't know where to use normalizePath()
as just knitting the minimal Rmd-file
---
title: "Test Report"
author: Me Myself
data: "2022-07-26"
output: html_document
---
Test
still fails inside the Rstudio-Projekt. It is created without problems when knitted outside the project.
I think I'll need you to provide me with a reproducible example of this issue to help further. There could be an interaction between renv and rmarkdown but I can't reproduce.
Can you create maybe a repository with renv configuration so I can clone and try on my side ?
Unfortunately, I failed to do so. I copied the test-Rmd file and the renv.lock
and restored all packages. It works in the new folder.
Some days ago I copied a working project and knitting failed with error 97.
I will close this for now and investigate further.
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.