LoginSignup
4
3

More than 5 years have passed since last update.

bash on Windowsでjupyterを動かすときにちょっとハマった

Last updated at Posted at 2016-08-21

インストールは簡単だったが動かなかったJupyterの設定方法。
カーネルが落ちるという場合はlibzmq3の修正パッチで対応する下記ももしかするとこちらも参考になると思います。
http://qiita.com/ytakashina/items/0a99b78dbfe160c28ee0
元ネタ:https://github.com/Microsoft/BashOnWindows/issues/185

起動しないという課題

bash on Windowsは基本的にUbuntu環境なので、pipまでインストールできればJupyterをインストールするのは難しくありませんでした。
基本的な流れは下記にあるとおりです。
http://qiita.com/taka4sato/items/2c3397ff34c440044978

起動してみますとこんな「ポートが使われている」というエラーが出ます。

$ jupyter notebook
[W 23:02:29.351 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[I 23:02:29.398 NotebookApp] The port 3000 is already in use, trying another port.
[I 23:02:29.398 NotebookApp] The port 3001 is already in use, trying another port.
[I 23:02:29.398 NotebookApp] The port 3002 is already in use, trying another port.
[I 23:02:29.398 NotebookApp] The port 3003 is already in use, trying another port.
・・・

問題の本質

問題は設定にあったようです。

c.NotebookApp.ip = '*'

こう書くと、pythonのtornado(webサーバ)が中で動くんですが、そいつがどうもIPv6をデフォルトとして起動するようです。
bash on Windows はまだIPv6への対応が甘いんでしょうか、それとも私のネットワーク環境がIPv4しか対応していないのでしょうか。
いずれにしろ、下記にもあるとおりIPv6じゃなくIPv4であることを明示すればよいらしいです。
https://github.com/ocsigen/ocsigenserver/issues/104

よって設定を下記に変更します。

#c.NotebookApp.ip = '*'
c.NotebookApp.ip = '127.0.0.1'

そうすると動きます。

$ jupyter notebook
[I 23:08:18.647 NotebookApp] Serving notebooks from local directory: /****/tensorflow
[I 23:08:18.649 NotebookApp] 0 active kernels
[I 23:08:18.649 NotebookApp] The Jupyter Notebook is running at: http://127.0.0.1:3000/

以上

4
3
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
4
3