Jupyter Notebook is very powerful and convenient, but the latest version will happen the error messages when we want to output the pdf file. So I tried some ways to solve this problem, although the results were not really perfect. (When you output the pdf file, the frame will be too small and some codes will be cut by the frame.) Anyway, you just need to use the function of second part in the nbextensions that you can avoid this problem. I will talk about this function later.
Solve the problem that convert .ipynb to pdf file
- https://nbconvert.readthedocs.io/en/5.x/install.html
- Install the MacTex. File name:
mactex-20180417.pkg
This is quite big (3GB). After installed, it require 5GB stroage. From here: http://tug.org/mactex/mactex-download.html - Also install the pandoc. File name:
pandoc-2.7-macOS.pkg
BTW I saw this method, but I didnt try it yet. From here:https://www.youtube.com/watch?v=bNB3-NcSzIY
Install the nbextensions
It can extend the Jupyter useful widgets.
Install page:
https://jupyter-contrib-nbextensions.readthedocs.io/en/latest/install.html
Type:1
conda install -c conda-forge jupyter_contrib_nbextensions
Good Reference:
- [Chinese] https://zhuanlan.zhihu.com/p/52890101
- Good and useful article in Chinese https://liyang85.com/use-jupyter-notebook-on-macos#MacTeX
- [English] https://towardsdatascience.com/jupyter-notebook-extensions-517fa69d2231
- Introduce Vedic:https://www.youtube.com/watch?v=h9DEfxZSz2M
The problem of autopep8
I recommend this function, Autopep8)
, that it can make your code more beautiful automatically. Moreover, it can also help you to solve the problem which the words (i.e. the code) exceed the frame.
Meet the problem of autopep8
widget
[autopep8] Error loading library for python: ModuleNotFoundErrorNo module named ‘autopep8’ Check that the appropriate library/module is correctly installed (read autopep8’s documentation for details)
Solution:1
pip install autopep8 --user
nbextensions config
If you want to open the interface, you can use the two ways below.
- localhost:8888/nbextensions/
- you can click Edit > nbextensions config
Here is what I install the widgets.