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 #298

Open
andreondra opened this issue Oct 18, 2024 · 9 comments

Comments

@andreondra
Copy link

andreondra commented Oct 18, 2024

Steps to Reproduce

  1. Install minted package (or full installation) using tlmgr.
  2. Import minted package in a project and insert arbitrary minted environment to a document.

Expected Behaviour

Minted should be successfully invoked and code with syntax highlighting should be printed to the document.

Observed Behaviour

Compiling crashes with error: Package minted Error: minted v3+ executable is not installed or is not added to PATH..

Context

This error is already discussed here: gpoore/minted#401. It seems that apart from upgrading tlmgr packages one should also uninstall minted and install again, which should install required Python dependencies. However, even after doing these steps, latexminted stays on v1:

# latexminted --version
latexminted 0.1.0 (libraries: latex2pydata 0.4.0, pygments 2.18.0)

It looks like system latexminted has precedence on PATH. How can one successfully manage to use latexminted v2? Or probably the problem with minted executable is caused by another problem related to Docker image?

Technical Info

I installed latest toolkit and used docker's shell to install full installation. Shell escape is allowed.

Analysis

EDIT: It looks like it can be fixed by installing latexminted manually via pip3. However, is this OK approach? I thought Python dependencies should be now installed automatically by tlmgr.

@d2nt4
Copy link

d2nt4 commented Oct 19, 2024

Thank you so much for raising this issue and for the solution! I was facing a similar problem with LaTeX and the minted package, and installing latexminted via pip resolved everything. Your contribution really helped me and will certainly assist others who encounter this. For anyone else running into the same issue, make sure to install latexminted if you're having trouble with pygmentize in your LaTeX setup. Thanks again!

@andreondra
Copy link
Author

Glad to hear that my fix worked for you! I look forward to any "proper" solution to this problem. For now let's hope this temporary solution didn't break any other packages 😀

@derpberk
Copy link

This happened to me aswell. Fixed after upgrading and installing latexminted by:

pip install latexminted

as @andreondra suggested :)

@yfilip
Copy link

yfilip commented Oct 22, 2024

Thank you for raising the issue and giving a solution.
The fix did not work for me. I am using python 3.12.6, MiKTeX and compiling with lualatex. Copying the latexminted.exe that pip installs in the ..\AppData\Local\Programs\Python\Python312\Scripts (this directory is in the PATH) from there to ..\AppData\Local\Programs\MiKTeX\miktex\bin\x64 worked for me.
Probably not the best solution.

@shalinpather
Copy link

Hi. For some reason, the docs didn't make this clear, but the legacy instructions give it. I had the same issue and days of pain, so I had to post the authoritative solution here.

First, install your packages as such:
tlmgr install minted

And then, you must run this command manually:
tlmgr path add

This is because all the LaTeX packages you download with tlmgr include the corresponding programs to make them work (in this case, latexminted). However, you must run the command above. It creates symlinks to the binaries to make them available to the system. Once you do this, all installed LaTeX packages will work normally, including Minted, PGF-TiKZ, and other such packages that rely on external programs. This is far better (and wastes far less space) than messing around with pip or the system package manager to download the programs separately and redundantly. You just need to follow these steps.

Don't forget to enable the shell escape to use these programs when you're done!

@cx0222
Copy link

cx0222 commented Oct 24, 2024

@shalinpather Thank you very much for your comment. However, it seems that this approach doesn't work for me currently. I still encounter the problems as follows:

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

Package minted Error: Missing definition for highlighting style "manni" (minted executable is unavailable or disabled); attempting to substitute fallback style.

Here are the versions:

  • which tlmgr: /usr/local/bin/tlmgr
  • tlmgr --version: 71331 (2024-05-24 09:30:36 +0200)
  • which pygmentize: /Library/Frameworks/Python.framework/Versions/3.12/bin/pygmentize
  • pygmentize -V: version 2.18.0, (c) 2006-2024 by Georg Brandl, Matthäus Chajdas and contributors.
  • which latexminted: /Library/Frameworks/Python.framework/Versions/3.12/bin/latexminted
  • latexminted --version: latexminted 0.2.0; Python executable for the LaTeX minted package; Libraries: latex2pydata 0.4.0, latexrestricted 0.5.0, pygments 2.18.0

Could you please kindly help me figure out the issues? Thank you so much.

@shalinpather
Copy link

@cx0222 Please show me the contents of the file usr/local/texlive/2024/texmf.cnf. A compilation log might also be helpful. I suspect that if you followed the steps I mentioned, it's probably down to the configuration.

@shalinpather
Copy link

shalinpather commented Oct 25, 2024

@cx0222 Another thing I found is that if you want to install Minted externally using pip, for some reason, you just can't \usepackage{minted}. However, when you change it to \usepackage{minted2}, it works normally. I think the only way to get everything working 100% as the online Overleaf does is to remove any packages you tried installing with the system package manager and pip (or better yet, recreate your sharelatex container) and run tlmgr install <packages> and tlmgr path add. I did this from scratch after deleting the sharelatex container and installing all packages this way (without involving pip or apt-get). Someone else, please confirm this.

@bartonzzx
Copy link

Hi. For some reason, the docs didn't make this clear, but the legacy instructions give it. I had the same issue and days of pain, so I had to post the authoritative solution here.

First, install your packages as such: tlmgr install minted

And then, you must run this command manually: tlmgr path add

This is because all the LaTeX packages you download with tlmgr include the corresponding programs to make them work (in this case, latexminted). However, you must run the command above. It creates symlinks to the binaries to make them available to the system. Once you do this, all installed LaTeX packages will work normally, including Minted, PGF-TiKZ, and other such packages that rely on external programs. This is far better (and wastes far less space) than messing around with pip or the system package manager to download the programs separately and redundantly. You just need to follow these steps.

Don't forget to enable the shell escape to use these programs when you're done!

Thanks.It really works. :)

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

7 participants