Jupyter/JupyterHub

インストール

Configuration with JupyterHub can get pretty confusing, since there are so many layers:

  1. JupyterHub config: a single jupyterhub_config.py, in the CWD or specified via jupyterhub -f /path/to/config.py. This does not affect the configuration of the IPython servers for your users, other than the ability to change the command-line arguments used to start those servers.
  2. single-user instances of ipython notebook. These can load kernels from:
    • /usr/local/share/jupyter/kernels
    • ~/.ipython/kernels (separate for each user)
  3. profiles, which are only a notion of the single-user ipython server, and distinct for each user. You can set the profile for each user in the JupyterHub configuration by adding '--profile=foo' to Spawner.cmd. This, however, would require you populating the profile directory in every users ~/.ipython directory. I wouldn't recommend doing this.
  4. IPython actually has a notion of system-wide config, so you can set defaults for all users. This is the most likely place for JupyterHub admins to put config for their users' IPython instances. You can create and edit the file /etc/ipython/ipython_notebook_config.py or /etc/ipython/ipython_config.py to set global defaults for all users.

ローカルディレクトリ(?)を変更する(例えば、jupyterが開いた時のフォルダーを~/ALBDATAにする)
/etc/jupyterhub/jupyterhub.py に以下の記述
c.Spawner.notebook_dir = '~/ALBDATA'

起動時に以下のエラー
Proxy appears to be running at http://*:8000/, but I can't access it (HTTP 403: Forbidden)
    Did CONFIGPROXY_AUTH_TOKEN change?

jupyterhubのプロセスをkill -9 して、再起動したときこのエラーが出た
[対策]
    proxyをしているnodeプロセスを殺す

ImportError: No module named 'bokeh' と言われたときの対策
  1. 以下を実行して、使われているpythonを調べる import sys sys.executable 今回は、/usr/bin/python3.4だった
  2. 使われているpythonに対応したpip3.4を使って pip3.4 install bokeh

pipでjupyterhubをupdate
pip3.4 install -U jupyterhub jupyterhub upgrade-db

import bokehで以下のエラー
Loading BokehJS ...
Javascript error adding output!
TypeError: OutputArea.prototype.mime_types is not a function
See your browser Javascript console for more details.
Javascript consoleを開くと以下のエラー発見
Loading failed for the <script> with source “https://192.168.0.105:8000/user/seijirom/nbextensions/widgets/notebook/js/extension.js?v=20180116103050”.

nbextensionsに問題があるようなので、pip3.4 install -U widgetsnbextensionを実行すると、以下のようにバージョンアップし解決した!
nbconvert (4.2.0 -> 5.3.1)
nbformat (4.1.0 -> 4.4.0)
widgetsnbextension (1.2.6 -> 3.1.0)
Comments