quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.59k stars 295 forks source link

detect tlmgr issue and refresh installation info #7252

Closed cderv closed 7 months ago

cderv commented 9 months ago

We start seeing in our CI

compilation failed- tlmgr needs to be updated, but the update failed
    LaTeX Error: Mismatched LaTeX support files detected.
    (LaTeX)        Loading 'expl3.sty' aborted!
    (LaTeX)        
    (LaTeX)        The L3 programming layer in the LaTeX format
    (LaTeX)        is dated [202](https://github.com/quarto-dev/quarto-cli/actions/runs/6547127605/job/17779023801#step:25:203)3-08-29, but in your TeX tree the files require
    (LaTeX)        at least 2023-10-10.

    For immediate help type H <return>.

This is a know issue that requires some refreshing. We have seen the issue with tinytex

We probably need to implement the same detection and commands to run.

yihui commented 9 months ago

FYI I have tried TinyTeX v2023.10 on macOS to render plos and jss templates in Quarto, but was unable to reproduce the problem. I'll see if it's possible to reproduce the problem on Ubuntu.

kompre commented 9 months ago

I've got that error message on my windows machine, that run quarto 1.3.450. I am not sure how to fix that on my windows machine (I don't use/have Rstudio)

mcanouil commented 9 months ago

I got it on macOS but before the issue was open so cannot really reproduce. At that time I was running the september version of TinyTex.

@kompre The following should solve the issue, assuming you installed TinyTex using Quarto.

quarto update tinytex
cderv commented 9 months ago

As described in https://github.com/rstudio/tinytex/issues/424 the issue is more complex than that, and updating may (or may not) solve the issue. Our CI runs was failing with the latest TinyTeX install using quarto from october. And now more issue.... So not sure to understand what is causing it. (maybe an order of updating packages.... ๐Ÿค” )

Anyhow, using TinyTeX daily builds is the best way to avoid this. We are still looking on how to correctly detect and help fix this. (which would be automatically running in Quarto, the equivalent from R world which is tinytex:::refresh_all())

kompre commented 9 months ago

I got it on macOS but before the issue was open so cannot really reproduce. At that time I was running the september version of TinyTex.

@kompre The following should solve the issue, assuming you installed TinyTex using Quarto.

quarto update tinytex

thanks, this worked

cderv commented 9 months ago

Awesome. Good to know !

But this makes this issue even less reproducible ๐Ÿ˜ž - really not sure what is happening. We'll leave that open an see if it happens again

yihui commented 9 months ago

I have also tried on Ubuntu and was still unable to reproduce the problem. It's really odd. It seems that this problem has also gone in GHA: https://github.com/quarto-dev/quarto-cli/actions/workflows/test-smokes-parallel.yml?query=branch%3Amain

yihui commented 9 months ago

I have finally figured out how to reproduce this problem. I think it was caused by Quarto's lack of running fmtutil-sys, which was done in the R package tinytex via https://github.com/rstudio/tinytex/commit/5946a2a1bf3c6ecefbd1213178a4e473ff4c26dc. In tinytex, before installing a missing LaTeX package, I'll check if it has already been installed (in this case, l3kernel). If it has, I'll run tinytex::tlmgr_update() first, which runs fmtutil-sys --all by default, which fixes the l3kernel version mismatch problem.

Running tlmgr update --all without fmtutil-sys --all should be the reason why TinyTeX got into a broken state, which also made it fail to render R Markdown documents. Although @wesleyburr reported that Quarto could be isolated from the problem (https://github.com/rstudio/tinytex/issues/424#issuecomment-1761658222), I'm reasonably sure it was Quarto that first brought TinyTeX into a broken state.

I think it suffices to run fmtutil-sys. Other commands in tinytex::refresh_all() should be unnecessary to fix this problem.

cderv commented 9 months ago

Thanks @yihui for looking into this ! I'll do the addition then

For context:

cderv commented 9 months ago

And this is happening again... so really need to fix it. https://github.com/quarto-dev/quarto-cli/actions/runs/6573498110/job/17856675407?pr=7288#step:26:370

yihui commented 9 months ago

https://github.com/rstudio/tinytex/commit/3495cb88d8e059afbe443f09370f0dcbfb9e44d0 should be unnecessary but harmless to do.

kompre commented 8 months ago

The issue happening again, moving the goal

with lualatex:

compilation failed- error
LaTeX Error: Mismatched LaTeX support files detected.
(LaTeX)        Loading 'expl3.sty' aborted!
(LaTeX)
(LaTeX)        The L3 programming layer in the LaTeX format
(LaTeX)        is dated 2023-10-10, but in your TeX tree the files require
(LaTeX)        at least 2023-10-23.

For immediate help type H <return>.
 ...

l.78      \ExplLoaderFileDate{expl3.sty}}

