Jupyter 真香

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 the pip3 into you raspi.

Install Jupyter

  • Before we install Jupyter, we have to check if we have install some necessary packages: matplotlib, numpy and scipy:
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 type sudo 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:

  1. http://jupyter.org
  2. https://en.wikipedia.org/wiki/Project_Jupyter
  3. http://jupyter-notebook.readthedocs.io/en/stable/index.html
  4. http://www.instructables.com/id/Jupyter-Notebook-on-Raspberry-Pi/

原文来自我的 github: https://github.com/TerenceLiu98/Self_Study/wiki/What-is-Jupyter-%3F

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 199,711评论 5 468
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 83,932评论 2 376
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 146,770评论 0 330
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 53,799评论 1 271
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 62,697评论 5 359
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,069评论 1 276
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 37,535评论 3 390
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,200评论 0 254
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,353评论 1 294
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,290评论 2 317
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,331评论 1 329
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,020评论 3 315
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,610评论 3 303
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,694评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 30,927评论 1 255
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 42,330评论 2 346
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 41,904评论 2 341

推荐阅读更多精彩内容