rstudio / rmarkdown

Dynamic Documents for R
https://rmarkdown.rstudio.com
GNU General Public License v3.0
2.88k stars 979 forks source link

Can't knit to Pdf in RStudio Mac version 1.4.1103 #2143

Closed pleasehelpmeeee closed 2 years ago

pleasehelpmeeee commented 3 years ago

I'm having troubles with knitting to pdf. i get the following errors:

This is pdfTeX, Version 3.141592653-2.6-1.40.22 (TeX Live 2021) (preloaded format=pdflatex) restricted \write18 enabled. entering extended mode tlmgr search --file --global '/multirow.sty' Trying to automatically install missing LaTeX packages... tlmgr install multirow tlmgr: package repository https://ctan.math.illinois.edu/systems/texlive/tlnet (not verified: gpg unavailable) [1/1, ??:??/??:??] install: multirow [3k] TLPDB::_install_data: unsupported container format xz for https://ctan.math.illinois.edu/systems/texlive/tlnet/archive/multirow.tar.xz tlmgr: package log updated: /Users/name/Library/TinyTeX/texmf-var/web2c/tlmgr.log tlmgr update --self tlmgr install multirow tlmgr: package repository https://ctan.math.illinois.edu/systems/texlive/tlnet (not verified: gpg unavailable) [1/1, ??:??/??:??] install: multirow [3k] tlmgr: package log updated: /Users/name/Library/TinyTeX/texmf-var/web2c/tlmgr.log TLPDB::_install_data: unsupported container format xz for https://ctan.math.illinois.edu/systems/texlive/tlnet/archive/multirow.tar.xz This is pdfTeX, Version 3.141592653-2.6-1.40.22 (TeX Live 2021) (preloaded format=pdflatex) restricted \write18 enabled. entering extended mode tlmgr search --file --global '/multirow.sty' ! LaTeX Error: File `multirow.sty' not found.

! Emergency stop. <read *>

Error: LaTeX failed to compile vignettes.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See vignettes.log for more info. Execution halted

When i check out the vignettes.log file, it says:

