Knitr pandoc Execution halted in R

2019-07-22 15:26发布

问题:

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!!

回答1:

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')
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.



回答2:

I had a similar problem in a Statistical Computing class. A solution that worked for some of my classmates (including myself) is installing a few version of MikTex (takes about an hour). Otherwise, this is a solution that our teacher gave us:

So here is a possible strategy when you end up with a pandoc error, or when your Latex Equations do not show up in the 'markup':

Step 1

Re-install pandoc manually in your R console:

installing/loading the package:

if(!require(installr)) { install.packages("installr"); require(installr)} #load / install+load installr

Installing pandoc

install.pandoc()

Step 2

Download the the self-extracting protext.exe file from http://www.tug.org/protext/ . Install MikTex from this .exe file using the default settings...

2a. Make sure you allow Protext to install packages on the fly without asking permission.

Step 3

Look at https://tex.stackexchange.com/questions/81739/the-memory-dump-file-could-not-be-found , not the solution. Change the persmissions of all users in

C:\Users\YourUsername\AppData\Local\Temp

and

C:\Program Files\MikTex 2.9\

to full control.

How to do this? Go to C:\Users\YourUsername\AppData\Local , and right click on the folder Temp. Go to properties --> Security... and make sure all users listed there (even the trusted install) will have full control acces.



回答3:

I faced the exact same problem yesterday and shocked because everything was working until day before yesterday. I was finishing my project in R markdown and it started throwing error.

Without having much help, I just have upgraded my RStudio to its latest version (0.98.1091). It took less than 10 minutes and everything started working as it was. I believe this sudden chocking was due to Windows patch update, but not 100% sure.