Jupyter Notebook is a web application that allows you to create and share documents containing program code, formulas, diagrams, explanations, etc.
The following features are listed on the official website.
--Supports over 40 programming languages such as Python, R and Scala --You can share your notebook via email, Dropbox, GitHub, or Jupyter Notebook Viewer. --Notebooks are saved in json format with the extension ipynb, but can be converted to other formats such as html and pdf --The input code is processed interactively and can be output as images, videos, LaTeX, JavaScript, etc.
Other
--Markdown can be used as a description -Enclosed in $$, LaTeX commands are recognized and can be used (basically only mathematical formulas should be supported)
I like that.
Basically, it is for personal use by setting up a local server, but if you use Jupyterhub, you can use it even in a multi-user environment. I can do it.
Several other subprojects are officially supported, so if you're curious, you might want to check out the following:
In Jupyter, the kernel is the process of interactively processing the input code and returning the result.
IPython is used as the kernel that executes Python processing, but if you want to process other languages, you need to install the kernel for that language separately.
You may want to install the programming you want to study.
See below for available kernels.
I think the big difference is the ability to process the code interactively.
Therefore, it is convenient to modify the code that you tried and write a description in Markdown and save it as it is as a document.
You may find it helpful to look at the Jupyter Notebook Viewer.
The installation method is described in detail below.
I used pip because I installed it on Python2 series, but if I use pip3 it should be installed on Python3 series.
pip install jupyter
You can start it with jupyter notebook.
If you execute it as it is, the executed directory will be used as the home of the notebook, so it may be better to create and move the directory for the notebook before executing it.
jupyter notebook
Check the command options below.
jupyter notebook --help
# or
jupyter notebook --help-all
When installed with pip, the only kernel that can be used is Python2, and Python3 is not available from the beginning.
Make the Python3 kernel available by doing the following:
python3 -m IPython kernelspec install-self
When executed, the Python3 kernel will be added to / usr / local / share / jupyter / kernels
.
If you want to install with pip3 and use Python2, it is as follows.
python2 -m IPython kernelspec install-self
Please refer to the following.
Most notations are available, and syntax highlighting for programming languages is also possible.
Jupyter config files are put in ~ / .jupyter
by default.
First, execute the following command to create a config file. When executed, a file called jupyter_application_config.py
will be created in ~ / .jupyter
.
jupyter notebook --generate-config
When you open the created file, you will see the commented out settings. Check the contents and enable the required settings.
I haven't checked all the settings, but I have set the following for the time being.
# The port the notebook server will listen on.
c.NotebookApp.port = 8080
# The directory to use for notebooks and kernels.
c.NotebookApp.notebook_dir = u'/Path/to/notebooks/'
notebook_dir is the home directory setting for Jupyter notebooks.
By default, the directory where Jupyter is executed is the home, but I always wanted to set a specific directory as a notebook storage.
Some LaTeX commands, such as formulas, can be executed by enclosing them in $$.
$$
\begin{align}
\sum_{k=1}^{\infty} \frac{1}{k^2} = \frac{\pi^2}{6}
\end{align}
$$
It's like that.
I have prepared a simple example in here, so please check it.
It seems that new command etc. can also be used.
If you manage the created notebook as a repository on GitHub, the notebook can be encoded and viewed from the GitHub page, and can also be viewed from Jupyter Notebook Viewer. I can do it.
In my case, I push the directory set as the notebook directory to GitHub as it is so that I can browse the notebook anytime, anywhere.
Since .ipynb_checkpoints can be created in various places, I try to ignore them with gitignore.
Recommended Posts