berkeley-dsep-infra / datahub

JupyterHubs for use by Berkeley enrolled students
https://docs.datahub.berkeley.edu
BSD 3-Clause "New" or "Revised" License
64 stars 39 forks source link

Outdated TexLive + Missing Package #3338

Closed geneh0 closed 2 years ago

geneh0 commented 2 years ago

Bug description

Students are unable to knit to PDF and get the error below.

I don't think it's actually the outdated TexLive, but somehow amsmath.sty is missing now.

A new version of TeX Live has been released. If you need to install or update any LaTeX packages, you have to upgrade TeX Live.

tlmgr: 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 `amsmath.sty' not found.

! Emergency stop.
<read *> 

Error: LaTeX failed to compile lab08.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See lab08.log for more info.
In addition: Warning messages:
1: In system("timedatectl", intern = TRUE) :
  running command 'timedatectl' had status 1
2: In system2("tlmgr", args, ...) :
  running command ''tlmgr' search --file --global '/amsmath.sty'' had status 1
Execution halted

I ran kpsewhich amsmath.sty and there is no output.

Environment & setup

How to reproduce

Try knitting to PDF via the one-click interface.

geneh0 commented 2 years ago

@cdbeon Just so you're aware too

ryanlovett commented 2 years ago

In the stat20 hub, which like publichealth also uses geospatial as the base Docker image, we install/update LaTeX packages with tlmgr in the Dockerfile.

felder commented 2 years ago

@geneh0 can you please provide some steps I can use to reproduce this issue?

Alternatively I can make the change described by @ryanlovett to upgrade ansmath and let you know when it has been deployed to the staging environment so you can test.

felder commented 2 years ago

@ryanlovett actually I think stat20 is also likely to fail.

Apparently texlive updates every year in early April: https://www.tug.org/texlive/

I think the right solution is to instruct tlmgr to use the previous repo. https://www.tug.org/historic/

Trying the following in staging: tlmgr repository add https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2021/tlnet-final tlmgr option repository https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2021/tlnet-final tlmgr --verify-repo=none update --self && tlmgr --verify-repo=none install amsmath

====

rstudio@jupyter-felder:~$ tlmgr repository add https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2021/tlnet-final
tlmgr: added repository: https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2021/tlnet-final
rstudio@jupyter-felder:~$ tlmgr option repository https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2021/tlnet-final
tlmgr: setting default package repository to https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2021/tlnet-final
tlmgr: updating /usr/local/texlive/tlpkg/texlive.tlpdb
rstudio@jupyter-felder:~$ tlmgr --verify-repo=none update --self && tlmgr --verify-repo=none install amsmath
TeX Live 2021 is frozen
and will no longer be routinely updated.  This happens when a new
release is made, or will be made shortly.

If you're willing to help with pretesting a new release, and we hope
you are, please see https://tug.org/texlive/pretest.html.

For general status information about TeX Live, see its home page:
https://tug.org/texlive

tlmgr: package repository https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2021/tlnet-final (not verified: gpg unavailable)
tlmgr: saving backups to /usr/local/texlive/tlpkg/backups
tlmgr: no self-updates for tlmgr available
TeX Live 2021 is frozen
and will no longer be routinely updated.  This happens when a new
release is made, or will be made shortly.

If you're willing to help with pretesting a new release, and we hope
you are, please see https://tug.org/texlive/pretest.html.

For general status information about TeX Live, see its home page:
https://tug.org/texlive

tlmgr: package repository https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2021/tlnet-final (not verified: gpg unavailable)
[1/1, ??:??/??:??] install: amsmath [31k]
running mktexlsr ...
done running mktexlsr.
running mtxrun --generate ...
done running mtxrun --generate.
tlmgr: package log updated: /opt/texlive/texmf-var/web2c/tlmgr.log
tlmgr: command log updated: /opt/texlive/texmf-var/web2c/tlmgr-commands.log
rstudio@jupyter-felder:~$
felder commented 2 years ago

@geneh0 running the commands I listed in the previous comment seems to result in the proper package being installed. Can you please try similar in your environment and see if it works? If your tests indicate success, I'll make the changes to the Dockerfile.

ryanlovett commented 2 years ago

@felder Ah, thanks for the heads up! I think these issues will go away when the images are rebased on repo2docker.

Edit: @felder if/when you make a PR to publichealth, would you mind doing the same for stat20?

felder commented 2 years ago

@ryanlovett I just added a bit more to my comment above. Assuming this recipe works here, we'll probably want to update stat20's Dockerfile as well.

geneh0 commented 2 years ago

@felder I'm able to successfully knit after running the commands your previous comment. This is the sample document that I was using to test that didn't work before. However, I am noticing that it takes significantly longer to knit than expected.

felder commented 2 years ago

@geneh0 Using the sample document I can see what you're saying. I think the issue is it's installing a bunch of packages and making you wait for that.

Clicking knit a second time after the first results in much faster rendering. I think if I have it install the missing packages it should make it faster. However, I am a bit confused as to why it's needing to do this now when it wasn't before. I'm going to look into that.

felder commented 2 years ago

This is the list of packages that it pulls in.

amsmath latex-amsmath-dev iftex kvoptions ltxcmds kvsetkeys etoolbox xcolor auxhook bigintcalc bitset etexcmds gettitlestring hycolor hyperref intcalc kvdefinekeys letltxmacro pdfescape refcount rerunfilecheck stringenc uniquecounter zapfding pdftexcmds infwarerr geometry epstopdf-pkg

felder commented 2 years ago

@geneh0 I have fix queued up for this and I believe it will work, but unfortunately #3342 is keeping me from implementing it.

In the meantime, while I understand this is less than ideal, a workaround is to have students add the old repo as described above each time they launch their server and knit.

geneh0 commented 2 years ago

@felder Great! However, I'm not sure I understand the implication of the impact of #3342 on this.

But also for other folks who might be running into similar problems, I think running tinytex::tlmgr_update() in the R console will get rid of the latex errors temporarily. I don't think this fix or the one mentioned previously are sustainable given the population of students we work it.

felder commented 2 years ago

@geneh0 the implication of #3342 is that I cannot currently update the server image to incorporate the fix described above.

I understand the workaround is not sustainable. We are working on resolving #3342 as quickly as we can.

felder commented 2 years ago

ischool is the only other hub other than stat20 and publichealth that is based on geospatial.

ischool does not require ottr, so I should be able to fix it.

felder commented 2 years ago

@geneh0 ok I think I've pushed a fix for this. Please restart your server and try to knit.

When I knit using the sample document you provided, it's nearly instantaneous.

ottr works too:

> library(ottr)
> sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.4 LTS

Matrix products: default
BLAS/LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.8.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
 [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] ottr_0.1.0

loaded via a namespace (and not attached):
[1] compiler_4.1.2 tools_4.1.2   
felder commented 2 years ago

It is my belief this is fixed. Please reopen the issue if it is not.

geneh0 commented 2 years ago

It looks like the folks I've talked to have been able to knit. Thank you!