! LaTeX Error: File `multirow.sty' not found.

I tried installing it by running this code:

install.packages("http://mirrors.ctan.org/macros/latex/contrib/multirow.zip")

But i get the following error: Warning in install.packages : package ‘http://mirrors.ctan.org/macros/latex/contrib/multirow.zip’ is not available for this version of R

A version of this package for your version of R might be available elsewhere, see the ideas at https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages

I also went through the steps outlined in https://yihui.org/tinytex/r/#debugging but it still doesnt work.

I appreciate any help that anyone can offer!

Added info:

xfun::session_info('rmarkdown')

R version 4.0.3 (2020-10-10) Platform: x86_64-apple-darwin17.0 (64-bit) Running under: macOS High Sierra 10.13.6, RStudio 1.4.1103

Locale: en_CA.UTF-8 / en_CA.UTF-8 / en_CA.UTF-8 / C / en_CA.UTF-8 / en_CA.UTF-8

Package version: base64enc_0.1.3 digest_0.6.27 evaluate_0.14
glue_1.4.2 graphics_4.0.3 grDevices_4.0.3
highr_0.9 htmltools_0.5.1.1 jsonlite_1.7.2
knitr_1.33 magrittr_2.0.1 markdown_1.1
methods_4.0.3 mime_0.10 rlang_0.4.11
rmarkdown_2.8 stats_4.0.3 stringi_1.6.2
stringr_1.4.0 tinytex_0.31 tools_4.0.3
utils_4.0.3 xfun_0.23 yaml_2.2.1

Pandoc version: 2.11.2

I also tried downloading multirows from this website https://ctan.org/tex-archive/macros/latex/contrib/multirow?lang=en and then moving the folder into the appropriate destination and it didnt work.

Checklist

When filing a bug report, please check the boxes below to confirm that you have provided us with the information we need. Have you:

yihui commented 3 years ago

Please do not omit the checklist in the issue guide when filing issues: https://github.com/rstudio/rmarkdown/issues/new?assignees=&labels=&template=bug-report.md&title= Could you add all the info required by the issue guide? Without the info, it's hard to tell what the problem is.

BTW, multirows is a LaTeX package, not an R package. You can't use install.packages() to install LaTeX packages. Again, we need a reprex and session info as required by the issue guide so we can investigate.

pleasehelpmeeee commented 3 years ago

Please do not omit the checklist in the issue guide when filing issues: https://github.com/rstudio/rmarkdown/issues/new?assignees=&labels=&template=bug-report.md&title= Could you add all the info required by the issue guide? Without the info, it's hard to tell what the problem is.

BTW, multirows is a LaTeX package, not an R package. You can't use install.packages() to install LaTeX packages. Again, we need a reprex and session info as required by the issue guide so we can investigate.

Thanks, yihui. I updated my post. this is my first time posting, so thank you for your patience!

yihui commented 3 years ago

this is my first time posting

That's okay. If you open the issue guide I mentioned above, you will find the checklist (which requires a minimal reproducible example, which I also asked for above but didn't get):

Checklist

When filing a bug report, please check the boxes below to confirm that you have provided us with the information we need. Have you:

pleasehelpmeeee commented 3 years ago

this is my first time posting

That's okay. If you open the issue guide I mentioned above, you will find the checklist (which requires a minimal reproducible example, which I also asked for above but didn't get):

Checklist

When filing a bug report, please check the boxes below to confirm that you have provided us with the information we need. Have you:

  • [ ] formatted your issue so it is easier for us to read?
  • [ ] included a minimal, self-contained, and reproducible example?
  • [ ] pasted the output from xfun::session_info('rmarkdown') in your issue?
  • [ ] upgraded all your packages to their latest versions (including your versions of R, the RStudio IDE, and relevant R packages)?
  • [ ] installed and tested your bug with the development version of the rmarkdown package using remotes::install_github("rstudio/rmarkdown") ?

Is this what you mean??? adding the checklist at the bottom and checking it off?

yihui commented 3 years ago

Yes, but if you are really busy or don't understand what the checklist means, the most important item is the second one:

include a minimal, self-contained, and reproducible example

It's often very hard to help users if we are not told how to reproduce the problem.

cderv commented 3 years ago

Just to give some context regarding your error.

So here it is an issue with installation a package from CTAN to use with LaTeX. Sometimes these error can be related to the mirror used and can be solved by themselves with time.

To install a package from CTAN manually you can do

tinytex::tlmgr_install("multirow")

You may retry in case it was a mirror issue.

yihui commented 3 years ago

Since this is not the first time I have seen this issue (e.g. https://github.com/yihui/tinytex/issues/81#issuecomment-815013443), I'd really like to figure out why it happens, hence I need to know how to reproduce the problem, but so far no one has provided a reproducible example.

cderv commented 3 years ago

Yeah I tried to reproduce by changing the CTAN repo but I can't reproduce. If it is related to CTAN mirror and temporary (during sync ?), it will not be easy to reproduce.

The error message does not get me much luck on the web, except for xz format not being a supported one on Windows for example. But I have no issue downloading the multirow and installing

pleasehelpmeeee commented 3 years ago

I created a fake dataset and tried running it again and it still doesn't work. This is my code:

---
title: "Untitled"
author: "name"
date: "21/05/2021"
output:
  pdf_document: default
  html_document: default
---
```{r data set up}

setwd("~/Desktop/School")

data<-read.csv("Testdata.csv")

library(lme4)
model1<-lmer(Estability~ 1+(1|Supervisor_ID), data=data)
library(jtools)
summ(model1)

This is what the RMarkdown tab says:

processing file: Untitled.Rmd |.............. | 20% ordinary text without R code

|............................ | 40% label: data set up |.......................................... | 60% ordinary text without R code

|........................................................ | 80% label: icc |......................................................................| 100% ordinary text without R code

