MiKTeX / miktex

the MiKTeX source code
https://miktex.org
Other
804 stars 95 forks source link

Package minted Error: minted v3+ executable is not installed #1538

Open hair-splitter opened 1 month ago

hair-splitter commented 1 month ago

My system:

I tried to compile the following code:

\documentclass{article}
\usepackage{minted}

\begin{document}

\begin{minted}{latex}
\textbf{Hello, World!}
\end{minted}

\end{document}

The compilation gives the following error message:

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

If I load the minted2 package instead of minted, there is no such problem.

muzimuzhi commented 1 month ago

minted v3 ships with a new executable latexminted written in Python. (As minted requires Python library pygments, no new dependency is added.)

But currently the Python scripts and wheels are only included in minted__source MiKTeX package, not in minted package.

image

A workaround is to install latexminted from pip and compile tex files with shell escape enabled, but then another error (probably minted is to blame) is raised, see https://github.com/gpoore/minted/issues/401#issuecomment-2439887078.

[error] Traceback (most recent call last):
[error]   File ".../venv/lib/python3.13/site-packages/latexrestricted/_restricted_pathlib.py", line 647, in writable_file
[error]     return self._writable_file_cache[self.cache_key]
[error]            ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
[error] KeyError: (<class 'latexrestricted._restricted_pathlib.ResolvedRestrictedPath'>, ResolvedRestrictedPath('/Users/me/.latexminted_config'))
[error] During handling of the above exception, another exception occurred:
...
[error] latexrestricted.err.LatexConfigError: Environment variable TEXSYSTEM="miktex", but failed to find an "initexmf" executable with accompanying "kpsewhich" on PATH
gpoore commented 4 weeks ago

Under macOS, kpsewhich is apparently a symlink to miktex-kpsewhich. I've just released latexrestricted v0.6.0, which adds support for miktex-kpsewhich. This should fix the other error. I will release a new version of minted that bundles latexrestricted v0.6.0 later today.