What is Jupyter ?
Jupyter, also called Project Jupyter, is a nonprofit organization created to "develop open-source software, open-standards, and services for interactive computing across dozens of programming languages." Spun-off from IPython in 2014 by Fernando Pérez, Project Jupyter supports execution environments in several dozen languages. Project Jupyter's name is a reference to the three core programming languages supported by Jupyter, which are Julia, Python and R, and also an homage to Galileo's notebooks recording the discovery of the moons of Jupiter. Project Jupyter has developed and supported the interactive computing products Jupyter Notebook, Jupyter Hub, and Jupyter Lab, the next-generation version of Jupyter Notebook.
Its Philosophy
Project Jupyter's operating philosophy is to support interactive data science and scientific computing across all programming languages via the development of open-source software. According to the Project Jupyter website, "Jupyter will always be 100% open-source software, free for all to use and released under the liberal terms of the modified BSD license."
Why I choose Jupyter
Jupyter is a good platform to show the code and show the instruction. It can easily show the plot as well, which is very convenience for the instructor. Especially, Jupyter can change its kernel, which means it can support many
different computer language, not only python
but also MATLAB
, R
, Java
, etc.
How to set up the Jupyter Development Environment in Your RaspberryPI (Also Debian/Ubuntu/macOS)
It is not very difficult for you to set up the DE, you can follow the direction of the <a href="https://jupyter.readthedocs.io/en/latest/">Jupyter's Site</a> (Jupyter metapackage for installation, docs and chat) with installed Anaconda. Or, following the following steps using pip3
Install Python
and pip3
Install Python
If you use the The Rasbian Stretch ISO, it has installed Python2
and Python3
ahead. Check your Python's version with command: Python2 -V
for Python2
and Python3 -V
for Python3
.
If your system did not install Python2
or Python3
advance, you can install Python
manually: sudo apt-get install python
for Python2
or sudo apt-get install python3
for Python3
I highly recommend you to use Python3
, there are a few minor downsides, such as very slightly worse library support and the fact that some current Linux distributions and Macs still use 2.x as default, but as a language Python 3.x is definitely mature and ready for use.
I will use Python3
for the following article.
Install pip3
If you have Python3
already, it is easy for you to install pip3
:
First, you have to update:
sudo apt-get update
, this can downloads the package lists from the repositories and "updates" them to get information on the newest versions of packages and their dependencies.Second,
sudo apt-get install python3-pip
, this can install thepip3
into you raspi.
Install Jupyter
- Before we install Jupyter, we have to check if we have install some necessary packages:
matplotlib
,numpy
andscipy
:
sudo su -
apt-get update
apt-get install python3-matplotlib
apt-get install python3-scipy
pip3 install --upgrade pip
type these commands line by line
After installed those packages, we have to reboot and make them take effect. Type
reboot
.Just like what we did in the previous step but not exactly the same, we don't use
apt-get
to install Jupyter: we just typesudo pip3 install jupyter
. I believe these operations can work!Check if the Jupyter whether it has been installed successfully or not, type
jupyter-notebook
. If the broker jump out a page:
Congratulations! You have installed the Jupyter in your device.
Set Up your Jupyter
If you use raspi like me, you won't want to use the GUI of the raspi, then you have to run a notebook sever:
The Jupyter notebook web application is based on a server-client structure. The notebook server uses a two-process kernel architecture based on ZeroMQ, as well as Tornado for serving HTTP requests.
First, jupyter notebook --generate-config
to create a config files. Then, jupyter notebook password
, you can set a password for your jupyter notebook. Just looks like this:
pi@raspi2:~ $ jupyter notebook --generate-config
Writing default config to: /home/pi/.jupyter/jupyter_notebook_config.py
jupyter notebook password
pi@raspi2:~ $ jupyter notebook --generate-config
Writing default config to: /home/pi/.jupyter/jupyter_notebook_config.py
pi@raspi2:~ $ jupyter notebook password
Enter password:
Verify password:
[NotebookPasswordApp] Wrote hashed password to /home/pi/.jupyter/jupyter_notebook_config.json
Attention! When you type the password, the password is invisible
If this is a real Jupyter Server, I mean you have a IP address for it, you better to use SSL with a web certificate, so that your hashed password is not sent unencrypted by your browser. You can find more information in <a href="http://jupyter-notebook.readthedocs.io/en/stable/public_server.html">Use SSL</a>
Also, you have to make all ip can use your server. Go to ~/.jupyter
and edit in jupyter_notebook_config.py is the following:
# Set ip to '*' to bind on all interfaces (ips) for the public server
c.NotebookApp.ip = '*'
# It is good to you to turn off `open browser` automatically
c.NotebookApp.open_browser = False
# It is a good idea to set a known, fixed port for server access
c.NotebookApp.port = 9999
Use vim
or nano
to edit files in terminal is a good idea. For installing vim
, type: sudo apt-get install vim
Install other Kernel
Kernel Zero is IPython, which you can get through ipykernel, and is still a dependency of jupyter. The IPython kernel can be thought of as a reference implementation, as CPython is for Python.
We can check the <a href="https://github.com/jupyter/jupyter/wiki/Jupyter-kernels"> list </a> if you want to change the kernel.
Install Jupyter-c-kernel
You can follow the steps in <a href="https://github.com/brendan-rius/jupyter-c-kernel"> jupyter-c-kernel </a>
Notice, if you are not in a root, you will see this:
$pip3 install jupyter-c-kernel
#you will see : Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python3.5/dist-packages/jupyter_c_kernel'
Consider using the `--user` option or check the permissions.
You should type pip3 install jupyter-c-kernel --user
and sudo pip3 install jupyter-c-kernel
Then, you should type jupyter_c_kernel --user
Install Octave Kernel
Reference:
- http://jupyter.org
- https://en.wikipedia.org/wiki/Project_Jupyter
- http://jupyter-notebook.readthedocs.io/en/stable/index.html
- http://www.instructables.com/id/Jupyter-Notebook-on-Raspberry-Pi/
原文来自我的 github: https://github.com/TerenceLiu98/Self_Study/wiki/What-is-Jupyter-%3F