This time quarto update tynitex is not working because is already up to date.

With xelatex I get a more obscure error, but I think could be related:

compilation failed- error
Incomplete \ifx; all text was ignored after line 282.
<inserted text>
                \fi
l.2271   \input xebabel.def

The document export fine in html.

This is really a bad issue if it happen so regularly. It means quarto cannot be trusted to develop pdf document because I can be found in a situation where I need to deliver the pdf document, but cannot for reason largely out of my control.

yihui commented 8 months ago

@kompre If you run tinytex:::fmtutil() in R, the problem should be resolved.

kompre commented 8 months ago

@kompre If you run tinytex:::fmtutil() in R, the problem should be resolved.

I don't have R installed, nor I'm familiar with it.

Is there another way? Otherwise it would be much appreciated to have detailed instruction. For example I can install just R without Rstudio and launch that command from a terminal running R?

I'm on a windows machine.

yihui commented 8 months ago

Yes, you may run fmtutil-sys --all in the terminal (or command window). You don't need to install R at all (the R function I mentioned essentially runs fmtutil-sys --all).

Eventually this problem should be solved in Quarto and won't require users to do anything.

kompre commented 8 months ago

Yes, you may run fmtutil-sys --all in the terminal (or command window). You don't need to install R at all (the R function I mentioned essentially runs fmtutil-sys --all).

