Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Knitr pandoc Execution halted in R

Knitr / Rmarkdown Execution halted

When I run Knitr and Rmarkdown, even with the knitr example scripts, I get the below error message.

Error in system(paste(shQuote(pandoc_path), "--version"), intern = TRUE) : '"C:/Program Files/RStudio/bin/pandoc/pandoc"' not found Calls: <Anonymous> ... get_pandoc_version -> with_pandoc_safe_environment -> force -> system Execution halted

I have installed and loaded knitr and rmarkdown from the libraries and alternatively using dev tools to get the most recent versions from github.

As it was working previously and I haven't changed any settings, I was wondering whether it might be due to the new R release and whether that has caused this?

I have tried uploading pandoc to the specific location it requested in the error but the online guidance was difficult to follow so didn't move into folder just it case it made it worst, as it was not required before I was confused as to why it was an error?

Not sure what else to try out, I have googled, stackflowed and explored knitr and pandoc webpages for any clues but with not success.

If anyone knows how to fix this as soon as possible I would be very grateful!!

like image 907
Alice Avatar asked Jan 18 '26 10:01

Alice


1 Answers

I know this is a very old question, but I had the exact same issue, where knitting an Rmd file worked perfectly yesterday, and today, stopped working with the identical error message above. Even knitting the default Rmd starter document failed.

It's possible that a Windows patch was applied by our IS folks that may have broken something, as I had not changed my setup at all.

Doing a Sys.which('pandoc') suggested that it was looking in the wrong place (a user-specific location).

Updating RStudio did not help. Adding the following to my Rmd file also did not work:

Sys.setenv(RSTUDIO_PANDOC="PATH_TO_MY_PANDOC_BIN")

What eventually worked was a subset of the response by Ivo Fugers:

install.packages('installr')
installr::install.pandoc()

(I wasn't paying close attention but think I allowed it to uninstall another version of pandoc.) After a system restart, knitting is working again.

Hope this helps folks in the future, as it seems to be a problem that still sporadically recurs.

like image 66
jhchou Avatar answered Jan 20 '26 01:01

jhchou



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!