MiKTeX / docker-miktex

the Docker image for running MiKTeX
41 stars 28 forks source link

ERROR: ! LaTeX requires expl3. #21

Closed RobertHeim closed 3 years ago

RobertHeim commented 3 years ago

Trying to run pdflatex with

  MIKTEX_GID: 1111
  MIKTEX_UID: 1111

gives an error

ERROR initexmf - sub-process error output has been saved to '/miktex/.miktex/texmfs/data/miktex/log/miktex-makefmt_2020-11-04-140546.out'

The *.out file contains this error:

starting package maintenance...
installation directory: /miktex/.miktex/texmfs/install
package repository: https://ctan.kako-dev.de/systems/win32/miktex/tm/packages/
package repository digest: 229929f9cc3ef2c0aa1088f4966556a1
going to download 23141478 bytes
going to install 215 file(s) (1 package(s))
downloading https://ctan.kako-dev.de/systems/win32/miktex/tm/packages/ltxbase.tar.lzma...
23.14 MB, 92.64 Mbit/s
extracting files from ltxbase.tar.lzma...
======================================================================
(/miktex/.miktex/texmfs/install/tex/latex/base/latex.ltx
(/miktex/.miktex/texmfs/install/tex/latex/base/texsys.cfg)
./texsys.aux found
\@currdir set to: ./.
Assuming \openin and \input 
have the same search path.
Defining UNIX/DOS style filename parser.
catcodes, registers, parameters,
LaTeX2e <2020-10-01> patch level 2
! LaTeX requires expl3.
<argument> \errmessage {LaTeX requires expl3}
                                             \batchmode \read -1 to \reserve...
l.1061   }

!  ==> Fatal error occurred, no output PDF file produced!

How can we fix it?

RobertHeim commented 3 years ago

Actually, we were able to install it using mpm --install=expl3 before running pdflatex. However, we then ended up understanding that the on-the-fly installation does not work, because we would see that error for all packages.

We then tried to install all packages upfront using mpm --install=packagelist. But it turns out that most packages can not be found. Checking the repositories mpm --list-repositories reports a valid and fine list.

So consequently, the issue seemed to be an outdated local db - we can fix that using mpm --update-db. Now the install would work - nice, but unfortunately the mpm --install=packaglist would fail because some packages of our huge list have already been installed. So we then could maybe use mpm --require=packaglist instead - but wait - if the core issue was an outdated package list (cf. #7) and we just fixed that, then that might have resolve the original issue?

YES - it does!

We just removed all mpm --instsall=... stuff and on the fly installation now works fine! :)

Note that for CI builds it might still be a good idea to install packages upfront and use some kind of caching (#22 ) of the packages or even build an own Dockerfile that includes the required packages upfront.

Since during research we found many people struggeling to use the image for CI but are actually trying to do it, we might want to explain that on the README?

For gitlab this works for us (where the Makefile just runs pdflatex main.tex):

image: miktex/miktex

variables:
  MIKTEX_GID: 1111
  MIKTEX_UID: 1111

build:
  script:
    - mpm --update-db
    - make
# if something goes wrong on CI this might be very helpful:
#  after_script:
#    - cat /miktex/.miktex/texmfs/data/miktex/log/*.log
#    - cat /miktex/.miktex/texmfs/data/miktex/log/*.out
  artifacts:
    paths:
      - "*.pdf"
georgealverson commented 3 years ago

I had the same problem and this fixed it.

Thank you, Robert.