pandoc: openFile: does not exist (No such file or directory)
I am trying to server Rmd using shiny server. However, it seems rmarkdown or pandoc is buggy. It works well on Rstudio but fails deploy on rstudio connect too.
yaml config:
output:
flexdashboard::flex_dashboard:
social: menu
source: embed
storyboard: yes
Rmarkdown version:
packageVersion("rmarkdown")
[1] ‘1.8’
shiny-server --version
Shiny Server v1.5.3.838
Node.js v6.10.0
pandoc version
/opt/shiny-server/ext/pandoc/pandoc --version
pandoc 1.12.3
Compiled with texmath 0.6.6, highlighting-kate 0.5.6.
sessionInfo():
R version 3.3.2 (2016-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.5 LTS
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
here is the shiny server log:
processing file: index.Rmd
output file: /tmp/rmarkdown/e01d3e5bbe48ef364e37eb0580046563/index.knit.md
pandoc: /tmp/RtmpWH829n/rmarkdown-str67a94810a85d.html: openFile: does not exist (No such file or directory)
Warning: Error in : pandoc document conversion failed with error 1
Stack trace (innermost first):
115: pandoc_convert
114: convert
113: <Anonymous>
112: do.call
111: contextFunc
110: .getReactiveEnvironment()$runWith
109: shiny::maskReactiveContext
108: <reactive>
95: doc
94: shiny::renderUI
93: func
92: force
91: withVisible
90: withCallingHandlers
89: globals$domain$wrapSync
88: promises::with_promise_domain
87: captureStackTraces
83: tryCatch
82: do
81: hybrid_chain
80: origRenderFunc
79: output$__reactivedoc__
3: <Anonymous>
2: do.call
1: rmarkdown::run
Please test the development version:
devtools::install_github('rstudio/rmarkdown')
https://github.com/rstudio/blogdown/issues/256#issuecomment-365966430
I tried to do it , however, it failed too and the error is the same as usual.
devtools::install_github("rstudio/rmarkdown",lib="/usr/local/lib/R/site-library")
Are you sure R uses the rmarkdown package from /usr/local/lib/R/site-library? In other words, have you checked .libPaths() and are you sure /usr/local/lib/R/site-library is the first entry? When showing the session info, it will be great if you can load the package before showing it, e.g., either
library(rmarkdown)
sessionInfo()
or better (as requested in the issue template):
devtools::session_info('rmarkdown')
Just FYI I'm also seeing this error (trying to use rmarkdown with flexdashboard). Using the dev version unblocked things but I'm still seeing the error.
@ADraginda Are you also on Shiny Server? Is it reproducible locally?
I have the same issue, but only when I run rmarkdown::render(...) in parallel on multiple cores. When I do
registerDoParallel(cores=1) it works without error. When running in parallel, out of many calls of the function, only some return errors as described here, and also not consistently (appears random at first sight).
Is that information helpful?
To reproduce, install the following R package and
- run
reproducemarkdownerror:hello(3)for 3 cores respectively. This should give you error messages. reproducemarkdownerror:hello(1)should not give you any errors.
reproducermarkdownerror_0.1.0.tar.gz
Output (operation produces only 92 files although 100 expected):
> reproducermarkdownerror::hello(3)
Loading required package: foreach
Loading required package: iterators
Loading required package: parallel
pandoc: /tmp/RtmpmiRJfV/rmarkdown-str124b12f90895.html: openFile: does not exist (No such file or directory)
pandoc: /tmp/RtmpmiRJfV/rmarkdown-str124d5a2948a2.html: openFile: does not exist (No such file or directory)
pandoc: /tmp/RtmpmiRJfV/rmarkdown-str124b1d015295.html: openFile: does not exist (No such file or directory)
pandoc: /tmp/RtmpmiRJfV/rmarkdown-str124c3a9fd602.html: openFile: does not exist (No such file or directory)
pandoc: /tmp/RtmpmiRJfV/rmarkdown-str124b191fe7b1.html: openFile: does not exist (No such file or directory)
pandoc: /tmp/RtmpmiRJfV/rmarkdown-str124d70f14424.html: openFile: does not exist (No such file or directory)
pandoc: /tmp/RtmpmiRJfV/rmarkdown-str124b586db239.html: openFile: does not exist (No such file or directory)
pandoc: /tmp/RtmpmiRJfV/rmarkdown-str124b142b5ab8.html: openFile: does not exist (No such file or directory)
Error in do_rpt(r) :
task 7 failed - "pandoc document conversion failed with error 1"
Script taken from here: https://gist.github.com/hrbrmstr/17bc21af55392f23f012f57bb2fda51c
Version information:
> devtools::session_info("rmarkdown")
setting value
version R version 3.4.4 (2018-03-15)
system x86_64, linux-gnu
ui RStudio (1.1.383)
language (EN)
collate en_US.UTF-8
tz Europe/Berlin
date 2018-06-04
package * version date source
backports 1.1.2 2017-12-13 CRAN (R 3.4.3)
base64enc 0.1-3 2015-07-28 CRAN (R 3.4.3)
digest * 0.6.15 2018-01-28 CRAN (R 3.4.3)
evaluate 0.10.1 2017-06-24 CRAN (R 3.4.3)
glue 1.2.0 2017-10-29 CRAN (R 3.4.3)
graphics * 3.4.4 2018-03-16 local
grDevices * 3.4.4 2018-03-16 local
highr 0.6 2016-05-09 CRAN (R 3.4.3)
htmltools 0.3.6 2017-04-28 CRAN (R 3.4.3)
jsonlite 1.5 2017-06-01 CRAN (R 3.4.3)
knitr 1.20 2018-02-20 CRAN (R 3.4.3)
magrittr 1.5 2014-11-22 CRAN (R 3.4.3)
markdown 0.8 2017-04-20 CRAN (R 3.4.3)
methods * 3.4.4 2018-03-16 local
mime 0.5 2016-07-07 CRAN (R 3.4.3)
Rcpp 0.12.17 2018-05-18 CRAN (R 3.4.4)
rmarkdown 1.9 2018-03-01 CRAN (R 3.4.3)
rprojroot 1.3-2 2018-01-03 CRAN (R 3.4.4)
stats * 3.4.4 2018-03-16 local
stringi 1.2.2 2018-05-02 CRAN (R 3.4.4)
stringr 1.3.1 2018-05-10 CRAN (R 3.4.4)
tools 3.4.4 2018-03-16 local
utils * 3.4.4 2018-03-16 local
yaml 2.1.19 2018-05-01 CRAN (R 3.4.4)
I can reproduce this error locally. Using rmarkdown::pandoc_convert() to convert a file in the same directory works, but trying to convert it one directory down fails.
Create directory structure and file
dir <- tempdir()
sub_dir <- tempfile(tmpdir = dir)
f <- tempfile(tmpdir = sub_dir)
dir.create(sub_dir)
writeLines("This is a test", f)
cwd <- getwd()
library(rmarkdown)
This works
setwd(sub_dir)
fname <- basename(f)
readLines(fname)
#> [1] "This is a test"
pandoc_convert(fname, to = "html")
This doesn't:
setwd(dir)
fname <- file.path(basename(sub_dir), basename(f))
readLines(fname)
#> [1] "This is a test"
pandoc_convert(fname, to = "html")
#> Error: pandoc document conversion failed with error 1
setwd(cwd)
sessionInfo()
#> R version 3.5.1 (2018-07-02)
#> Platform: x86_64-apple-darwin15.6.0 (64-bit)
#> Running under: macOS Sierra 10.12.6
#>
#> Matrix products: default
#> BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
#>
#> locale:
#> [1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] rmarkdown_1.10.12
#>
#> loaded via a namespace (and not attached):
#> [1] compiler_3.5.1 magrittr_1.5 htmltools_0.3.6 tools_3.5.1
#> [5] yaml_2.2.0 Rcpp_0.12.18 stringi_1.2.4 knitr_1.20
#> [9] htmldeps_0.1.1 digest_0.6.16 stringr_1.3.1 evaluate_0.11
I had a similar problem, where I could knit in some directories, but not in others (on a mapped network drive).
I removed pandoc 2.4, to direct RStudio to use the in-built pandoc as per @yihui 's comment at #1184.
@NilsOle I'm having the same problem as you are describing, were you able to solve it somehow? :)
Following @pauvasquezh, @NilsOle or @goldingn were you able to solve this?
Following @pauvasquezh, @NilsOle or @goldingn were you able to solve this?
I solved it by changing my RStudio global options and setting the R version to be the local C:\ drive and not R on the network drive.
If the Rmd file is stored on a network drive, the knitting fails. However, if the Rmd file is stored on the local C:\ drive, the knitting works fine.
YAML
---
title: "Untitled"
author: "William Chiu"
date: "7/22/2019"
output: powerpoint_presentation
---
Network drive
output file: ppt_test.knit.md
"C:/Users/wchiu/AppData/Local/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS ppt_test.utf8.md --to pptx --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash+smart --output ppt_test.pptx
pandoc.exe: ppt_test.utf8.md: openBinaryFile: does not exist (No such file or directory)
Error: pandoc document conversion failed with error 1
Execution halted
Local C:\ drive
"C:/Users/wchiu/AppData/Local/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS ppt_test.utf8.md --to pptx --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash+smart --output ppt_test.pptx
output file: ppt_test.knit.md
Output created: ppt_test.pptx
Session Info
> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.6.1 htmltools_0.3.6 tools_3.6.1 yaml_2.2.0 Rcpp_1.0.1 rmarkdown_1.14
[7] knitr_1.23 xfun_0.8 digest_0.6.20 evaluate_0.14
RStudio Version
$citation
To cite RStudio in publications use:
RStudio Team (2018). RStudio: Integrated Development for R. RStudio, Inc., Boston, MA URL
http://www.rstudio.com/.
A BibTeX entry for LaTeX users is
@Manual{,
title = {RStudio: Integrated Development Environment for R},
author = {{RStudio Team}},
organization = {RStudio, Inc.},
address = {Boston, MA},
year = {2018},
url = {http://www.rstudio.com/},
}
$mode
[1] "desktop"
$version
[1] ‘1.2.1335’
Just save the Rmd file to the C:\ drive rather than desktop (Network Drive). This solved my problem while I have struggled a month... Very simple solution. Thank you guys.
@yihui - although there is a very simple work around (store Rmd file on C:\ rather than network drive), some of us are not allowed to save files on our C:\ (per company policy and/or using RStudio Server Pro with mounted network folders). Is there a plan to fix rmarkdown or knitr such that Rmd files that are stored on a network drive can still knit?
I think this is the same issue as in #701 where there is already a long discussion.
An issue was even opened to pandoc (jgm/pandoc#1326) as it is in fact a more general issue with pandoc than just Rmarkdown. it was conclude that it could come from the drive directly, and that it is not specific to R or Rmarkdown tools (https://github.com/rstudio/rmarkdown/issues/701#issuecomment-236960677)
Currently solution is to copy locally somewhere (not necessary in C:) before doing the conversion. see for example https://github.com/rstudio/rmarkdown/issues/701#issuecomment-237222070 or other comments.
To share experience, on a RStudio Server Pro (linux) with NFS mounted drive, we have no issue with that.
Before I had issues with older system, and specifically with self_contained=TRUE document.
Also, there was recently a specific fix for WINDOWS environment in https://github.com/jgm/pandoc/issues/5127 that is included in Pandoc 2.7.3. I don't know if it could help.
At the time, I manage to change some directory argument from Rmarkdown (https://github.com/rstudio/rmarkdown/issues/701#issuecomment-237182996) to get the intermediaries files on local drive. (my home directory was on local drive).
although there is a very simple work around (store Rmd file on C:\ rather than network drive), some of us are not allowed to save files on our C:\ (per company policy and/or using RStudio Server Pro with mounted network folders)
I think any local folder where you have access right will work. Not just C:/ . You could have a home directory or even a temp directory to move your file before knitting. (R has one in tempdir())
Moving files there before rendering could solve the issue with pandoc. Updating pandoc could help too maybe (rmarkdown::pandoc_version() to see what is shipped with your RStudio)
Hope it helps.
FYI Seeing the same issue using Rstudio in a windows VM. Setting the default working directory in Rstudio to a drive letter (e.g., Z:) in "Tools > Global options > General" rather than the default "~" resolved the issue.
I'm trying to do multiple reports (https://www.reed.edu/data-at-reed/software/R/markdown_multiple_reports.html) and with mtcars works fine, but if I do the same with my own dataframe loaded from a *.csv doesn't work. I don't know how to fix it nor I understand why and how is happening, I'm on a local computer.
sessionInfo() R version 3.5.0 (2018-04-23) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1
Matrix products: default
locale: [1] LC_COLLATE=Spanish_Spain.1252 LC_CTYPE=Spanish_Spain.1252 LC_MONETARY=Spanish_Spain.1252 [4] LC_NUMERIC=C LC_TIME=Spanish_Spain.1252
attached base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] readr_1.1.1 stringr_1.3.1 leaflet_2.0.2 dplyr_0.8.3 ggplot2_3.1.1 rmarkdown_1.10 markdown_0.8
[8] knitr_1.20
loaded via a namespace (and not attached):
[1] Rcpp_1.0.1 pillar_1.3.1 compiler_3.5.0 later_0.7.5 plyr_1.8.4 tools_3.5.0
[7] digest_0.6.18 evaluate_0.10.1 tibble_2.1.3 gtable_0.2.0 pkgconfig_2.0.2 rlang_0.4.0
[13] cli_1.0.1 shiny_1.1.0 rstudioapi_0.7 crosstalk_1.0.0 yaml_2.1.19 withr_2.1.2
[19] hms_0.4.2 htmlwidgets_1.3 rprojroot_1.3-2 grid_3.5.0 tidyselect_0.2.5 glue_1.3.1
[25] R6_2.2.2 fansi_0.4.0 purrr_0.2.5 magrittr_1.5 promises_1.0.1 scales_1.0.0
[31] backports_1.1.2 htmltools_0.3.6 rsconnect_0.8.15 assertthat_0.2.0 xtable_1.8-3 mime_0.5
[37] colorspace_1.3-2 httpuv_1.4.5 utf8_1.1.4 stringi_1.2.2 lazyeval_0.2.1 munsell_0.5.0
[43] crayon_1.3.4
I encountered the same error knitting to HTML from an .Rmd on a network drive. My working directory was already local. However, clearing the knitr cache resolved the issue.
The solution by @vthivierge worked for me.
100% fix
when you open a project on a mapped drive do not open it through the shortcut to the mapped drive
#this works and happens automatically when you open the Rstudio project through that path rmarkdown::render('H:/Mediasonic/John/tester.Rmd', encoding = 'UTF-8');
this is what happens when you open it wrong the knit command cannot operate on this path rmarkdown::render('//offfice//H//Mediasonic RAID1//John/tester.Rmd', encoding = 'UTF-8');