2018年9月9日日曜日

Jupyter notebookをアップデートしたら起動しなくなったのでいろいろ直した

(Ubuntu16.04, Python3.6)

Jupyter notebookをアップデートしたら起動しなくなったのですが・・・。

jupyter notebook
Traceback (most recent call last):
  File "/home/***/anaconda3/bin/jupyter-notebook", line 7, in <module>
    from notebook.notebookapp import main
  File "/home/***/anaconda3/lib/python3.6/site-packages/notebook/notebookapp.py", line 46, in <module>
    from zmq.eventloop import ioloop
  File "/home/***/anaconda3/lib/python3.6/site-packages/zmq/__init__.py", line 47, in <module>
    from zmq import backend
  File "/home/***/anaconda3/lib/python3.6/site-packages/zmq/backend/__init__.py", line 40, in <module>
    reraise(*exc_info)
  File "/home/***/anaconda3/lib/python3.6/site-packages/zmq/utils/sixcerpt.py", line 34, in reraise
    raise value
  File "/home/***/anaconda3/lib/python3.6/site-packages/zmq/backend/__init__.py", line 27, in <module>
    _ns = select_backend(first)
  File "/home/***/anaconda3/lib/python3.6/site-packages/zmq/backend/select.py", line 26, in select_backend
    mod = __import__(name, fromlist=public_api)
  File "/home/***/anaconda3/lib/python3.6/site-packages/zmq/backend/cython/__init__.py", line 6, in <module>
    from . import (constants, error, message, context,
ImportError: libsodium.so.23: cannot open shared object file: No such file or director

結局、libsodiumというモジュールがcondaに入っていない、または更新されていないのが問題だったようです。https://github.com/conda/conda/issues/7509

conda install -c conda-forge libsodium
とやると、このエラーは解決しました。


notebookは起動するようになっても、ipynbを開くと
500 : Internal Server Error
が出てしまい、、

[E 17:41:50.078 NotebookApp] Uncaught exception GET xxx/xxx.ipynb (127.0.0.1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='xxx/xxx.ipynb', version='HTTP/1.1', remote_ip='127.0.0.1', headers={'Host': 'localhost:8888', 'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language': 'en-US,en;q=0.5', 'Accept-Encoding': 'gzip, deflate'

      File "/home/***/anaconda3/lib/python3.6/site-packages/tornado/web.py", line 1467, in _execute
        result = method(*self.path_args, **self.path_kwargs)
      File "/home/***/anaconda3/lib/python3.6/site-packages/tornado/web.py", line 2829, in wrapper
        return method(self, *args, **kwargs)
      File "/home/***/anaconda3/lib/python3.6/site-packages/notebook/notebook/handlers.py", line 59, in get
        get_custom_frontend_exporters=get_custom_frontend_exporters
      File "/home/***/anaconda3/lib/python3.6/site-packages/notebook/base/handlers.py", line 463, in render_template
        return template.render(**ns)
      File "/home/***/anaconda3/lib/python3.6/site-packages/jinja2/asyncsupport.py", line 76, in render
        return original_render(self, *args, **kwargs)
      File "/home/***/anaconda3/lib/python3.6/site-packages/jinja2/environment.py", line 1008, in render
        return self.environment.handle_exception(exc_info, True)
      File "/home/***/anaconda3/lib/python3.6/site-packages/jinja2/environment.py", line 780, in handle_exception
        reraise(exc_type, exc_value, tb)
      File "/home/***/anaconda3/lib/python3.6/site-packages/jinja2/_compat.py", line 37, in reraise
        raise value.with_traceback(tb)
      File "/home/***/anaconda3/lib/python3.6/site-packages/notebook/templates/notebook.html", line 1, in top-level template code
        {% extends "page.html" %}
      File "/home/***/anaconda3/lib/python3.6/site-packages/notebook/templates/page.html", line 154, in top-level template code
        {% block header %}
      File "/home/***/anaconda3/lib/python3.6/site-packages/notebook/templates/notebook.html", line 120, in block "header"
        {% for exporter in get_custom_frontend_exporters() %}
      File "/home/***/anaconda3/lib/python3.6/site-packages/notebook/notebook/handlers.py", line 19, in get_custom_frontend_exporters
        from nbconvert.exporters.base import get_export_names, get_exporter
    ModuleNotFoundError: No module named 'nbconvert.exporters.base'
[E 17:41:50.083 NotebookApp] {
      "Host": "localhost:8888",
      "User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0",
      "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
      "Accept-Language": "en-US,en;q=0.5",
      "Accept-Encoding": "gzip, deflate",
      "Referer": "http://localhost:8888/tree/anaconda3/_python/2ch",
      "Connection": "keep-alive",
      "Upgrade-Insecure-Requests": "1"
    }

 from nbconvert.exporters.base import get_export_names, get_exporter
    ModuleNotFoundError: No module named 'nbconvert.exporters.base'
らへんからnbconvertが問題だということが分かり、

conda upgrade nbconvert

で同時にいろいろインストールされて解決しました。html周りのアップデートなんでしょうか。

ちなみに、Jupyterを長い間アップデートしていなかったのですが、ファイル選択画面で最終更新時間とサイズが追加されていて、使いやすくなりました。

0 件のコメント:

コメントを投稿