I'm currently using ubuntu13.10, TeXlive and Texmaker editor, and I found out that minted package is the best way to get source code highlighting on LaTeX.

So I installed python-pygments via terminal (sudo apt-get install python-pygments), it actually installed correctly, but when I start Texmaker and type \usepackage{minted} the log displays:

! Package minted Error: You must invoke LaTeX with the -shell-escape flag.

! Package minted Error: You must have `pygmentize' installed to use this packag e.

and it gives me this error as well:

LaTeX Error: File `mytexts.pyg' not found.

I'd appreciate some help on that, I'm learning C atm and minted would be really helpful.


Mmm, I chek out tm settings>fast comp. and I have selected latex + dvips + ps2pdf + see pdf option, so I should add the -shell-escape line to dvips at settings>commands or to ps2pdf or both of them?

That's what I'm not really getting, where I should add the shell escape lines...

(python-pigments + texlive are already installed)


  • 1
    The first error message is quite clear. You need to add -shell-escape to the command line options for the compiler in your TeXmaker settings. Nov 21, 2013 at 20:58

3 Answers 3


with running apt-cache search pygments you'll get the needed packages:

voss@ubuntu:~$ apt-cache search pygments
python-pygments - syntax highlighting package written in Python
python-sphinx - documentation generator for Python projects (implemented in Python 2)
python3-pygments - syntax highlighting package written in Python 3
python3-sphinx - documentation generator for Python projects (implemented in Python 3)
texlive-latex-extra - TeX Live: LaTeX additional packages
python-django-debug-toolbar - Embedded debugging toolbar for Django projects
ruby-albino - Ruby wrapper for pygmentize
trac-wikiprint - Make Trac wiki pages printable, exporting to PDF or printable HTML

Install the package(s) with

voss@ubuntu:~$ sudo apt-get install python-pygments

and maybe that you also need to install the texlive package. Anf when everything is installed you need the pdflatex --shell-escape <file> command

  • 4
    In Ubuntu 19.10, I needed python3-pygments
    – Rasmus
    May 21, 2020 at 6:49
  • @Rasmus I found the same for Ubuntu 20.04 LTS.
    – Galen
    Mar 6 at 22:18

If you are using TeXStudio under Ubuntu or other GNU/Linux distribution, the answer is simple,

  1. Install Pygments: sudo easy_install Pygments (make sure you have python installed)

  2. In TeXStudio Options > Configure TeXStudio > Completion > (select minted related packages)[minted.cwl etc] and press OK. If you can't find minted there, install it by yourseelf: go to http://code.google.com/p/minted/, download minted, unzip, run latex minted.ins and it will generate minted.sty; move the sty file to your desired location

  3. After having installed/found minted, in the same TeXStudio window go to Commands and put -shell-escape in the PdfLaTeX/LaTeX compilation commands.


I recently had the same problem in ubuntu 20.04 and solved it by installing Pygments (as rasmus say)

sudo apt-get install python3-pygments

And, of course, adding -shell-escape in the configuration of the editor

Note: sudo apt-get install python-pygments didn't work


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.