2-3. Jupyterのインストール
## いよいよJupyterをインストールします
吐き出されたの全部載せますが、コマンドは1行です。
[me@PC ~]$ pip install jupyter Collecting jupyter Downloading jupyter-1.0.0-py2.py3-none-any.whl Collecting qtconsole (from jupyter) Downloading qtconsole-4.2.1-py2.py3-none-any.whl (104kB) 100% |████████████████████████████████| 112kB 1.0MB/s Collecting ipywidgets (from jupyter) Downloading ipywidgets-5.2.2-py2.py3-none-any.whl (43kB) 100% |████████████████████████████████| 51kB 1.4MB/s Collecting ipykernel (from jupyter) Downloading ipykernel-4.5.2-py2.py3-none-any.whl (98kB) 100% |████████████████████████████████| 102kB 1.6MB/s Collecting jupyter-console (from jupyter) Downloading jupyter_console-5.0.0-py2.py3-none-any.whl Collecting notebook (from jupyter) Downloading notebook-4.3.1-py2.py3-none-any.whl (6.8MB) 100% |████████████████████████████████| 6.8MB 30kB/s Collecting nbconvert (from jupyter) Downloading nbconvert-5.0.0-py2.py3-none-any.whl (371kB) 100% |████████████████████████████████| 378kB 638kB/s Collecting traitlets (from qtconsole->jupyter) Downloading traitlets-4.3.1-py2.py3-none-any.whl (74kB) 100% |████████████████████████████████| 81kB 1.2MB/s Collecting jupyter-client>=4.1 (from qtconsole->jupyter) Downloading jupyter_client-4.4.0-py2.py3-none-any.whl (76kB) 100% |████████████████████████████████| 81kB 78kB/s Collecting jupyter-core (from qtconsole->jupyter) Downloading jupyter_core-4.2.1-py2.py3-none-any.whl (125kB) 100% |████████████████████████████████| 133kB 1.0MB/s Collecting pygments (from qtconsole->jupyter) Downloading Pygments-2.1.3-py2.py3-none-any.whl (755kB) 100% |████████████████████████████████| 757kB 394kB/s Collecting ipython>=4.0.0 (from ipywidgets->jupyter) Downloading ipython-5.1.0-py3-none-any.whl (747kB) 100% |████████████████████████████████| 747kB 368kB/s Collecting widgetsnbextension>=1.2.6 (from ipywidgets->jupyter) Downloading widgetsnbextension-1.2.6-py2.py3-none-any.whl (1.5MB) 100% |████████████████████████████████| 1.5MB 216kB/s Collecting tornado>=4.0 (from ipykernel->jupyter) Downloading tornado-4.4.2.tar.gz (460kB) 100% |████████████████████████████████| 460kB 549kB/s Collecting prompt-toolkit<2.0.0,>=1.0.0 (from jupyter-console->jupyter) Downloading prompt_toolkit-1.0.9-py3-none-any.whl (241kB) 100% |████████████████████████████████| 245kB 1.1MB/s Collecting ipython-genutils (from notebook->jupyter) Downloading ipython_genutils-0.1.0-py2.py3-none-any.whl Collecting nbformat (from notebook->jupyter) Downloading nbformat-4.2.0-py2.py3-none-any.whl (153kB) 100% |████████████████████████████████| 153kB 188kB/s Collecting terminado>=0.3.3; sys_platform != "win32" (from notebook->jupyter) Downloading terminado-0.6.tar.gz Collecting jinja2 (from notebook->jupyter) Downloading Jinja2-2.8.1-py2.py3-none-any.whl (264kB) 100% |████████████████████████████████| 266kB 1.0MB/s Collecting pandocfilters>=1.4.1 (from nbconvert->jupyter) Downloading pandocfilters-1.4.1.tar.gz Collecting bleach (from nbconvert->jupyter) Downloading bleach-1.5.0-py2.py3-none-any.whl Collecting testpath (from nbconvert->jupyter) Downloading testpath-0.3-py2.py3-none-any.whl (82kB) 100% |████████████████████████████████| 92kB 242kB/s Collecting entrypoints>=0.2.2 (from nbconvert->jupyter) Downloading entrypoints-0.2.2-py2.py3-none-any.whl Collecting mistune!=0.6 (from nbconvert->jupyter) Downloading mistune-0.7.3-py2.py3-none-any.whl Collecting six (from traitlets->qtconsole->jupyter) Downloading six-1.10.0-py2.py3-none-any.whl Collecting decorator (from traitlets->qtconsole->jupyter) Downloading decorator-4.0.10-py2.py3-none-any.whl Collecting pyzmq>=13 (from jupyter-client>=4.1->qtconsole->jupyter) Downloading pyzmq-16.0.2-cp36-cp36m-manylinux1_x86_64.whl (3.0MB) 100% |████████████████████████████████| 3.1MB 93kB/s Collecting pickleshare (from ipython>=4.0.0->ipywidgets->jupyter) Downloading pickleshare-0.7.4-py2.py3-none-any.whl Collecting pexpect; sys_platform != "win32" (from ipython>=4.0.0->ipywidgets->jupyter) Downloading pexpect-4.2.1-py2.py3-none-any.whl (55kB) 100% |████████████████████████████████| 61kB 200kB/s Requirement already satisfied: setuptools>=18.5 in ./.pyenv/versions/3.6.0/lib/python3.6/site-packages (from ipython>=4.0.0->ipywidgets->jupyter) Collecting simplegeneric>0.8 (from ipython>=4.0.0->ipywidgets->jupyter) Downloading simplegeneric-0.8.1.zip Collecting wcwidth (from prompt-toolkit<2.0.0,>=1.0.0->jupyter-console->jupyter) Downloading wcwidth-0.1.7-py2.py3-none-any.whl Collecting jsonschema!=2.5.0,>=2.4 (from nbformat->notebook->jupyter) Downloading jsonschema-2.5.1-py2.py3-none-any.whl Collecting ptyprocess (from terminado>=0.3.3; sys_platform != "win32"->notebook->jupyter) Downloading ptyprocess-0.5.1-py2.py3-none-any.whl Collecting MarkupSafe (from jinja2->notebook->jupyter) Downloading MarkupSafe-0.23.tar.gz Collecting html5lib!=0.9999,!=0.99999,<0.99999999,>=0.999 (from bleach->nbconvert->jupyter) Downloading html5lib-0.9999999.tar.gz (889kB) 100% |████████████████████████████████| 890kB 264kB/s Installing collected packages: six, ipython-genutils, decorator, traitlets, pyzmq, jupyter-core, jupyter-client, tornado, pickleshare, pygments, ptyprocess, pexpect, wcwidth, prompt-toolkit, simplegeneric, ipython, ipykernel, qtconsole, jsonschema, nbformat, terminado, pandocfilters, html5lib, bleach, testpath, entrypoints, MarkupSafe, jinja2, mistune, nbconvert, notebook, widgetsnbextension, ipywidgets, jupyter-console, jupyter Running setup.py install for tornado ... done Running setup.py install for simplegeneric ... done Running setup.py install for terminado ... done Running setup.py install for pandocfilters ... done Running setup.py install for html5lib ... done Running setup.py install for MarkupSafe ... done Successfully installed MarkupSafe-0.23 bleach-1.5.0 decorator-4.0.10 entrypoints-0.2.2 html5lib-0.9999999 ipykernel-4.5.2 ipython-5.1.0 ipython-genutils-0.1.0 ipywidgets-5.2.2 jinja2-2.8.1 jsonschema-2.5.1 jupyter-1.0.0 jupyter-client-4.4.0 jupyter-console-5.0.0 jupyter-core-4.2.1 mistune-0.7.3 nbconvert-5.0.0 nbformat-4.2.0 notebook-4.3.1 pandocfilters-1.4.1 pexpect-4.2.1 pickleshare-0.7.4 prompt-toolkit-1.0.9 ptyprocess-0.5.1 pygments-2.1.3 pyzmq-16.0.2 qtconsole-4.2.1 simplegeneric-0.8.1 six-1.10.0 terminado-0.6 testpath-0.3 tornado-4.4.2 traitlets-4.3.1 wcwidth-0.1.7 widgetsnbextension-1.2.6 [me@PC ~]$
続いて、Jupyter notebookの設定をします。
その前に、認証用のパスワードを作成します。
[me@PC ~]$ ipython3 Python 3.6.0 (default, Jan 4 2017, 01:52:52) Type "copyright", "credits" or "license" for more information. IPython 5.1.0 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object', use 'object??' for extra details. In [1]: from notebook.auth import passwd In [2]: passwd() Enter password: Verify password: Out[2]: 'sha1:68a878e770dd:f3a15262d7a59d744d4eca4284d3489821e30e51' In [3]: exit() [me@PC ~]$
Out[2]に出力された'sha1:...'の文字列がパスワードがハッシュ化されたものです。これを以下の設定ファイルに書きます。
[me@PC ~]$ jupyter notebook --generate-config Writing default config to: /home/me/.jupyter/jupyter_notebook_config.py [me@PC ~]$ vi .jupyter/jupyter_notebook_config.py
# 全てのIPアドレスから着信を許可する #c.NotebookApp.ip = 'localhost' c.NotebookApp.ip = '*' # ノートブックのデフォルトパスを指定する #c.NotebookApp.notebook_dir = '' c.NotebookApp.notebook_dir = '/home/me/jupyternotebook' # 起動時にブラウザを開く設定をOFFにする(GUI環境でないのでWARNING出ないように) #c.NotebookApp.open_browser = True c.NotebookApp.open_browser = False # パスワード(上記で吐き出したハッシュをコピー) #c.NotebookApp.password = '' c.NotebookApp.password = 'sha1:68a878e770dd:f3a15262d7a59d744d4eca4284d3489821e30e51'
さて起動してくれるでしょうか!?
notebook用のディレクトリを作成し、いざ起動!
[me@PC ~]$ mkdir jupyternotebook [me@PC ~]$ jupyter notebook [I 02:35:59.512 NotebookApp] Writing notebook server cookie secret to /run/user/1001/jupyter/notebook_cookie_secret [W 02:35:59.624 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended. [I 02:35:59.645 NotebookApp] Serving notebooks from local directory: /home/me/jupyternotebook [I 02:35:59.646 NotebookApp] 0 active kernels [I 02:35:59.646 NotebookApp] The Jupyter Notebook is running at: http://[all ip addresses on your system]:8888/ [I 02:35:59.647 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
ブラウザを起動して、http://localhost:18888 へGO!
ログイン画面が出ました!
ディレクトリツリーが表示されました!
New -> Python3 と選ぶと・・・新規ノートブックが開きます。
ためしに、1+2と打って、Shift+Enter!
計算結果が 3 と出ました。
動作確認OKです。
[次は、ライブラリのインストール](/2017/01/makejupyter24.html)