I'm on a windows machine and I'm trying to knit an RMarkdown document with RStudio. When I press the 'knit' button in RStudio, I get a "requires an updated version of the yaml package" message. I install.packages("yaml") to find a message saying something along the lines of "binary source needs_compilation." I check the CRAN page for yaml and it seems that the Microsoft binaries are not up to date with the the more recent Mac version (2.1.14 < 2.1.15). I think this is the reason why I can't knit an RMarkdown document, but I do not know how to work around this.
This error popped up a few days ago and I'm not really sure how to fix it. I've been knitting documents pretty consistently until now and don't really know what to do.
Any help or guidance would be greatly appreciated.
#cedric's link helped out. I had to install() the yaml package using devtools
Related
I've had a functioning RStudio setup for a while, on a Manjaro machine.
But suddenly it seems to no longer to able to interpret latex code. (Or is this an RMarkdown issue?). When I try to Knitr a pdf, I now get the following error message in the 'render' window:
You may need to add $ $ around a certain inline R expression r in Labb2New.Rmd (see the above hint). See https://github.com/rstudio/rmarkdown/issues/385 for more info.
Error: LaTeX failed to compile Labb2New.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Labb2New.log for more info.
Execution halted
What could be the issue here?
I've done no installation or updates (that I'm aware of) since Rstudio last worked.
There's tons of ways that you can compile Latex inside RMarkdown in RStudio, it can be confusing... so personally I did this:
Be sure to install everything in ONE SINGLE USER and not in the system, it could cause directory conflict and MiKtex somehow doesn't work for the whole systems, i read other comments where they can't solve that problem, me neither xD.
You should have all this requirements
R (you already installed it)
RStudio
MikTex
TeX Live
Install from CRAN
install.extras(repos = "http://cran.us.r-project.org")
THEN
## Install from CRAN
install.packages('rmarkdown')
Everything should work, you should have enough space memory to do this though. I just had this exact same problem yesterday so i reviewed my history x3
anyway if you have other problem with this process please feel free to tell me, be sure to read the documentations for what I listed there's lots of requirements inside, so probably is that!
I am trying to use Rmarkdown on our department's RStudio server. I am using the tinytex package to install TinyTex, for the Rmarkdown files. It was working before, then I was trying to get a custom latex template to work and somehow managed to mess up my latex setup. I have tried a fresh install of TinyTeX through the tinytex package which doesn't help.
I get the following errors when knitting:
! kpathsea: Running mktexfmt pdflatex.fmt
! mktexfmt [ERROR]: -user mode but path setup is -sys type, bailing out.
Addtional Info :
1)
cat /proc/version
yields
Linux version 4.15.0-72-generic (buildd#lcy01-amd64-026) (gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)) #81-Ubuntu SMP Tue Nov 26 12:20:02 UTC 2019
2)
The following minimal example gives the same problem:
---
title: "Untitled"
output: pdf_document
---
## R Markdown
## Including Plots
5)
Log file is not useful just contains only the above errorr message
Any help greatly appreciated!
It is (at present) a little hard to help you as there is little tangible information in your post. Additional pointers that may help us:
What Linux distro (and version) does that server run? This alone may be important---in 25 years of LaTeX on Debian/Ubuntu, I have almost always found all required fonts or styles in the distro itself (and tinytex either did not or does not work due to, IIRC, orthogonal views on whether path info is user or system based).
Can you, or can you not, run a minimal document? If you try a five-line document maybe just setting document type, a section and a title, does that work?
Can you get hold of a different setup just for checks? https://rstudio.cloud is a pretty decent alternative just to check the sanity of your attempt.
Tinytex tries a herculean task of intercepting all possible errors on all possible OSs. That is hard to impossible to get right; consequently it has fooled a very senior R developer and myself more than once pointing the wrong way.
Do you have a .log file produced by the command you ran? Does it have any information?
tinytex is well-liked by a lot of people, it clearly helps in some situations. That said, in my use cases it mostly seems to get in the way but do not let that stop you.
i have a knitr based Rnw file that is compiling to pdf perfectly fine in RStudio on mac (v0.97.316) and knitr (v1.1) but in a windows enviornment (same versions) i get a compilation error. I've checked the options in RStudio in both environments and they are consistent.
It appears that the windows setup is always injecting: "\SweaveOpts{concordance=TRUE}" into the ".tex" file even though i have no such flag in the Rnw file, and/or if i toggle the settings in the preferences, and/or if i add the "opts_knit$set(concordance=FALSE)" options to a knitr settings chunk. If i drop the line from the ".tex" file and compile it manually at the cmd prompt the output is generated as expected.
I'm not sure if this is an RStudio or knitr problem, but any pointers would be appreciated.
Note, i've also posted this question on the RStudio support board (http://support.rstudio.org/help/discussions/problems/5039-knitr-compile-problems-with-rstudio-windows?unresolve=true).
The reason that it was injecting \SweaveOpts{concordance=TRUE} is likely to be your weaver was Sweave instead of knitr, and you also enabled Rnw concordance: http://www.rstudio.com/ide/docs/authoring/rnw_weave But I cannot say for sure it is not a bug for the Windows version of RStudio. Anyway, it is easy to verify if it is an RStudio problem -- open the Compile PDF panel and you should see the log like this:
If your weaver was Sweave, you will see something like this instead:
This is my configuration (I'm under Ubuntu):
If you are using knitr indeed, and RStudio still inserts \SweaveOpts{concordance=TRUE}, I guess it must be a bug of RStudio.
I encountered this problem with "R CMD build KFAS-master" downloaded 2016-04-24 as "KFAS-master.zip" clicking "Download ZIP" from KFAS on GitHub (https://github.com/helske/KFAS). I'm unable to replicate the problem, but the work around I used was to find the line mentioned in the pop-up (copied below), and comment it out by preceding it with "%%".
After downloading it, I unzipped it and changed the name of the folder to "KFAS". Then I got a command prompt and navigated to the directory containing the KFAS-master folder renamed as KFAS. This time "R CMD build KFAS" worked as expected. Then I opened ~KFAS/vignettes/KFAS.Rmw in RStudio 0.99.893, the current version as of 2016-04-26. I changed something and saved the result. When I repeated "R CMD build KFAS", I got the problem portrayed in the image below.
Jouni Helske directed me to this post. I commented out line 69 mentioned in the screen shot below by prepending "%%" to "\SweaveOpts{concordance=TRUE}". I saved the result, and "R CMD build KFAS" worked.
Something seems to occasionally insert a line like "\SweaveOpts{concordance=TRUE}" into a *.Rnw file, but I don't know what it is. I'm running R 3.2.4 on a MacBook Pro with OS X 10.11.2.
Thanks to Yihui and others for earlier posts in this thread.
screen shot showing pop-up complaining, "It seems you are using the Sweave-specific syntax in line(s) 69... ."
I had the same problem even when knitr was set for "Weave Rnw files using" by default.
I solved it by going to Tools/Global Options/Sweave and setting "Weave Rnw files using" to Sweave and pressing Ok. Then, I went back and set it back to knitr, and everything works fine now.
I guess it was indeed Rstudio bug
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!!
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.
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.
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.
change your file name "C:/Program Files/RStudio/bin/pandoc/pandoc" into
"C:/ProgramFiles/RStudio/bin/pandoc/pandoc" or something else.
It doesn't allow space in the file address (like Program Files).
I'm working on getting knitr setup. I installed the latest version of R (2.15.1), Lyx 2.0 including the MiKTex 2.9 distribution, and RStudio 0.96.304 on a Windows 7 Enterprise box. I can get pdflatex output if I open up Lyx and simply view the tutorial, so the basic system is working. I then downloaded the minimal Rnw example saved it in my working directory as testknitr.Snw, opened that file in RStudio, and pressed the compile PDF button. The knitr output completes with a single warning about the parser package, and produces a file testknitr.tex. pdflatex.exe then runs, but fails, and the particular error in the log file seems to be
! LaTeX Error: Environment alltt undefined.
I received the same error when attempting to compile testknitr.tex using TexWorks. I created that file from inside R using knit("testknitr.Rnw") - different extension because of the default in RStudio. I did tell MikTek to update packages automatically when compiling. A bit of research on CTAN suggests that the alltt environment is part of the ltxbase package, which is installed when I look at the package manager. In fact it seems like a pretty core part of the whole thing!
OK - I was reading the comments on the minimal example page, and discovered a workaround to that problem, and that it is a known bug as of 19 hours ago. And yes, I doublechecked that RStudio is set to use knitr, not sweave. I now get a new error:
! LaTeX Error: Command \textquotesingle unavailable in encoding T1.
EDIT: OK! it turns out that error isn't fatal - there's a lovely pdf of the minimal example sitting in the working directory if one takes the time to look. Somewhat alarming that RStudio thinks compilation failed when it didn't?
The workaround, perhaps obvious to an experience LaTex-ie, is to add
\usepackage{alltt}
to the file. According to Yihui's comment this will be fixed in future versions, or now if you want to get the development version from github. I also tested #Yihui's comment above that the line
\usepackage[T1]{fontenc}
could be commented out. This fixes the 2nd issue in the question, and RStudio now treats the compilation as successful, cleaning up (some?) intermediate files and immediately previewing the pdf.