I've tried to run this command, but I get an error, and problem is not fixed. Here are the step I took:

  1. Open powershell (either in administrative or normal mode, didn't make a difference)
  2. type fmtutil-sys --all --> command not found
  3. search for fmtutil-sys.exe and found one match in "C:\Users\kompre\AppData\Roaming\TinyTeX\bin\windows"
  4. open the terminal in the folder containing fmtutil-sys.exe ans run .\fmtutil-sys.exe --all --> bunch of text get dumped to terminal, which end up with the following error:
fmtutil [INFO]: log file copied to: c:/users/kompre/appdata/roaming/tinytex/texmf-var/web2c/pdftex/pdflatex.log
fmtutil [INFO]: c:/users/kompre/appdata/roaming/tinytex/texmf-var/web2c/pdftex/pdflatex.fmt installed.
fmtutil [ERROR]: running `luahbtex -ini   -jobname=lualatex -progname=lualatex lualatex.ini <nul' return status: 1
fmtutil [ERROR]: returning error due to option --strict
fmtutil [ERROR]: running `luatex -ini   -jobname=dvilualatex -progname=dvilualatex dvilualatex.ini <nul' return status: 1
fmtutil [ERROR]: returning error due to option --strict
fmtutil [INFO]: successfully rebuilt formats: 12
fmtutil [INFO]: failed to build: 2 (luahbtex/lualatex luatex/dvilualatex)
fmtutil [INFO]: total formats: 14
fmtutil [INFO]: exiting with status 2
...kompre\AppData\Roaming\TinyTeX\bin\windows\runscript.tlu:921: command failed with exit code 2:
perl.exe c:\Users\kompre\AppData\Roaming\TinyTeX\texmf-dist\scripts\texlive\fmtutil.pl  --sys --all
cderv commented 8 months ago

For reference, interestingly this should have been solved by

following initial report at

Error is now different as it is not thrown from the same step

compilation failed- tlmgr needs to be updated, but the update failed

So something else is in play here. For sure we don't run fmtutil-sys currently, so that could be the missing piece.

cderv commented 8 months ago

@kompre I cannot reproduce your error exactly on my Windows. Using command line, it is working well for me.

I have a PR in process that should do the right thing for Quarto. Though you should be able to make your texlive install work right without it.

You could reinstall tinytex if possible though, this could solve this specific issue (due to some outdated thing in the install)

kompre commented 8 months ago

You could reinstall tinytex if possible though, this could solve this specific issue (due to some outdated thing in the install)

This has worked, thanks.

By the way, reinstalling tinytex I noticed that it defaults to IOWA mirror. Should I care to change for a mirror closer to my zone? like something in europe?

Just for reference i'll paste the output of the cli:

PS C:\Users\kompre> quarto uninstall tinytex
A new release of Deno is available: 1.28.2 โ†’ 1.37.2 Run `deno upgrade` to install it.
 ? Are you sure you'd like to remove tinytex? (Y/n) ยป Yes

Uninstalling tinytex
[>] Removing directory
Uninstallation successful
PS C:\Users\kompre> quarto install tinytex
A new release of Deno is available: 1.28.2 โ†’ 1.37.2 Run `deno upgrade` to install it.
Installing tinytex
[>] Downloading TinyTex v2023.10
[>] Unzipping TinyTeX-v2023.10.zip
[>] Moving files
[>] Verifying tlgpg support
[>] Default Repository: https://mirror.las.iastate.edu/tex-archive/systems/texlive/tlnet/
Installation successful
PS C:\Users\kompre>
yihui commented 8 months ago

You can use the command tlmgr option repository MIRROR, e.g.,

tlmgr option repository https://ctan.ebinger.cc/tex-archive/systems/texlive/tlnet

Make sure the URL points to /systems/texlive/tlnet. European mirrors can be found at https://ctan.org/mirrors#Europe (Alert: currently the CTAN website may look and sound spooky due to Halloween)

kompre commented 8 months ago

You could reinstall tinytex if possible though, this could solve this specific issue (due to some outdated thing in the install)

This has worked, thanks.

By the way, reinstalling tinytex I noticed that it defaults to IOWA mirror. Should I care to change for a mirror closer to my zone? like something in europe?

Just for reference i'll paste the output of the cli:

PS C:\Users\kompre> quarto uninstall tinytex
A new release of Deno is available: 1.28.2 โ†’ 1.37.2 Run `deno upgrade` to install it.
 ? Are you sure you'd like to remove tinytex? (Y/n) ยป Yes

Uninstalling tinytex
[>] Removing directory
Uninstallation successful
PS C:\Users\kompre> quarto install tinytex
A new release of Deno is available: 1.28.2 โ†’ 1.37.2 Run `deno upgrade` to install it.
Installing tinytex
[>] Downloading TinyTex v2023.10
[>] Unzipping TinyTeX-v2023.10.zip
[>] Moving files
[>] Verifying tlgpg support
[>] Default Repository: https://mirror.las.iastate.edu/tex-archive/systems/texlive/tlnet/
Installation successful
PS C:\Users\kompre>

Well this fix didn't last half an hour... ๐Ÿ˜…

I tried to build the pdf preview of a document and after the first xelatex pass, the tlmgr updated again and, lo and behold, expl3.sty was mismatched again.

I noticed that the tlmgr update message usually happens when there is some ill formatted latex in the document and it takes a fairly long time to execute. Indeed I can guess when a preview won't render by how long time it takes from the first pass to get to second pass.

Luckily uninstall/reinstalling again tinytex re-fixed it. I've tried to purposely feed some broken latex to it, but while the tlmgr update took place, it didn't broke.

cderv commented 8 months ago

@kompre I have merged the PR that I did to try fix this. You can access it if you use development version. Otherwise, you need to wait for the next pre-release build, probably later today.

Hope this will solve this

cderv commented 8 months ago

@kompre the fix have been included in v1.4.467 of Quarto. Did you try again since then ?

Thanks

kompre commented 7 months ago

I'm still on the stable release. I'm still no confident enough to rock the pre-release.

cderv commented 7 months ago

Oh ok. Know that you can have several version installed at the same time if you use a portable version by unzipping.

You are on Windows I believe, so this is as easy as download the zip bundle anywhere, and run quarto.exe using full path to this unzipped folder.

Otherwise, tools like Scoop (https://scoop.sh/#/) can help you live with several version (https://github.com/cderv/r-bucket#quarto-cli) or directly Quarto Version Manager (https://github.com/dpastoor/qvm)

Anyhow, don't feel pressure to test - we'll see at next release then.

cderv commented 7 months ago

I believe this is fixed, so I'll close. We'll reopen if not.