Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package minted Error: minted v3+ executable is not installed or is not added to PATH. #419

Closed
andrew-selvia opened this issue Nov 3, 2024 · 9 comments

Comments

@andrew-selvia
Copy link

andrew-selvia commented Nov 3, 2024

Despite having latexminted available on the PATH, this error always occurs when running pdflatex:

Package minted Error: minted v3+ executable is not installed or is not added to PATH.
  • Operating System: macOS 15.0.1 (Sequoia)
  • Version & PATH info:
% echo $PATH
...:$BINDIR
% which latexminted
$BINDIR/latexminted
% latexminted --version
latexminted 0.3.0
Python executable for the LaTeX minted package
Libraries: latex2pydata 0.4.0, latexrestricted 0.6.0, pygments 2.18.0

Context

Continuing from #401, the following error message occurs while attempting to compile a document with minted (v3). Here's the relevant excerpt from the main log file:

(~/Library/Application Support/MiKTeX/texmfs/install/tex/latex/minted/minted.sty
Package: minted 2024/10/07 v3.1.2 Yet another Pygments shim for LaTeX

...

\pydata@fh@_FAD58DE7366495DB4650CFEFAC2FCD61.data.minted=\write9
\openout9 = `_FAD58DE7366495DB4650CFEFAC2FCD61.data.minted'.

runsystem(latexminted config  --timestamp 20241102175424 FAD58DE7366495DB4650CF
EFAC2FCD61)...executed.

sections.tex:859: Package minted Error: minted v3+ executable is not installed 
or is not added to PATH.

See the minted package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.859 \end{minted}

(That was another \errmessage.)

\c@minted@tmpdatabufferlength=\count463

sections.tex:859: Package minted Error: Cannot highlight code (minted executabl
e is unavailable or disabled); attempting to typeset without highlighting.

See the minted package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.859 \end{minted}
                  
(That was another \errmessage.)

Here is the _FAD58DE7366495DB4650CFEFAC2FCD61.data.minted file:

{
"command": "config",
"jobname": "main",
"timestamp": "20241102175424",
"cachedir": "",
}

Interestingly, if I switch to the aux directory in which that file is located and manually run the latexminted command from the log file:

latexminted config  --timestamp 20241102175424 FAD58DE7366495DB4650CFEFAC2FCD61

it produces _FAD58DE7366495DB4650CFEFAC2FCD61.config.minted:

\xdef\minted@executable@version{\detokenize{0.3.0}}%
\xdef\minted@executable@timestamp{\detokenize{20241102175424}}%
\xdef\minted@config@timestamp{\detokenize{20241102175424}}%
\xdef\minted@config@cachepath{\detokenize{}}%

However, that file does not get produced when latexminted is triggered as usual through pdflatex from a clean start:

export TEXSYSTEM=miktex
pdflatex -shell-escape -file-line-error -interaction=nonstopmode -synctex=1 -output-format=pdf -output-directory=.../output -aux-directory=.../aux .../main.tex

If and only if the pdflatex command is run after manually running latexminted, the config file gets logged when pdflatex runs:

runsystem(latexminted config  --timestamp 20241102182118 FAD58DE7366495DB4650CF
EFAC2FCD61)...executed.

(.../aux/_FAD58DE7366495DB4650CFEFAC2FCD61.config.minted)

sections.tex:859: Package minted Error: minted v3+ executable is not installed 
or is not added to PATH.

Without -shell-escape, an even earlier error would occur:

runsystem(latexminted config  --timestamp 20241102175424 FAD58DE7366495DB4650CF
EFAC2FCD61)...disabled (restricted).
@gpoore
Copy link
Owner

gpoore commented Nov 3, 2024

Regarding -shell-escape: TeX Live has added latexminted to the list of trusted executables, so this isn't needed anymore, but that hasn't happened yet for MiKTeX.

If you're using an aux directory, that is likely the problem. latexminted can automatically determine the output directory with TeX Live, but I don't believe MiKTeX sets a TEXMF_OUTPUT_DIRECTORY environment variable. If you're using -aux-directory, then you could set TEXMF_OUTPUT_DIRECTORY as part of the build process to make that work.

@andrew-selvia
Copy link
Author

Bingo! That was, indeed, the missing piece. Thank you @gpoore! 👏🏻

After setting TEXMF_OUTPUT_DIRECTORY to the aux directory, syntax highlighting works as advertised.

Regarding TeX Live v. MiKTeX, I am truly ignorant to the differences. There was no conscious choice to pick MiKTeX. I'll go read up on them both to educate myself. If you have any high-level advice/recommendations, I will gladly listen.

@YoannUniKS
Copy link

Hi,
I am having the same issue here, using MiKTeX. I am not sure I understood the solution to solve it. Are you going to release a corrected version of the package? Thanks in advance!

@gpoore
Copy link
Owner

gpoore commented Nov 3, 2024

@YoannUniKS If you are using -aux-directory, there is no way for minted to detect that output files will be in that location, so the latexminted executable will fail. You can set the environment variable TEXMF_OUTPUT_DIRECTORY to the value of -aux-directory as part of your build process to tell minted where output files will be located. This is only necessary with MiKTeX; TeX Live 2024 does this automatically.

@YoannUniKS
Copy link

Thanks for the reply, I do not have -aux-directory in my MiKTeX configuration. This problem seems to have appeared recently. The same script was working in April this year, now it does not work anymore...

@gpoore
Copy link
Owner

gpoore commented Nov 3, 2024

@YoannUniKS I have recently released minted version 3, which works differently than version 2. If you want to use version 3 with MiKTeX, there is currently an issue with MiKTeX packaging, so you would have to install the new latexminted executable yourself. You could also just use the new minted2 package for continued compatibility with minted version 2.

@YoannUniKS
Copy link

Dear Geoffrey,
Thanks for the reply, installing latexminted solved it.

Just to be clear for people facing the same problem. latexminted is a Python package that can be installed with pip (conda is not working). After installation you need the -shell-escape command in your MiKTeK configuration in order to have it work.

gpoore added a commit that referenced this issue Nov 8, 2024
@Seth401
Copy link

Seth401 commented Nov 12, 2024

Using MikTex xelatex with -output and having installed latexminted using pip, I am facing the same issue. Setting TEXMF_OUTPUT_DIRECTORY resolves it.

xelatex -shell-escape -output-directory ./output example.tex

results in an error

TypeError: config() missing 1 required keyword-only argument: 'data'

Just adding some information in case someone is searching for it.

@gpoore
Copy link
Owner

gpoore commented Nov 13, 2024

@Seth401 There are two things contributing to that error message. First, MiKTeX hasn't yet updated its package database for minted v3.3.0, which fixes a bug triggered by using -shell-escape (which MiKTeX still requires). Second, there was a bug in latexminted in the error reporting under these circumstances, which triggered the TypeError. I've just released latexminted v0.3.1, which fixes the TypeError. Hopefully MiKTeX will update to minted v3.3.0 soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants