Installing xelatex from yaml

  anaconda, jupyter-notebook, python, xelatex, yaml


How can I modify my environment yaml (for a python setup) environment.yml, to automatically install xelatex on Ubuntu?


Currently my yaml consists of:

name: space
  - conda-forge
  - conda
- anaconda
- nb_conda
- conda:
  - numpy>=1.19
  - pytest>=3.0,<3.8
  - notebook
  - jupyter
  - nbconvert
  - matplotlib
  - ipykernel
  - tudatpy
  - nb_conda
  - scipy
- pip
- pip:
  - pdflatex
  - testbook
  - pyment
  - pdoc3
  - black

Which can be installed with:

conda env create --file environment.yml

and updated with:

conda env update --file environment.yml

And when I try to convert a jupyter notebook to pdf, the notebook throws the error nbconvert failed: xelatex not found on PATH, because xelatex is not installed (and added to PATH). According to this documentation, one can solve that, on Ubuntu platforms, with:

sudo apt-get install texlive-xetex texlive-fonts-recommended texlive-generic-recommended

However, that is an additional manual step that I would like to automate. How could I modify the environment.yml to do that?

Source: Python Questions