/Applications/RStudio.app/Contents/MacOS/pandoc/pandoc +RTS -K512m -RTS Untitled.knit.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output Untitled.tex --lua-filter /Users/name/Library/R/4.0/library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /Users/name/Library/R/4.0/library/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --highlight-style tango --pdf-engine pdflatex --variable graphics --variable 'geometry:margin=1in' --include-in-header /var/folders/w1/b523f8l940l7xgngkhzymzgh0000gn/T//Rtmp02YvI0/rmarkdown-str9c007dcd654.html output file: Untitled.knit.md

tlmgr: package repository https://ctan.math.illinois.edu/systems/texlive/tlnet (not verified: gpg unavailable) [1/1, ??:??/??:??] install: multirow [3k] TLPDB::_install_data: unsupported container format xz for https://ctan.math.illinois.edu/systems/texlive/tlnet/archive/multirow.tar.xz tlmgr: package log updated: /Users/name/Library/TinyTeX/texmf-var/web2c/tlmgr.log tlmgr update --self sh: fmtutil-sys: command not found tlmgr: package repository https://ctan.math.illinois.edu/systems/texlive/tlnet (not verified: gpg unavailable) [1/1, ??:??/??:??] install: multirow [3k] TLPDB::_install_data: unsupported container format xz for https://ctan.math.illinois.edu/systems/texlive/tlnet/archive/multirow.tar.xz tlmgr: package log updated: /Users/name/Library/TinyTeX/texmf-var/web2c/tlmgr.log ! LaTeX Error: File `multirow.sty' not found.

! Emergency stop. <read *>

