星期四, 9月 24, 2015

Jupyterhub with Ubuntu 14.04 小記

另外一篇 jupyterhub 安裝 with Ubuntu 14.04
~ 希望還有時間寫一篇  jupyterhub with openSUSE ^^


OS: Ubuntu 14.04 in GENI

jupyter 官方網頁 https://jupyter.org/


jupyter 是給單人用的, 如果要多人同時使用, 就要使用 jupyterhub

Jupyterhub requires Python  >= 3

檢查 python 版本
$ whereis -b python
python: /usr/bin/python2.7 /usr/bin/python3.4m /usr/bin/python /usr/bin/python3.4 /etc/python2.7 /etc/python /etc/python3.4 /usr/lib/python2.7 /usr/lib/python3.4 /usr/bin/X11/python2.7 /usr/bin/X11/python3.4m /usr/bin/X11/python /usr/bin/X11/python3.4 /usr/local/lib/python2.7 /usr/local/lib/python3.4 /usr/share/python

安裝 jupyterhub 在現有 python 環境底下是使用 pip3 來安裝
預設沒有安裝
$ which   pip
$ dpkg  -l  | grep -i  pip
ii  libpipeline1:amd64                  1.3.0-1                             amd64        pipeline manipulation library

安裝 python-pip 以及 python3-pip 套件
$ sudo  apt-get  update
$ sudo  apt-get  -y  install  python-pip  python3-pip
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
 python-colorama python-distlib python-html5lib python-pkg-resources
 python-setuptools python-wheel
Suggested packages:
 python-genshi python-lxml python-distribute python-distribute-doc
Recommended packages:
 python-dev-all
The following NEW packages will be installed:
 python-colorama python-distlib python-html5lib python-pip
 python-pkg-resources python-setuptools python-wheel
0 upgraded, 7 newly installed, 0 to remove and 86 not upgraded.
Need to get 650 kB of archives.
After this operation, 2,932 kB of additional disk space will be used.
Do you want to continue? [Y/n]  Y




觀察套件資訊
$ dpkg   -l   |  grep -i  pip
ii  libpipeline1:amd64                  1.3.0-1                             amd64        pipeline manipulation library
ii  python-pip                          1.5.4-1ubuntu3                      all          alternative Python package installer
ii  python-pip-whl                      1.5.4-1ubuntu3                      all          alternative Python package installer
ii  python3-pip                         1.5.4-1ubuntu3                      all          alternative Python package installer - Python 3


$ which   pip3
/usr/bin/pip3

要裝 python3-dev 與 python-dev 以及 libzmq3-dev 不然會有 Python.h 的錯誤訊息
$ sudo  apt-get  -y install  python3-dev  python-dev libzmq3-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
 libexpat1 libexpat1-dev libpython3-dev libpython3.4 libpython3.4-dev
 libpython3.4-minimal libpython3.4-stdlib python3.4 python3.4-dev
 python3.4-minimal
Suggested packages:
 python3.4-doc binfmt-support
The following NEW packages will be installed:
 libexpat1-dev libpython3-dev libpython3.4-dev python3-dev python3.4-dev
The following packages will be upgraded:
 libexpat1 libpython3.4 libpython3.4-minimal libpython3.4-stdlib python3.4
 python3.4-minimal
6 upgraded, 5 newly installed, 0 to remove and 178 not upgraded.
Need to get 32.8 MB of archives.
After this operation, 42.8 MB of additional disk space will be used.
Do you want to continue? [Y/n]

安裝相關需要套件
$ sudo  apt-get -y  install   npm   nodejs-legacy

$ sudo  npm   install   -g  configurable-http-proxy

透過 pip3 安裝 jupyterhub
$ sudo   pip3   install   jupyterhub
$ sudo   pip3   install   notebook

最後就是 啟動 jupyterhub 了,  預設會在 port 8000 listen
$sudo  jupyterhub
螢幕快照 2015-09-23 下午3.27.21.png
接下來可以使用 系統內的使用者登入

螢幕快照 2015-09-23 下午3.29.18.png
例如可以新增一個 Python 3 的 notebook

可以在裡面撰寫 python 程式並執行它

螢幕快照 2015-09-23 下午3.28.39.png

也可以利用終端機
是個非常方便的工具

然後也有把上面的過程寫成 shell script
如果懶得自己裝就抓下來執行就好
假設已經有個 sudo 授權的使用者

可以利用 wget 指令把 shell script 抓下來

執行 安裝的 script
$ sh   Ubuntu1404_jupyterhub_Install.sh


~ enjoy it

沒有留言: