20

For the life of me I can't figure out how to install pandoc. I tried the approach recommended on its Github repo as well as all 3 approaches recommended on the pandoc site. I'm installing on Ubuntu 12.04 so I first did sudo apt-get install haskell-platform.

Here's where the error occurred at each step:

1) Installing as recommended on the Github repo:

# cabal install --enable-tests
Registering zlib-conduit-1.0.0...
cabal: Error: some packages failed to install:
http-conduit-1.9.4.5 depends on mime-types-0.1.0.3 which failed to install.
mime-types-0.1.0.3 failed during the building phase. The exception was:
ExitFailure 9
pandoc-1.12 depends on mime-types-0.1.0.3 which failed to install.

2) Primary installation method on Pandoc site:

# cabal install pandoc
[35 of 45] Compiling Text.Pandoc.Parsing ( src/Text/Pandoc/Parsing.hs, dist/build/Text/Pandoc/Parsing.o )
cabal: Error: some packages failed to install:
pandoc-1.11.1 failed during the building phase. The exception was:
ExitFailure 9

3) "If my distribution has GHC 6.12"

# cabal install cabal-install
[46 of 67] Compiling Distribution.Simple.LocalBuildInfo ( Distribution/Simple/LocalBuildInfo.hs, dist/build/Distribution/Simple/LocalBuildInfo.o )
cabal: Error: some packages failed to install:
Cabal-1.16.0.3 failed during the building phase. The exception was:
ExitFailure 9
cabal-install-1.16.0.2 depends on Cabal-1.16.0.3 which failed to install.

4) Installing the tarball:

# cabal install pandoc
[23 of 45] Compiling Text.Pandoc.Writers.Texinfo ( src/Text/Pandoc/Writers/Texinfo.hs, dist/build/Text/Pandoc/Writers/Texinfo.o )
cabal: Error: some packages failed to install:
pandoc-1.11.1 failed during the building phase. The exception was:
ExitFailure 9
Tim
  • 32,861
  • 27
  • 118
  • 178
tim peterson
  • 2,285

5 Answers5

27

You can install directly from the repos:

sudo apt-get install pandoc
amc
  • 7,142
  • 11
    I get pandoc 1.9.1.1 by this way. Isn't there a newest version available ? – Stéphane Laurent Feb 06 '14 at 18:34
  • totally no...I get E: Unable to locate package pandoc – Alexander Mills Apr 16 '20 at 21:14
  • Which version of Ubuntu are you using? It’s available at least in trusty and xenial onwards. – amc Apr 16 '20 at 21:48
  • 1
    Solution is outdated. Current version of pandoc on apt is 2.9. Recent version is 2.17. Significant changes with these two versions. I didn't want to manually install the deb package and used the package manager homebrew instead. https://brew.sh/ – Matthias Pitscher Jan 26 '22 at 23:09
  • the solution is not outdated - it works. the pandoc version you are getting may not be the latest, as is typical with many distros, especially with LTS versions. – amc Jan 27 '22 at 03:04
21

I found that installing cabal took up a lot of disk space in my VM, so I prefer to use the deb that the pandoc developers provide. Here's what I do to download and install the current deb (for pandoc v15.1.1):

sudo wget https://github.com/jgm/pandoc/releases/download/1.15.1/pandoc-1.15.1-1-amd64.deb
sudo dpkg -i pandoc-1.15.1-1-amd64.deb

You can check the latest release numbers here: https://github.com/jgm/pandoc/releases/


Ben
  • 313
  • 2
    This is was by far the easier solution to getting the newest version of Pandoc installed on my DigitalOcean vps. The apt-get version was 1.12 (I believe) and downloading the latest package with this method installed v1.17, which includes the wonderful feature of converting from docx, which i what I was after. Thanks @Ben! – TheBrockEllis Mar 30 '16 at 17:32
  • This was by far the easiest way for me, too, for 1.19.1 (from 1.17.1). I love pandoc but I do find it terribly hard to install, and this worked like a charm. – Chris Beeley Jan 18 '17 at 14:27
  • Yep, apt-get for Ubuntu 14 in 2017 was useless so this was a lifesaver (no exaggeration given how awesome pandoc is). – Sridhar Sarnobat Mar 31 '17 at 07:00
  • I downloaded the latest *.deb release (in my case, 2.1.1) from Github and installed it in 18.04 (pre-release) with the GDebi Package Manager. Worked a treat. Makes life much easier!! – Dɑvïd Jan 25 '18 at 11:34
  • In case anyone else was thrown off here -- I am on x86_64 and didn't bother checking if the amd64 binary would work for my architecture -- especially since the releases page goes to pains to list x86_64 separately for some other OSes. But they are indeed compatible (e.g. https://askubuntu.com/q/601553/362864)! I just installed from the amd64.deb and no issues. – MichaelChirico Nov 04 '23 at 04:52
12

As pointed out by Stephane Laurent, the version of pandoc in the repos is far from the newest and doesn't allow nice features such as handling citations with --biblio. I struggled to install the newest version using the instructions on the pandoc website and github but here's how I finally did it for Ubuntu 13.10.

  1. Install cabal

    sudo apt-get install cabal-install
    
  2. Update cabal package database

    cabal update
    
  3. Make sure that path to cabal is at start of PATH (tip from here)

    PATH=$HOME/.cabal/bin:$PATH
    
  4. Use cabal to install alex and happy

    cabal install alex happy
    
  5. Use cabal to install pandoc (and pandoc-citeproc if wanted)

    cabal install pandoc pandoc-citeproc
    
  6. Check pandoc version to confirm installed

    pandoc --version
    

You'll need to add the PATH=$HOME/.cabal/bin:$PATH command to your ~/.profile so it's available on your next restart. Happy converting!

JohnSG
  • 221
  • 2
  • 3
2

I had similar issues trying to install pandoc on a 512 MB machine in the clouds. According to a comment for this question I was getting the ExitFailure 9 because GHC was receiving a SIGKILL because I was using too much memory. To me this explained the lack of any useful messages with verbose switched on. I turned off ghc optimizations by installing with cabal-dev install pandoc --ghc-options="-O0" and pandoc compiled fine with a far smaller memory footprint. This is not a smart idea if you are in a production environment though!

sh54
  • 121
0

Because Pandoc has some dependencies, users need to install both pandoc and the dependencies to enable a success of pandoc usage for Ubuntu 20.04 (or 18.04).

1.Check dependencies

If you have a tensorflow env within Miniconda or Anaconda, please check the dependencies.

$ conda list

It will show nbclient, nbconvert, etc.

2.Install the lastest pandoc

Usage guide:

https://pandoc.org/installing.html

Download pandoc

https://github.com/jgm/pandoc/releases/tag/3.1.8

Installation

$ cd Downloads
$ sudo dpkg -i pandoc-3.1.8-1-amd64.deb

3.Install texlive-xetex

$ sudo apt-get update -y
$ sudo apt-get install -y texlive-xetex

After successful installation, users can download pdf from Jupyter Noterbook (ipynb document)

Mike Chen
  • 141