Repository navigation
Closed
Labels
Description
By filing an issue to this repo, I promise that
- I have fully read the issue guide at https://yihui.name/issue/.
- I have provided the necessary information about my issue.
- If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
- If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included
xfun::session_info('rmarkdown'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version:remotes::install_github('rstudio/rmarkdown'). - If I have posted the same issue elsewhere, I have also mentioned it in this issue.
- I have learned the Github Markdown syntax, and formatted my issue correctly.
I understand that my issue may be closed if I don't fulfill my promises.
When I am using rmarkdown::render() in BiocParallel::bplapply(), Pandoc throws this error:
pandoc: /tmp/RtmpW06rTD/rmarkdown-str3bc26dd971b5.html: openBinaryFile: does not exist (No such file or directory). I am using Pandoc version 2.7.3 and development version of rmarkdown. Everything works fine when I use BPPARAM = SerialParam() in bplapply (i.e. it will disable parallel processing).
to_render.Rmd:
---
output:
html_document:
code_folding: "none"
df_print: "paged"
toc: false
number_sections: false
theme: "united"
self_contained: true
params:
title: "Document"
---
---
title: `r params$title`
---
```{r}
DT::datatable(
mtcars,
filter = "top",
width = "100%",
class = "display compact"
)
```
render.R:
library(glue)
library(rmarkdown)
library(BiocParallel)
N_CPUS <- 8
OUTPUT_DIR <- "rendered"
OUTPUT_FILES <- 1:10
BPPARAM <- MulticoreParam(workers = N_CPUS)
dir.create(OUTPUT_DIR, showWarnings = FALSE)
bplapply(OUTPUT_FILES, function(i) {
intermediates_dir <- glue("{i}_intermediates_dir")
render(
"to_render.Rmd",
output_file = glue("{i}.html"),
output_dir = OUTPUT_DIR,
params = list(title = glue("Document {i}")),
intermediates_dir = intermediates_dir
)
system(glue("rm -r {intermediates_dir}"))
}, BPPARAM = BPPARAM)Output from render.R:
> library(glue)
> library(rmarkdown)
> library(BiocParallel)
> N_CPUS <- 8
> OUTPUT_DIR <- "rendered"
> OUTPUT_FILES <- 1:10
> BPPARAM <- MulticoreParam(workers = N_CPUS)
> dir.create(OUTPUT_DIR, showWarnings = FALSE)
> bplapply(OUTPUT_FILES, function(i) {
+ intermediates_dir <- glue("{i}_intermediates_dir")
+
+ render(
+ "to_render.Rmd",
+ output_file .... [TRUNCATED]
processing file: to_render.Rmd
|................................ | 50%
ordinary text without R code
|.................................................................| 100%
label: unnamed-chunk-1
output file: /ssd/ownCloud/temp/rmarkdown_parallel_reprex/3_intermediates_dir/to_render.knit.md
/usr/bin/pandoc +RTS -K512m -RTS /ssd/ownCloud/temp/rmarkdown_parallel_reprex/3_intermediates_dir/to_render.utf8.md --to html4 --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash+smart --output /ssd/ownCloud/temp/rmarkdown_parallel_reprex/rendered/3.html --email-obfuscation none --self-contained --standalone --section-divs --template /home/novotnyj/R/x86_64-pc-linux-gnu-library/3.6/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable 'theme:united' --include-in-header /tmp/Rtmpiblzto/rmarkdown-str42fb6ef4dcc8.html --mathjax --variable 'mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --metadata pagetitle=/ssd/ownCloud/temp/rmarkdown_parallel_reprex/3_intermediates_dir/to_render.utf8.md
Output created: rendered/3.html
pandoc: /tmp/Rtmpiblzto/rmarkdown-str42fc5c014392.html: openBinaryFile: does not exist (No such file or directory)
processing file: to_render.Rmd
|................................ | 50%
ordinary text without R code
|.................................................................| 100%
label: unnamed-chunk-1
output file: /ssd/ownCloud/temp/rmarkdown_parallel_reprex/4_intermediates_dir/to_render.knit.md
/usr/bin/pandoc +RTS -K512m -RTS /ssd/ownCloud/temp/rmarkdown_parallel_reprex/4_intermediates_dir/to_render.utf8.md --to html4 --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash+smart --output /ssd/ownCloud/temp/rmarkdown_parallel_reprex/rendered/4.html --email-obfuscation none --self-contained --standalone --section-divs --template /home/novotnyj/R/x86_64-pc-linux-gnu-library/3.6/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable 'theme:united' --include-in-header /tmp/Rtmpiblzto/rmarkdown-str42fc698c38a7.html --mathjax --variable 'mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --metadata pagetitle=/ssd/ownCloud/temp/rmarkdown_parallel_reprex/4_intermediates_dir/to_render.utf8.md
Output created: rendered/4.html
pandoc: /tmp/Rtmpiblzto/rmarkdown-str42fa67445478.html: openBinaryFile: does not exist (No such file or directory)
pandoc: /tmp/Rtmpiblzto/rmarkdown-str42ff5be0d7db.html: openBinaryFile: does not exist (No such file or directory)
pandoc: /tmp/Rtmpiblzto/rmarkdown-str42fd4840f002.html: openBinaryFile: does not exist (No such file or directory)
Error: BiocParallel errors
element index: 2, 5, 7, 10
first error: pandoc document conversion failed with error 1
Pandoc and session info:
> pandoc_exec()
[1] "/usr/bin/pandoc"
> pandoc_version()
[1] ‘2.7.3’
> xfun::session_info()
R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 19, RStudio 1.2.1335
Locale:
LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=cs_CZ.UTF-8 LC_MESSAGES=en_US.UTF-8
LC_PAPER=cs_CZ.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=cs_CZ.UTF-8 LC_IDENTIFICATION=C
Package version:
base64enc_0.1.3 BH_1.69.0.1 BiocParallel_1.18.1 compiler_3.6.1 digest_0.6.20 evaluate_0.14 formatR_1.7 futile.logger_1.4.3
futile.options_1.0.1 glue_1.3.1 graphics_3.6.1 grDevices_3.6.1 highr_0.8 htmltools_0.3.6 jsonlite_1.6 knitr_1.24
lambda.r_1.2.3 magrittr_1.5 markdown_1.1 methods_3.6.1 mime_0.7 parallel_3.6.1 Rcpp_1.0.2 rmarkdown_1.15.1
snow_0.4.3 stats_3.6.1 stringi_1.4.3 stringr_1.4.0 tinytex_0.15 tools_3.6.1 utils_3.6.1 xfun_0.9
yaml_2.2.0 Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
abalter commentedon Oct 23, 2019
I believe this may be the same issue as #1268 and #701. As well as
https://stackoverflow.com/questions/48161177/r-markdown-openbinaryfile-does-not-exist-no-such-file-or-directory
and
https://community.rstudio.com/t/fail-to-generate-file-in-rmarkdwon-openbinaryfile-does-not-exist-no-such-file-or-directory/34913
In my opinion, the issue has still not been completely resolved. I'm running into this error myself in a much more simple situation--no network drives or other unusual configurations.
gorgitko commentedon Oct 24, 2019
I can confirm this is happening on local computer using local drives, not network ones.
gorgitko commentedon Oct 24, 2019
So I have examined a little bit how is actually
rmarkdownusingpandocand especially what is the temporary filepandoccannot find:I have found that this file is probably somehow used for navbars, but more important is this function:
called in
render():So what is actually happening? After
render()call is finished, thisclean_tmpfilesfunction removes allrmarkdowntemporary files. And because in parallel calling the temporary directory is remaining the same, it will also remove temporary files for otherrender()calls.I can confirm this dirty solution works (put this after
library(rmarkdown)):Would be great if developers add something like
clean_tmpfiles = TRUEtorender()parameters and users could then callclean_tmpfiles()by themselves.Full modified
render.R:JayMMTL commentedon Apr 29, 2020
We're using a basic Pandoc script in bash to merge multiple files:
pandoc lf/lf_01.txt master.md lf/lf_02.txt master_fr.md lf/lf_03.txt master_es.md lf/lf_04.txt master_pt.md lf/lf_05.txt master_de.md lf/lf_06.txt master_it.md lf/lf_07.txt master_ja.md lf/lf_08.txt master.md lf/lf_09.txt > output.htmlIs it possible to add a function to prevent clearing the temp files which causes the "openBinaryFile: does not exist (No such file or directory)" error in this medium?
gorgitko commentedon Apr 30, 2020
@JayMMTL I am not sure how is this connected to rendering Rmds from within R. If this is the case, you can use the snippet I have provided to replace the
clean_tmpfiles()function, which causes this problem.Nicktz commentedon May 18, 2020
@gorgitko Your solution worked perfectly for me thanks.
Working on a linux vm building rmarkdown files in parallel.
Spent whole afternoon trying to figure this out and in the end your black magic dirty solution did the trick. Thanks!
agilebean commentedon May 19, 2020
Thanks @gorgitko for explaining the root cause.
Unfortunately, your solution does not work on my Macbook Pro 16.
It does call your mod function but the error 1 is thrown before:
I also tried the set off a flag mentioned in several posts:
create_report(iris, config = configure_report(add_plot_str = FALSE))SessionInfo:
Any ideas??
gorgitko commentedon May 19, 2020
@agilebean I am not sure if
clean_tmpfiles_mod()is correctly replacing the originalclean_tmpfiles(). It should echo"Calling clean_tmpfiles_mod()". Make sure you start with a clean environment and try my example first.dcaud commentedon Dec 11, 2020
I continue to get random messages about files not existing.
dcaud commentedon Dec 12, 2020
Some version of an insistently retrying function may work (although clearly not ideal, it seems to be helping me avoid this somewhat random error):
then call
insistent_renderinstead ofrmarkdown::renderktd2001 commentedon Mar 17, 2021
Any suggestions on how to fix this? I am running it in R version 4.04
pandoc.exe: \: openBinaryFile: does not exist (No such file or directory)
Warning: Error in : pandoc document conversion failed with error 1
128: stop
127: pandoc_convert
126: convert
125: render
124: discover_rmd_resources
123: find_external_resources
122: copy_render_intermediates
121: output_format$intermediates_generator
120:
115:
99: doc
98: renderUI
97: func
84: renderFunc
83: output$reactivedoc
3:
1: rmarkdown::run
cderv commentedon Mar 17, 2021
@ktd2001
Which OS are you on ?
Which Pandoc version do you use ?
rmarkdown::pandoc_version()Where are you files located ? On a network drive ?
Can you share the file with the issue so we can try reproduce ? With any other element that could help us understand ?
ktd2001 commentedon Mar 18, 2021
gorgitko commentedon Mar 18, 2021
@cderv I am just curious if anyone at RStudio has looked into the problem I proposed in the #1632 (comment)
TLDR: Allow users to specify whether
clean_tmpfiles()will be run afterrender()has finished. Possibly allow users to run it manually.Anyway, I think each rendered Rmd should get its own directory in
tempdir(); that would basically avoid this problem.Thank you for looking at this 🙂
10 remaining items
tylerlittlefield commentedon Aug 18, 2023
I was getting similar errors, but had nothing to do with running in parallel. Instead, the
withBinaryFile: does not exist (No such file or directory)error truly wasn't able to find the file it needed. In case someone else runs into this, here was my thought process.While containerizing a report, I hit the following error:
I then checked the directory it was complaining about:
As you can see, the file
fa-v4compatibility.woff2really didn't exist. I then checked therstudio/fontawesometo see if they were tracking the file I needed and indeed they were. So I simply installed the latest version and was good to go, problem solved.amloewi commentedon Oct 8, 2023
@gorgitko I'm trying to use your solution, but the
render.rI'm seeing looks very different from what's referenced here; the file I'm looking at is inrmarkdown-master/R/render.r, but it's over 1200 lines. I tried adding your code anyway, right inside of the "render" function, but it still failed in the same way. Am I looking in the right file, or does the new structure break your solution? (Or something else?)amloewi commentedon Oct 8, 2023
Apologies, actually a much dumber problem -- on mac, the file name was displayed as "x.bib" but the real name was *x.bib.txt", but that could only be seen when accessing meta-information on the file (Command I). Leaving here in case somebody else is confused into the same dumb problem.
Fred-Sheppard commentedon Nov 22, 2023
In the vain of dumb problems, omitting the -o before specifying the output file will cause the same error. This one caught me out (read the docs people!)
huguesmercier commentedon Jul 1, 2024
I confirm that this bug is still present with makeForkCluster (makePSOCKcluster works fine) with the following configuration:
Apple M3 Pro
macOS 14.5
R 4.3.2
pandoc 3.1.1
rmarkdown 2.22
The bug was hard to pinpoint, but the "dirty" solution proposed by gorgitko, copied below, still works:
ellisifnygaard commentedon Aug 7, 2025
Posting this here in the hopes others with a similar issue won't have to spend half a day troubleshooting.
I was running Rmarkdown renders in parallel on a network-mounted Linux filesystem (Ubuntu 22.04 in a container via Posit Workbench). I kept seeing error messages like this:
I had a function named
render_reportcontaining a call tormarkdown::renderwhich I used withforeach()followed by%dopar%to render one report per "study unit" (chromosome in my case):The only way I was able to ensure each render got its own directory in the temporary directory, and eliminate the pandoc errors completely, was to wrap the
rmarkdown::render()code incallr::r()like so:The initial version of
render_report()withoutcallr::r()(see below) worked fine on a virtual Windows machine, but resulted in the aforementioned pandoc errors when I ran my code on the Linux set-up.Track temp files per process to fix parallel render() failures (#1632) (
yihui commentedon Aug 26, 2026
It's almost the 7th anniversary of this issue now. I think the PR #2631 should fix it. Please try the development version of rmarkdown via
Thanks everyone!
Credit @gorgitko in NEWS for the #1632 fix (#2634)