2

Question

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

Context

Currently my yaml consists of:

name: space
channels:
  - conda-forge
  - conda
dependencies:
- 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 which is something I would like to avoid. How could I modify the environment.yml to do that?

Tangential: I was able to install it in the .travis.yml with:

before_install:
 - sudo apt-get update -qq
 - sudo apt-get install texlive-xetex texlive-fonts-recommended texlive-latex-recommended texlive-latex-extra texlive-science

However that is something else than the environment.yml.

a.t.
  • 2,002
  • 3
  • 26
  • 66
  • 1
    You can't run a `sudo apt-get` command automatically when creating your env. For one, it goes against the concept of an environment to make system wide installations. Secondly, it would be a severe security risk if yml files could contain (arbitrary) code that needs to be run with `sudo` – FlyingTeller Jan 15 '21 at 07:39
  • 1
    @FlyingTeller While that is true, it does not render the endeavor impossible. [texlive-core](https://anaconda.org/conda-forge/texlive-core) seems to be available for conda, however it is woefully undocumented as its name does not match with any `apt` package and therefore it's unclear which parts of texlive are included. – flyx Jan 15 '21 at 12:20
  • Good idea, however it does not seem to include xelatex, I just tried it on a fresh env – FlyingTeller Jan 15 '21 at 13:06

0 Answers0