Install pandoc v2.X in AWS Lambda container images/Amazon Linux

1k views Asked by At

I am trying to install pandoc into AWS Lambda container image. The image is based on Amazon Linux Base operating system, which itself is based on RHEL/CentOS 7.x (as stated in this question).

However, the pandoc rpm available in the Extra Packages for Enterprise Linux (EPEL) repository is v1.12.3 (https://pkgs.org/search/?q=pandoc). yum install pandoc will get and install pandoc v1.12.3, yet not desired pandoc version (at least v2.X).

Is it possible to install v2 of pandoc inside AWS Lambda container image/Amazon Linux?


Appendix: Unsuccessful direct install of tar.gz package

Documentation of pandoc stated that it is possible to install tarball directly. However, pandoc is running at an outrageously slow speed using this approach.

I tried to install from tarball version of pandoc v2.x directly using the following commands.

wget https://github.com/jgm/pandoc/releases/download/2.11.4/pandoc-2.11.4-linux-amd64.tar.gz
tar xvzf pandoc-2.11.4-linux-amd64.tar.gz --strip-components 1 -C /usr/local
rm -rf pandoc-2.11.4*

Although pandoc is installed, the running speed is outrageously slow. It takes > 10 secs to print the pandoc version. Converting a simple markdown file to HTML takes around 1 min.

sh-4.2# time pandoc -v
pandoc 2.11.4

real    0m15.941s
user    0m12.143s
sys 0m3.795s
sh-4.2# 

As compared to the v1.x rpm package, which pandoc will immediately (< 0.5 sec) print the version as usual.

sh-4.2# time pandoc -v
pandoc 1.12.3.1

real    0m0.249s
user    0m0.122s
sys 0m0.052s
1

There are 1 answers

0
Pierre D On

FYI, I just ran in the same problem (to get nbconvert to work).

This worked for me:

sudo yum -y install epel-release
sudo yum -y install pandoc --enablerepo=epel

For sake of completeness (not sure if necessary for pandoc, but I needed it for nbconvert), I also installed xetex:

sudo yum -y install texlive-xetex texlive-fonts-recommended \
  texlive-plain-generic --enablerepo=epel