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.
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 randomly started getting the error messages below while trying to run a RMarkdown document. I am on a Windows, so I deleted the TinyTex subfolder within the AppData folder and reran tinytex::install_tinytex(). That installed but didn't fix the error messages, so I tried tinytex::reinstall_tinytex() but that didn't help.
I know from the error messages I am missing LaTeX packages, so I tried running the code below but it will not run. I assume there is a greater problem at hand, and guidance would be greatly appreciated.
tinytex::parse_install(text = "! LaTeX Error: File `setspace.sty' not found.")
Error messages:
A new version of TeX Live has been released. If you need to install or update any LaTeX packages, you have to upgrade TinyTeX with tinytex::reinstall_tinytex(). If it fails to upgrade, you might be using a default random CTAN mirror that has not been fully synced to the main CTAN repository, and you need to wait for a few more days or use a CTAN mirror that is known to be up-to-date (see the "repository" argument on the help page ?tinytex::install_tinytex).
tlmgr.pl: Local TeX Live (2021) is older than remote repository (2022).
Cross release updates are only supported with
update-tlmgr-latest(.sh/.exe) --update
See https://tug.org/texlive/upgrade.html for details.
! LaTeX Error: File `setspace.sty' not found.
! Emergency stop.
<read *>
Error: LaTeX failed to compile markdown.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See markdown.log for more info.
Execution halted
Two possibilities:
set your mirror to the historic version which still has 2021, e.g.
tinytex::tlmgr("option repository https://ftp.tu-chemnitz.de/pub/tug/historic/systems/texlive/2021/tlnet-final")
install vanilla texlive2022 from https://tug.org/texlive/
(I'd go with the second solution. If you use a complete texlive installation instead of tinytex, you'll never again have to deal with missing packages)
The error messages above should no longer appear for anyone who is trying to knit a pdf with RMarkdown based on the feed at https://github.com/yihui/tinytex/issues/293. TeX Live released their 2022 version on April 3, so there is a window of time where tinytex needs to update.
One could also use #samcarter_is_at_topanswers.xyz recommendations and install TeX Live 2022 themselves (https://tug.org/texlive/acquire-netinstall.html), and update their path within RStudio (How to teach R find the texlive directory when using rstudio?).
I am learning data science with python and R, in my first course i downloaded python3, R and Rstudio and in the current course i am learning using jupyter and downloaded anaconda to handle jupyter notebook. when i tried to convert .ipyth file to PDF i ran into the following error message
nbconvert failed: PDF creating failed, captured latex output:
Failed to run "xelatex .\notebook.tex -quiet" command:
This is XeTeX, Version 3.14159265-2.6-0.999992 (TeX Live 2020/W32TeX) (preloaded format=xelatex)
restricted \write18 enabled.
entering extended mode
! Undefined control sequence.
<*> .\notebook
.tex -quiet
?
! Emergency stop.
<*> .\notebook
.tex -quiet
No pages of output.
Transcript written on ?.
Appreciate your support taking in consideration that i am new to programming
Unfortunately, there's very little maintenance of LaTeX in nbconvert -- LaTeX conversions are a complex beast and there's not someone keeping it fed overtime for all the many edge cases and build tool changes.
There is a new webpdf conversion using chromium to generate PDF files coming in 6.0, which trades off some of the flexibility of xelatex / pandoc for consistency with web renderings (and a new optional dependency).
(source: GitHub)
The maintainers are trying to get the last of issues resolved for a final release our of alpha for 6.0. There's just not many of us with a lot of free time to contribute.
BTW what worked for me is to first download the .ipynb file as ".Tex" file and then converting that .Tex file into .pdf
Open cmd and run the following code there:
pip install nbconvert==5.4.1
This solved my issue.
P.S. you may try the latest version.
Source: https://github.com/jupyter/notebook/issues/3629#issuecomment-482692594
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.