Skip to content

Instantly share code, notes, and snippets.

Last active January 20, 2018 11:07
Show Gist options
  • Save anonymous/8be4bfd28ad66d542a304cf84049102f to your computer and use it in GitHub Desktop.
Save anonymous/8be4bfd28ad66d542a304cf84049102f to your computer and use it in GitHub Desktop.
awsでjypyter notebookを構築してみる
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"metadata": {},
"cell_type": "markdown",
"source": "# pythonとjupyter notebookのインストール"
},
{
"metadata": {},
"cell_type": "markdown",
"source": "aws linuxの場合\n\nインストールできるバージョンを調べる: \n```yum list available |grep ^python```\n\nインストールは普通に \n```yum install python**```\n\n普通ならpipがデフォルトでついてくるが、付いてない場合は別途インストールする。 \nインストールされたpythonや付随するpipの起動コマンドは下記のように調べる(デフォルトではpython2.7が起動する): \n```ls /usr/bin |grep pip```\n\njupyter notebookのインストールは普通にpip install: \n```pip** install jupyter```"
},
{
"metadata": {},
"cell_type": "markdown",
"source": "# jupyter notebookのセッティング"
},
{
"metadata": {},
"cell_type": "markdown",
"source": "- 設定ファイルの雛形を作る:\n\n```jupyter notebook --generate-config```\n\nすると~/.jupyter/jupyter_notebook_config.pyが作成されて、ここを編集すればjupyterのオプションを変えることができる。"
},
{
"metadata": {},
"cell_type": "markdown",
"source": "- 次の五行をjupyter_notebook_config.pyに入れる\n\n```\nc = get_config() #config開始\nc.NotebookApp.ip = '0.0.0.0' #全てのipアドレスからの接続を許可する \nc.NotebookApp.open_browser = False #起動時にいちいちブラウザを立ち上げない\nc.NotebookApp.port = 8888 #jupyterサーバーのポート\nc.NotebookApp.password = 'sha1:ひょにゃらら' #jupyter notebookに接続するためのパスワード(ハッシュ値)\n```"
},
{
"metadata": {},
"cell_type": "markdown",
"source": "* パスワードのハッシュ値の生成(pythonのライブラリを使う。ipythonの場合):\n\n```\nipython\nIn [1]: from notebook.auth import passwd;passwd()\nEnter password:\nVerify password:\nOut[1]: 'sha1:........'\n```"
},
{
"metadata": {},
"cell_type": "markdown",
"source": "参考に:https://qiita.com/taka4sato/items/2c3397ff34c440044978"
},
{
"metadata": {},
"cell_type": "markdown",
"source": "# 実行"
},
{
"metadata": {},
"cell_type": "markdown",
"source": "- 普通に「jupyter notebook」を打つとssh接続を終了させるとjupyter notebookも終了してしまう。\n- nohupを前に付けて実行すればawsからログアウトしても引き続きjupyterを使える。\n\n例: \n```nohup jupyter notebook 1>j.log 2>je.log &```"
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "",
"execution_count": null,
"outputs": []
}
],
"metadata": {
"kernelspec": {
"name": "python3",
"display_name": "Python 3",
"language": "python"
},
"language_info": {
"name": "python",
"version": "3.6.2",
"mimetype": "text/x-python",
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"pygments_lexer": "ipython3",
"nbconvert_exporter": "python",
"file_extension": ".py"
},
"toc": {
"nav_menu": {},
"number_sections": true,
"sideBar": false,
"skip_h1_title": false,
"toc_cell": false,
"toc_position": {
"height": "40px",
"left": "1005px",
"right": "91px",
"top": "204px",
"width": "182px"
},
"toc_section_display": "block",
"toc_window_display": true
},
"gist": {
"id": "",
"data": {
"description": "awsでjypyter notebookを構築してみる",
"public": true
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment