18

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,274
  • 27
  • 118
  • 177
tim peterson
  • 2,205
  • 4
  • 16
  • 11

4 Answers4

26

You can install directly from the repos:

sudo apt-get install pandoc
amc
  • 7,022
  • 7
  • 39
  • 51
  • 10
    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
20

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/


Sridhar Sarnobat
  • 1,564
  • 16
  • 15
Ben
  • 303
  • 2
  • 6
  • 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](https://github.com/jgm/pandoc/releases/) (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
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
  • 4