skip to Main Content

I have fulfilled all the requirements for exporting a jupyter notebook (ipynb) to pdf in VScode but still, it gives me the same error of installing TeX, Although

I have MiKTex installed in my system
I have Installed TeX package
I have Pandoc installed in my system.

When I installed MiKTeX and TeX it was not working but when I installed Pandoc it just worked once but now it giving me the same error.

This is how I have installed the dependencies:

  • I have installed nbconvert through this command pip install nbconvert.

  • For TeX pip install tex

  • For pandoc i downloaded an .exe file from their website and installed it in my system, besides this I also installed pandoc package through this command in terminal pip install pandoc

However I still have an error:

error 13:11:2.772: If you have not installed xelatex (TeX) you will
need to do so before you can export to PDF, for further instructions
please look
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.

Kindly Help me in this regard TIA.

2

Answers


  1. Open the jupyter file with Chrome and convert it to PDF by printing. This way is simpler and more effective.


    UPDATE:

    • First make sure that the path environment variable of Tex already exists in your machine

      enter image description here

    • Then run vscode with admin

      enter image description here

    • Use the following command in the terminal (or the terminal where the virtual environment is activated if using a virtual environment) to export the PDF

      # Remember to replace your_notebook with your filename
      jupyter nbconvert your_notebook.ipynb --to pdf
      

      enter image description here

      During the execution of the command, many such pop-up windows may pop up prompting you to install files, please select "Install"

      enter image description here

      Sorry for the Chinese interface

    • After the command is executed, a PDF file will be generated in the same directory as your jupyter file.

      enter image description here

    After that you can run vscode without administrator and export PDF. Also, the interfaced export can also be used.

    enter image description here

    Login or Signup to reply.
  2. The installation of MiKTeX and TeX depends on the operating system.

    If you are using Linux try executing the following code inside the terminal of your environment:

    apt-get install texlive-xetex texlive-fonts-recommended texlive-plain-generic
    

    If you are using Windows you should get the MiKTeX exe here and install it following the wizard. The installation is really simple (just follow the wizard), but if you need to, you can check out the official instructions.

    Also refer to this link for full instructions to install the additional packages that may be needed by nbconvert.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search