Error: LaTeX failed to compile Untitled.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Untitled.log for more info. In addition: Warning message: In system2(if (usermode) "fmtutil-user" else "fmtutil-sys", "--all", : ​error in running command Execution halted



After i have failed knitting, it still gives me 2 files:

![image](https://user-images.githubusercontent.com/84544406/119181439-9b87b400-ba3f-11eb-9fcf-0810cd92f7ac.png)
yihui commented 3 years ago

We don't have your ~/Desktop/School folder or Testdata.csv (in other words, your example is not self-contained). If the problem occurs for any lmer() models, could you use an example dataset in the lme4 package?

pleasehelpmeeee commented 3 years ago

Here is an example using the dataset called "cake" in the lme4 package.


library(lme4)
model1<-lmer(angle~ recipe + temperature +(1|recipe:replicate),cake)
library(jtools)
summ(model1)

This is what the RMarkdown tab says when i try knitting to PDF:




processing file: Untitled.Rmd
  |.......................                                               |  33%
  ordinary text without R code

  |...............................................                       |  67%
label: icc
  |......................................................................| 100%
  ordinary text without R code

output file: Untitled.knit.md

/Applications/RStudio.app/Contents/MacOS/pandoc/pandoc +RTS -K512m -RTS Untitled.knit.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output Untitled.tex --lua-filter /Users/name/Library/R/4.0/library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /Users/name/Library/R/4.0/library/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --highlight-style tango --pdf-engine pdflatex --variable graphics --variable 'geometry:margin=1in' --include-in-header /var/folders/w1/b523f8l940l7xgngkhzymzgh0000gn/T//RtmpmHtyAR/rmarkdown-strd23774c26c5.html 
tlmgr: package repository https://ctan.math.illinois.edu/systems/texlive/tlnet (not verified: gpg unavailable)
[1/1, ??:??/??:??] install: multirow [3k]
TLPDB::_install_data: unsupported container format xz for https://ctan.math.illinois.edu/systems/texlive/tlnet/archive/multirow.tar.xz
tlmgr: package log updated: /Users/name/Library/TinyTeX/texmf-var/web2c/tlmgr.log
tlmgr update --self
sh: fmtutil-sys: command not found
tlmgr: package repository https://ctan.math.illinois.edu/systems/texlive/tlnet (not verified: gpg unavailable)
[1/1, ??:??/??:??] install: multirow [3k]
TLPDB::_install_data: unsupported container format xz for https://ctan.math.illinois.edu/systems/texlive/tlnet/archive/multirow.tar.xz
tlmgr: package log updated: /Users/name/Library/TinyTeX/texmf-var/web2c/tlmgr.log
! LaTeX Error: File `multirow.sty' not found.

! Emergency stop.
<read *> 

Error: LaTeX failed to compile Untitled.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Untitled.log for more info.
In addition: Warning message:
In system2(if (usermode) "fmtutil-user" else "fmtutil-sys", "--all",  :
  error in running command
Execution halted
pleasehelpmeeee commented 3 years ago

We don't have your ~/Desktop/School folder or Testdata.csv (in other words, your example is not self-contained). If the problem occurs for any lmer() models, could you use an example dataset in the lme4 package?

given your non-response, I assume there’s no solution?

yihui commented 3 years ago

@pleasehelpmeeee I'm still unable to reproduce your problem. Have you tried the debugging steps at https://yihui.org/tinytex/r/#debugging? In particular, did you try to reinstall TinyTeX?

tinytex::reinstall_tinytex()

I suspect that this is a temporary issue, but I'm not able to reproduce it, and it's often hard to fix issues that are not reproducible.

pleasehelpmeeee commented 3 years ago

@pleasehelpmeeee I'm still unable to reproduce your problem. Have you tried the debugging steps at https://yihui.org/tinytex/r/#debugging? In particular, did you try to reinstall TinyTeX?

tinytex::reinstall_tinytex()

I suspect that this is a temporary issue, but I'm not able to reproduce it, and it's often hard to fix issues that are not reproducible.

Yes I’ve already tried that. Have you tried reproducing it on a Mac computer?

yihui commented 3 years ago

Yes, I'm on a Macbook. Do you have this file?

ls -lh ~/Library/TinyTeX/tlpkg/installer/xz/

-rwxr-xr-x  1 user  staff   425K Feb 25 12:01 xz.universal-darwin
pleasehelpmeeee commented 3 years ago

Yes, I'm on a Macbook. Do you have this file?

ls -lh ~/Library/TinyTeX/tlpkg/installer/xz/

-rwxr-xr-x  1 user  staff   425K Feb 25 12:01 xz.universal-darwin

No i do not. This is all that's in that folder:Screen Shot 2021-06-14 at 1 41 51 PM

yihui commented 3 years ago

You were looking at the R package folder, but I meant the TinyTeX folder, i.e., you run the command in your terminal:

ls -lh ~/Library/TinyTeX/tlpkg/installer/xz/
pleasehelpmeeee commented 3 years ago

You were looking at the R package folder, but I meant the TinyTeX folder, i.e., you run the command in your terminal:

ls -lh ~/Library/TinyTeX/tlpkg/installer/xz/

When i run that in the terminal app, it says, "total 856".

It gives me the same thing when i run it in the terminal tab in RStudio

yihui commented 3 years ago

Your TinyTeX installation seems to be broken, but I don't know why.

I'm using macOS Big Sur 11.4, but it should not matter which version of macOS you use.

What's your output of tinytex::reinstall_tinytex()?

pleasehelpmeeee commented 3 years ago

Your TinyTeX installation seems to be broken, but I don't know why.

I'm using macOS Big Sur 11.4, but it should not matter which version of macOS you use.

What's your output of tinytex::reinstall_tinytex()?

nothing happens when i run that. it just starts a new line and has '>'

yihui commented 3 years ago

That's really odd. Are you able to run any R code at all in your R console?

pleasehelpmeeee commented 3 years ago

That's really odd. Are you able to run any R code at all in your R console?

Yes i'm able to run R code.

Screen Shot 2021-06-14 at 5 56 33 PM
yihui commented 3 years ago

Anything happens when you run tinytex::install_tinytex()?

dcaud commented 3 years ago

I was getting a similar error and was unable to output to PDF.

tinytex::install_tinytex() didn't fix it.

But tinytex::reinstall_tinytex() fixed it.

cderv commented 2 years ago

@pleasehelpmeeee is this still an issue ? Can we close this otherwise ?

Thanks.

github-actions[bot] commented 2 years ago

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.