Error showing value of type TikzPicture: The latex command `lualatex' failed

Hello everyone,
I am encountering an issue while using the PGFPlotsX package in Julia to generate a TikzPicture. I am getting an error message that says “The LaTeX command lualatex jl_u5wvs7aPQN.tex failed.

The code:

using PGFPlotsX

@pgf TikzPicture(
        Axis(
            PlotInc({ only_marks },
                Table(; x = 1:2, y = 3:4)),
            PlotInc(
                Table(; x = 5:6, y = 1:2))))

Here are the details of the error:

┌ Warning: failed to find logfile at "C:\\Users\\AGONMU~1\\AppData\\Local\\Temp\\jl_u5wvs7aPQN.log"
└ @ PGFPlotsX C:\Users\Agon Mustafa\.julia\packages\PGFPlotsX\wtVR1\src\build.jl:54
Error showing value of type TikzPicture:
ERROR: The latex command `lualatex jl_u5wvs7aPQN.tex` failed
Stacktrace:
  [1] error(s::String)
    @ Base .\error.jl:35
  [2] savepdf(filename::String, td::TikzDocument; latex_engine::PGFPlotsX.LaTeXEngine, buildflags::Vector{String}, run_count::Int64, tmp::String)
    @ PGFPlotsX C:\Users\Agon Mustafa\.julia\packages\PGFPlotsX\wtVR1\src\tikzdocument.jl:202
  [3] savepdf
    @ C:\Users\Agon Mustafa\.julia\packages\PGFPlotsX\wtVR1\src\tikzdocument.jl:159 [inlined]
  [4] save(filename::String, td::TikzDocument; include_preamble::Bool, latex_engine::PGFPlotsX.LaTeXEngine, buildflags::Vector{String}, dpi::Int64, showing_ide::Bool)
    @ PGFPlotsX C:\Users\Agon Mustafa\.julia\packages\PGFPlotsX\wtVR1\src\tikzdocument.jl:86
  [5] save(filename::String, td::TikzDocument)
    @ PGFPlotsX C:\Users\Agon Mustafa\.julia\packages\PGFPlotsX\wtVR1\src\tikzdocument.jl:67
  [6] #save#68
    @ C:\Users\Agon Mustafa\.julia\packages\PGFPlotsX\wtVR1\src\tikzpicture.jl:34 [inlined]
  [7] save
    @ C:\Users\Agon Mustafa\.julia\packages\PGFPlotsX\wtVR1\src\tikzpicture.jl:33 [inlined]
  [8] display(d::PGFPlotsX.PGFPlotsXDisplay, p::TikzPicture)
    @ PGFPlotsX C:\Users\Agon Mustafa\.julia\packages\PGFPlotsX\wtVR1\src\tikzdocument.jl:355
  [9] display(x::Any)
    @ Base.Multimedia .\multimedia.jl:340
 [10] #invokelatest#2
    @ .\essentials.jl:819 [inlined]
 [11] invokelatest
    @ .\essentials.jl:816 [inlined]
 [12] print_response(errio::IO, response::Any, show_value::Bool, have_color::Bool, specialdisplay::Union{Nothing, AbstractDisplay})
    @ REPL C:\Users\Agon Mustafa\AppData\Local\Programs\Julia-1.9.3\share\julia\stdlib\v1.9\REPL\src\REPL.jl:305
 [13] (::REPL.var"#57#58"{REPL.LineEditREPL, Pair{Any, Bool}, Bool, Bool})(io::Any)
    @ REPL C:\Users\Agon Mustafa\AppData\Local\Programs\Julia-1.9.3\share\julia\stdlib\v1.9\REPL\src\REPL.jl:287
 [14] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL C:\Users\Agon Mustafa\AppData\Local\Programs\Julia-1.9.3\share\julia\stdlib\v1.9\REPL\src\REPL.jl:557
 [15] print_response(repl::REPL.AbstractREPL, response::Any, show_value::Bool, have_color::Bool)
    @ REPL C:\Users\Agon Mustafa\AppData\Local\Programs\Julia-1.9.3\share\julia\stdlib\v1.9\REPL\src\REPL.jl:285
 [16] (::REPL.var"#do_respond#80"{Bool, Bool, REPL.var"#93#103"{REPL.LineEditREPL, REPL.REPLHistoryProvider}, REPL.LineEditREPL, REPL.LineEdit.Prompt})(s::REPL.LineEdit.MIState, buf::Any, ok::Bool)
    @ REPL C:\Users\Agon Mustafa\AppData\Local\Programs\Julia-1.9.3\share\julia\stdlib\v1.9\REPL\src\REPL.jl:899
 [17] #invokelatest#2
    @ .\essentials.jl:819 [inlined]
 [18] invokelatest
    @ .\essentials.jl:816 [inlined]
 [19] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
    @ REPL.LineEdit C:\Users\Agon Mustafa\AppData\Local\Programs\Julia-1.9.3\share\julia\stdlib\v1.9\REPL\src\LineEdit.jl:2647
 [20] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
    @ REPL C:\Users\Agon Mustafa\AppData\Local\Programs\Julia-1.9.3\share\julia\stdlib\v1.9\REPL\src\REPL.jl:1300
 [21] (::REPL.var"#62#68"{REPL.LineEditREPL, REPL.REPLBackendRef})()
    @ REPL .\task.jl:514

I have tried the following troubleshooting steps:

  1. Checked my LaTeX installation, and it is working fine.
  2. Ensured that LuaLaTeX is installed.
  3. Verified that I have the necessary LaTeX packages installed.
  4. Checked the file paths in my Julia code.
  5. Checked if pdf2svg is installed and added to PATH

I have also manually created a test log file in the temporary directory, and it worked, so I don’t believe it’s a permissions issue.

I’m not sure what is causing the LaTeX command to fail. Has anyone encountered a similar issue with PGFPlotsX in Julia, and do you have any suggestions for resolving it?

Thank you for your help!

Environment:

  • Julia version: 1.9.3
  • PGFPlotsX v1.6.0
  • Windows 11
  • CPU Intel VPro
  • 64Gb RAM

I solved the issue.

When I initially encountered the issue, it was because the existing LaTeX installation (TeX Live) had a problem locating or using the “lualatex.fmt” file. This could have been due to a misconfiguration or some missing files in my TeX Live setup.

By installing MiKTeX, I essentially set up a new LaTeX environment on my system. MiKTeX includes all the necessary components, including the “lualatex.fmt” file, and configures them correctly during the installation process. As a result, LaTeX documents can now be typeset using LuaLaTeX without any issues.

In simple terms, the problem was related to a missing or incorrectly configured component in my previous LaTeX setup, and installing MiKTeX provided a fresh and properly configured LaTeX environment, resolving the issue. Now PGFPlotsX works perfectly fine.

1 Like