LoginSignup
74
77

More than 1 year has passed since last update.

リモートサーバでjupyter notebookを起動させローカル環境で使う

Last updated at Posted at 2017-11-06

#やりたいこと

  1. 高性能GPU搭載サーバに自分のmacでリモート接続(今回はローカルLAN環境)
  2. リモート上でJupyter Notebookを起動しプログラムの実装・実行

#環境
Python 3.5.2
macOS Sierra 10.12.6

#実装
まずJupyter Notebookをインストール
pip install jupyter

ipythonを起動してJupyterログイン時のパスワードを設定

$ ipython

In [1]: from notebook.auth import passwd

In [2]: passwd()
Enter password: [パスワードを入力]
Verify password: [パスワードを再度入力]
Out[2]: 'sha1: [ハッシュ化されたパスワード]'

外部接続環境用の設定ファイルを作成

$ mkdir ~/.jupyter
$ vim ~/.jupyter/jupyter_notebook_config.py
jupyter_notebook_config.py
c = get_config()

# Notebook上でplotを表示できるようにする
c.IPKernelApp.pylab = 'inline'
# 全てのIPから接続を許可
c.NotebookApp.ip = '*'
# IPython notebookのログインパスワード
c.NotebookApp.password = 'sha1:[ハッシュ化されたパスワード]'
# 起動時にブラウザを起動させるかの設定
c.NotebookApp.open_browser = False
# ポート指定
c.NotebookApp.port = [接続ポート]

Jupyter起動
jupyter notebook

リモートサーバからhttp://[all ip addresses on your system]:[接続ポート]/に接続してねと言われるので接続する。
設定したパスワードを入力してログインする。

#終わりに
Jupyter Notebookで効率的なプログラミングライフを目指しましょう。

74
77
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
74
77