nbconvert
nbconvert copied to clipboard
Unable to generate pdf (XeLaTeX not found on PATH)
So for the last almost year and a half, I have taught myself enough Python to work within the infrastructure of my company. I am trying to expand my knowledge of programming locally.
I am in the process of creating a training on NumPy using just Jupyter notebooks, but when I try to convert to PDF I get an error message with 500 server error:
nbconvert failed: xelatex not found on PATH, if you have not installed xelatex you may need to do so. Find further instructions at https://nbconvert.readthedocs.io/en/latest/install.html#installing-tex.
I went to the page and installed all of the things ....
But to no avail.
Windows 10, anaconda distribution, python 3
I tried doing it in the anaconda prompt and got this ...
(base) C:\WINDOWS\system32>cd "C:\Users\Kat\Documents\Programming\repo\TrainingUsingJupyter\NumPy\Exercise Answers"
(base) C:\Users\Kat\Documents\Programming\repo\TrainingUsingJupyter\NumPy\Exercise Answers>jupyter ntbconvert --to pdf "Basic NumPy Training 1 - ANSWERS - Copy.ipynb" Error executing Jupyter command 'ntbconvert': [Errno 'jupyter-ntbconvert' not found] 2
(base) C:\Users\Kat\Documents\Programming\repo\TrainingUsingJupyter\NumPy\Exercise Answers>
At the command prompt, you've got ntbconvert instead of nbconvert.
That may just get you the same error that you saw from in the notebook editor. Unfortunately the pdf conversion relies on latex, which isn't very easy to install.
On Thu, 19 Apr 2018, 6:35 a.m. Kassandra Keeton, [email protected] wrote:
I tried doing it in the anaconda prompt and got this ...
(base) C:\WINDOWS\system32>cd "C:\Users\Kat\Documents\Programming\repo\TrainingUsingJupyter\NumPy\Exercise Answers"
(base) C:\Users\Kat\Documents\Programming\repo\TrainingUsingJupyter\NumPy\Exercise Answers>jupyter ntbconvert --to pdf "Basic NumPy Training 1 - ANSWERS - Copy.ipynb" Error executing Jupyter command 'ntbconvert': [Errno 'jupyter-ntbconvert' not found] 2
(base) C:\Users\Kat\Documents\Programming\repo\TrainingUsingJupyter\NumPy\Exercise Answers>
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jupyter/nbconvert/issues/799#issuecomment-382607661, or mute the thread https://github.com/notifications/unsubscribe-auth/AAUA9Q8_iEtSXLWIPFd_ru2z400dS65Eks5tqBP5gaJpZM4TbIjz .
Since you're on windows, I recommend downloading and installing miktex. It should automatically add LaTeX to the system path. Check if MiKTeX is anywhere on you're system. You can type that latex is in your path by:
From the command line type:
c\> latex --version
If this spits out a version, then I don't know what your problem is.
If this doesn't find a version, but MikTeX is installed on your system (It should be searchable from the start menu), then try to add C:\Program Files\MiKTeX 2.9\miktex\bin\x64
to your path. (Check that that is indeed where MikTeX is installed).
Alternatively, you can install miktex using chocolatey, which is a package manager for windows. This is the easiest way to install LaTeX on windows in my opinion. Follow the linked instructions to install chocolatey using an admin powershell. Then use:
choco install MikTeX
from an admin powershell. Chocolatey will shim MikTeX into the path, so it will certainly work.
I have the same issue.
/miktex/bin/x64
is in my Path, and xelatex is installed, but I'm still getting this error.
[NbConvertApp] Converting notebook C:\Users\user\Documents\#work_stuff\anodot summary\prediction data\payoneer - lstm prophet.ipynb to pdf
[NbConvertApp] Writing 19232 bytes to C:\Users\user\Documents\#work_stuff\anodot summary\prediction data\notebook.tex
[NbConvertApp] Building PDF
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\conda\conda\envs\myenv\Scripts\jupyter-nbconvert-script.py", line 10, in <module>
sys.exit(main())
File "C:\Users\user\AppData\Local\conda\conda\envs\myenv\lib\site-packages\jupyter_core\application.py", line 266, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "C:\Users\user\AppData\Local\conda\conda\envs\myenv\lib\site-packages\traitlets\config\application.py", line 658, in launch_instance
app.start()
File "C:\Users\user\AppData\Local\conda\conda\envs\myenv\lib\site-packages\nbconvert\nbconvertapp.py", line 325, in start
self.convert_notebooks()
File "C:\Users\user\AppData\Local\conda\conda\envs\myenv\lib\site-packages\nbconvert\nbconvertapp.py", line 493, in convert_notebooks
self.convert_single_notebook(notebook_filename)
File "C:\Users\user\AppData\Local\conda\conda\envs\myenv\lib\site-packages\nbconvert\nbconvertapp.py", line 464, in convert_single_notebook
output, resources = self.export_single_notebook(notebook_filename, resources, input_buffer=input_buffer)
File "C:\Users\user\AppData\Local\conda\conda\envs\myenv\lib\site-packages\nbconvert\nbconvertapp.py", line 393, in export_single_notebook
output, resources = self.exporter.from_filename(notebook_filename, resources=resources)
File "C:\Users\user\AppData\Local\conda\conda\envs\myenv\lib\site-packages\nbconvert\exporters\exporter.py", line 174, in from_filename
return self.from_file(f, resources=resources, **kw)
File "C:\Users\user\AppData\Local\conda\conda\envs\myenv\lib\site-packages\nbconvert\exporters\exporter.py", line 192, in from_file
return self.from_notebook_node(nbformat.read(file_stream, as_version=4), resources=resources, **kw)
File "C:\Users\user\AppData\Local\conda\conda\envs\myenv\lib\site-packages\nbconvert\exporters\pdf.py", line 175, in from_notebook_node
rc = self.run_latex(tex_file)
File "C:\Users\user\AppData\Local\conda\conda\envs\myenv\lib\site-packages\nbconvert\exporters\pdf.py", line 137, in run_latex
self.latex_count, log_error)
File "C:\Users\user\AppData\Local\conda\conda\envs\myenv\lib\site-packages\nbconvert\exporters\pdf.py", line 99, in run_command
"at {link}.".format(formatter=command_list[0], link=link))
OSError: xelatex not found on PATH, if you have not installed xelatex you may need to do so. Find further instructions at https://nbconvert.readthedocs.io/en/latest/install.html#installing-tex.
Same as @lordgrenville, has anyone been able to resolve this issue?
The error occurs while building the PDF. Till this step, the notebook(.ipynb file) is already converted to .tex file.
So, what you can do, open that .tex file using MikTex (Windows).
Change that to XeLatex and click the green play button besides it. It will ask for installations using a pop-up box. Install all. Then, you will have your pdf for that notebook.
When I first tried to generate a pdf I got the message on "xelatex not found on PATH" and followed the provided instructions, but it didn't work. But once I completely restarted jupyter, it worked just fine. Perhaps we just need to update the relevant docs / error message to state that a restart is necessary. @lordgrenville / @ProsperousHeart can either of you confirm that a restart of the jupyter notebook resolved this issue?
@ProsperousHeart can you change the title to something like "Unable to generate pdf (xelatex not found on PATH)" to better reflect the issue?
Thanks@
nbconvert failed: xelatex not found on PATH
had this problem on ubuntu, fixed with sudo apt-get install texlive-xetex
When I first tried to generate a pdf I got the message on "xelatex not found on PATH" and followed the provided instructions, but it didn't work. But once I completely restarted jupyter, it worked just fine. Perhaps we just need to update the relevant docs / error message to state that a restart is necessary. @lordgrenville / @ProsperousHeart can either of you confirm that a restart of the jupyter notebook resolved this issue?
@ProsperousHeart can you change the title to something like "Unable to generate pdf (xelatex not found on PATH)" to better reflect the issue?
Thanks@
I had the same issue.. restarted jupyter notebook, and checked if xelatex was in the path using: import os os.environ['PATH'].split(';') but it wasn't.
You need to quit jupyter notebook and open a new command prompt, then jupyter will find the newly added item to the PATH
Since you're on windows, I recommend downloading and installing miktex. It should automatically add LaTeX to the system path. Check if MiKTeX is anywhere on you're system. You can type that latex is in your path by:
From the command line type:
c\> latex --version
If this spits out a version, then I don't know what your problem is.
If this doesn't find a version, but MikTeX is installed on your system (It should be searchable from the start menu), then try to add
C:\Program Files\MiKTeX 2.9\miktex\bin\x64
to your path. (Check that that is indeed where MikTeX is installed).Alternatively, you can install miktex using chocolatey, which is a package manager for windows. This is the easiest way to install LaTeX on windows in my opinion. Follow the linked instructions to install chocolatey using an admin powershell. Then use:
choco install MikTeX
from an admin powershell. Chocolatey will shim MikTeX into the path, so it will certainly work.
Installing miktex worked perfectly running Anaconda on Windows
nbconvert failed: xelatex not found on PATH
had this problem on ubuntu, fixed with
sudo apt-get install texlive-xetex
thank you! Solve the problem for me
nbconvert failed: xelatex not found on PATH
had this problem on ubuntu, fixed with
sudo apt-get install texlive-xetex
This worked for me!
having this problem on MacOS Catalina. nbconvert failed: xelatex not found on PATH even after a full Tex install and total reboot.
having this problem on MacOS Catalina. nbconvert failed: xelatex not found on PATH even after a full Tex install and total reboot.
Same problem for me. I have installed the full MacTex, added path variable for MacTex and restarted Jupyter. Nothing is working.
@rsc2143 Does xelatex
command work from command line? If it does then the nbconvert conversion should be able to use it since it's doing a subprocess call. If not your PATH is missing the path to the xelatex binary. I don't have a MacOS so it's a little hard for me to test. On Ubuntu the package install updates the PATH correctly, but I've had issues with brew installs on macs in the past not updating PATHs correctly.
I'm having the same issue on MacOS. I download the jupyter notebook as a .tex but now I can't convert it into a PDF, using LaTexIt or TeXShop.
Latex conversion of Python notebooks is a disaster. I've abandoned it entirely for html5.
Unfortunately there's very little maintenance of LaTeX in nbconvert -- LaTeX conversions are complex beast and there's not someone keeping it fed over time for all the many edge cases and build tool changes.
There is a new webpdf conversion using chromium to generate PDF files coming in 6.0, which trades off some of the flexibility of xelatex / pandoc for consistency with web renderings (and a new optional dependency).
The maintainers are trying to get the last of issues resolved for a final release our of alpha for 6.0. There's just not many of us with a lot of free time to contribute.
I was thinking about this problem recently and realized that you should be able to point directly to LaTeX instead of relying on it being in the path. To so this, just add:
c.PDFExporter.latex_command = ['/path/to/xelatex', '{filename}', '-quiet']
to your jupyter_notebook_config.py
, and jupyter_nbconvert_config.py
files. (restarting your jupyter server after of course).
When I first tried to generate a pdf I got the message on "xelatex not found on PATH" and followed the provided instructions, but it didn't work. But once I completely restarted jupyter, it worked just fine. Perhaps we just need to update the relevant docs / error message to state that a restart is necessary. @lordgrenville / @ProsperousHeart can either of you confirm that a restart of the jupyter notebook resolved this issue?
@ProsperousHeart can you change the title to something like "Unable to generate pdf (xelatex not found on PATH)" to better reflect the issue?
Thanks@
Thank you. solved the problem for me. I just had to reinstall jupyter in the environment -> conda install jupyter
I had this issue on MacOS and I just had to set the PATH and it worked (at least by using nbconvert from the command line). Found the path in TeXShop which was /Library/TeX/texbin so if anyone wants to give it a shot
export PATH=$PATH=/Library/TeX/texbin
python -m jupyter nbconvert --to pdf <file>
I had this issue on MacOS and I just had to set the PATH and it worked (at least by using nbconvert from the command line). Found the path in TeXShop which was /Library/TeX/texbin so if anyone wants to give it a shot
export PATH=$PATH=/Library/TeX/texbin python -m jupyter nbconvert --to pdf <file>
Thanks! It helps me on MacOS Catalina. Just a small correction: export PATH=$PATH:/Library/TeX/texbin
.
Add "env": {"PATH":"$PATH"}
to your kernel.json
, for me that was in /opt/anaconda3/share/jupyter/kernels/python3/kernel.json
.
JupyterLab or Anaconda seems to override the system PATH by default, if you set this then the PATH will be the same in JupyterLab and in your shell, so if you have anything custom installed like xelatex, it will show up in JupyterLab.
nbconvert failed: xelatex not found on PATH
had this problem on ubuntu, fixed with
sudo apt-get install texlive-xetex
I have installed it and I can find it:
xelatex: /usr/bin/xelatex /usr/share/man/man1/xelatex.1.gz
But I run into the issue. Does anyone have any idea?
[NbConvertApp] PDF successfully created
[NbConvertApp] Writing 323403 bytes to /tmp/tmp-73003IQh2QeTIPD9A.pdf
at a.executeCommand (/home/wang/.vscode/extensions/ms-toolsai.jupyter-2020.12.414227025/out/client/extension.js:1:448888)
at processTicksAndRejections (internal/process/task_queues.js:94:5)
at async a.export (/home/wang/.vscode/extensions/ms-toolsai.jupyter-2020.12.414227025/out/client/extension.js:49:254436)
at async _.exportToFormat (/home/wang/.vscode/extensions/ms-toolsai.jupyter-2020.12.414227025/out/client/extension.js:49:252696)
at async _.performExport (/home/wang/.vscode/extensions/ms-toolsai.jupyter-2020.12.414227025/out/client/extension.js:49:251809)
at async _.export (/home/wang/.vscode/extensions/ms-toolsai.jupyter-2020.12.414227025/out/client/extension.js:49:251323)
at async m.export (/home/wang/.vscode/extensions/ms-toolsai.jupyter-2020.12.414227025/out/client/extension.js:32:265964)]
Error 2020-12-15 20:38:41: If you have not installed xelatex (TeX) you will need to do so before you can export to PDF, for further instructions go to https://nbconvert.readthedocs.io/en/latest/install.html#installing-tex.
To avoid installing xelatex (TeX) you might want to try exporting to HTML and using your browsers "Print to PDF" feature.
And I cannot convert into HTML,
[NbConvertApp] template_path: .
[NbConvertApp] Writing 2306326 bytes to /tmp/tmp-73003W4pDsmFl1Kfe.html
at a.executeCommand (/home/wang/.vscode/extensions/ms-toolsai.jupyter-2020.12.414227025/out/client/extension.js:1:448888)
at processTicksAndRejections (internal/process/task_queues.js:94:5)
at async a.export (/home/wang/.vscode/extensions/ms-toolsai.jupyter-2020.12.414227025/out/client/extension.js:49:253800)
at async _.exportToFormat (/home/wang/.vscode/extensions/ms-toolsai.jupyter-2020.12.414227025/out/client/extension.js:49:252766)
at async _.performExport (/home/wang/.vscode/extensions/ms-toolsai.jupyter-2020.12.414227025/out/client/extension.js:49:251809)
at async _.export (/home/wang/.vscode/extensions/ms-toolsai.jupyter-2020.12.414227025/out/client/extension.js:49:251323)
at async m.export (/home/wang/.vscode/extensions/ms-toolsai.jupyter-2020.12.414227025/out/client/extension.js:32:265964)]
steps to fix in windows: 0. install Miktex and pandoc from official website, launch any tex file and generate pdf, which will guide you install all the packages. https://github.com/jupyter/nbconvert/issues/799#issuecomment-469877993
- generate config if not yet done (check
%userprofile%\.jupyter\
):jupyter lab/notebook --generate-config
- add this to the end of config.py
c.PDFExporter.latex_command = ['/path/to/xelatex', '{filename}', '-quiet']
https://github.com/jupyter/nbconvert/issues/799#issuecomment-662780585 - and add this to the end of config.py
c.PDFExporter. bib_command = ['/path/to/bibtex', '{filename}']
./path/to/bibtex
is path of the executables, check the file location of the xelatex/bibtex to see exact location and replace in the command - launch or restart jupyter notebook/lab this helped me fixed pdf generation issue.
python -m jupyter nbconvert --to pdf
Was having an issue with Mac as well but this solved it, thanks!
nbconvert failed: xelatex not found on PATH
had this problem on ubuntu, fixed with
sudo apt-get install texlive-xetex
It worked. Thank you 🙏
Went through all the steps, here's what worked for me on mac OS Monterey :
Install Home-brew : /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Install pandoc : brew install pandoc
Install texlive-xetex : brew install texlive-xetex
Install pyppeteer : conda install -c conda-forge pyppeteer
Install Chromium : jupyter nbconvert --to webpdf --allow-chromium-download Untitled.ipynb
The Chromium part is little complex, I followed this link below - https://stackoverflow.com/questions/66514334/nbconvert-use-allow-chromium-download :
- You should run from inside notebook's directory (by doing cd folder name and make sure you have Untitled.ipynb file in there with any content - content doesn't matter)
- "Untitled" is the name of your notebook
- After manually downloading chromium once, you can download as pdf from Jupyter
Chromium installation would happen only once, then you can use the File > Download as > PDF via HTML
So, now I am able to download; this is still messing out Raw cells but Markdown and Code cells are coming out fine in PDF that is been downloaded.
This issue has been mentioned on Jupyter Community Forum. There might be relevant details there:
https://discourse.jupyter.org/t/inkscape-error-when-converting-julia-notebook-to-pdf/13112/5
I think this video will work for you. https://youtu.be/3RkFjA3lcB0