question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

jupyter notebook unable to download .tex or .pdf: nbconvert failed: Pandoc wasn't found...

See original GitHub issue

Hello!

I am new to jupyter notebook, python, and linux, and do not know much of anything about bash or start up files.

I am having the following error when I am trying to download a .tex or .pdf of my jupyter notebook .ipynb file.

500 : Internal Server Error
The error was:

nbconvert failed: Pandoc wasn't found.
Please check that pandoc is installed:
http://pandoc.org/installing.html

I am running jupyter notebook on linux. I downloaded and unzipped the pandoc file but got stuck there. I also added pandoc to my environmental file along with nbconverter. I also installed texlive but dont know what to do/if it worked.

I found this post on github where someone had the same issue and fixed it but I do not understand what it means to and how to set a path variable. I have a start up file but am scared to mess with it. Does the path variable need to be specific for jupyter notebook outputs?!?

Please help!

Thank you!

-m

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
Carreaucommented, Apr 17, 2020

Hi there,

Thanks for your question. As a first note this is IPython, not jupyter notebook, the difference is complicated, so let’s gloss over it. That being said you might find more help in https://discourse.jupyter.org/, and on the github.com/jupyter/notebook.

  1. Are you using conda ? If you are using conda than you should be able to “conda install pandoc”, it will be wayyyy easier.

  2. This might be a bit long but bear with me.

When you type a command in bash, like “jupyter”, or “python” or “pandoc”, linux need to know where to “search” for things. What linux will do is search in the variable “$PATH”.

for example here is my PATH:

$ echo $PATH
/Users/bussonniermatthias/miniconda3/bin:/Users/bussonniermatthias/miniconda3/condabin:/Users/bussonniermatthias/.local/bin:/usr/local/sbin:/Users/bussonniermatthias/.idris2/bin:/Users/bussonniermatthias/bin:/Users/bussonniermatthias/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/TeX/texbin:/usr/local/opt/fzf/bin

It will search in each of these folder in order, and stop on the first where it finds the command you asked.

To change “PATH” temporarily you can just in a bash prompt do PATH=..., but that tends to mess things up if you just “set” it.

$ PATH=123
-bash: id: command not found

Oh no, i’ve messed up my path… but it’s ok, I can just close my terminal and reopen. What is better is to append, or prepend to path depending of wether you want things to have high (prepend), or low (append) precedence. if you are not sure append is always safer.

$ PATH=$PATH:/new/path
$ echo $PATH
/Users/bussonniermatthias/miniconda3/bin:/Users/bussonniermatthias/miniconda3/condabin:/Users/bussonniermatthias/.local/bin:/usr/local/sbin:/Users/bussonniermatthias/.idris2/bin:/Users/bussonniermatthias/bin:/Users/bussonniermatthias/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/TeX/texbin:/usr/local/opt/fzf/bin:/new/path

Note the lack of space around equal, and when you assign you use no $, but the "value of PATH` have a $.

Once you have played allong enough and want to have $PATH always be the new value, you can edit your ~/.bashrc, or ~/.bash_profile or well it depends on your distribution and add a line with

PATH=$PATH:/the/right/thing

You will even probably have in this file already some stuff, for example I have that added by conda :

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/bussonniermatthias/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/Users/bussonniermatthias/miniconda3/etc/profile.d/conda.sh" ]; then
        . "/Users/bussonniermatthias/miniconda3/etc/profile.d/conda.sh"
    else
        export PATH="/Users/bussonniermatthias/miniconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

You might need to restart your jupyter notebook server for things to work, but if PATH is set correctly, and in bash you get something along:

 $ pandoc --version
pandoc 2.9.2
Compiled with pandoc-types 1.20, texmath 0.12.0.1, skylighting 0.8.3.2
Default user data directory: /Users/bussonniermatthias/.local/share/pandoc or /Users/bussonniermatthias/.pandoc
Copyright (C) 2006-2019 John MacFarlane
Web:  https://pandoc.org
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose.

Then all is fine.

Side notes: if you are on linux you like can apt install pandoc (one almost never download and install a an app by downloading it manually on linux).

If you wonder “where” a command like pandoc, jupyter, python is on linux, you can use which, to tell you where things are:

 ~[master ✗] $ which pandoc
/Users/bussonniermatthias/miniconda3/bin/pandoc
 ~[master ✗] $ which jupyter
/Users/bussonniermatthias/miniconda3/bin/jupyter
 ~[master ✗] $ which ls
/bin/ls
 ~[master ✗] $ which which
/usr/bin/which
 ~[master ✗] $ which -a python
/Users/bussonniermatthias/miniconda3/bin/python
/usr/local/bin/python
/usr/bin/python
 ~[master ✗] $

This might help you to figure things out better, if not we can try to dig in more details.

0reactions
mmcoellocommented, May 8, 2020

This issue has not been resolved but it has been figured out. Jupyter is generating newer tex code than what the operating system CentOS-7 package installs of texlive (Based on TeX Live 2013) support. Thanks for all the help Carreau!

Read more comments on GitHub >

github_iconTop Results From Across the Web

IPython/Jupyter Problems saving notebook as PDF
Install Nbconvert, Pandoc, and Tex: Open a terminal and implement the following commands in it. Install Nbconvert: though it's part of the ...
Read more >
Installation — nbconvert 7.2.7 documentation
If it does not find a suitable installation of the web browser, it can automatically download it if the --allow-chromium-download flag is passed...
Read more >
How to Resolve "nbconvert failed: PDF creating ... - YouTube
This video will show you how to resolve nbconvert failed : PDF creating failed occurred while saving jupyter file as pdf.
Read more >
nbconvert Documentation - Read the Docs
nbconvert is used to implement the “Download as” feature within the Jupyter Notebook web application. When used.
Read more >
jupyter-nbconvert not found | The AI Search Engine You Control
ipython/ipythonjupyter notebook unable to download .tex or .pdf: nbconvert failed: Pandoc wasn't found...#12238. Created over 2 years ago.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found