R Markdown - Latex Minted - Cannot Find Pygmentize in system environment

I would like to use the latex package "Minted" with R Markdown but I am running into R Studio external package configuration issues.

Documentation for the Latex Minted Package can be found here:

In order to use this package - there is a tinytex shell escape requirement:

This is required in the R Markdown (preamble) to allow for a shell escape:

knitr::opts_chunk$set(echo = TRUE)
options(tinytex.engine_args = '-shell-escape')

But I obtain this R-Studio console error:

! Package minted Error: You must have `pygmentize' installed to use this package. 
! system returned with code 256

I have Pygments installed in several stand alone Python Environments.

I am not sure how to configure the Pygments Python environment to support R Studio.

Any help would be appreciated greatly.


You need to go to your external Latex engine (i.e. latex studio, miktex, texlive or any other)
and install the package.

You can create the .rmd file and ask it (in wheel cart) to save the .tex file, then run the file in latex engine manually where you will be prompted to install any missing latex package.

I am not sure - I think that reticulate with packages - will resolve ... it is a search error, not a capability problem since a shell escape is possible. I am working on it now.

I would suggest to try out of RStudio so that you rule out RStudio finding it.

I believe you want your LaTeX installation to be able to have the LaTeX code call this Python executable.
I would check

  • Run rmarkdown::render() in a OS terminal
  • Try rendering a LaTeX example using minted and check it works (if yes, then this is R issue, if not this is indeed Python LaTeX issue)
  • Check that the binary is available. I believe it should probably be in PATH .. I don't know how pygmentize works.

Anyhow, this is a configuration issue. Quite specific so that R can call LaTeX which can call Python.

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.