728x90
반응형

jupyter notebook 를 실행하고 Notebook 을 생성하려는데 다음과 같은 에러가 발생했다.

그리고 jupyter 로그를 확인해보니 다음과 같은 에러가 발생했다.

[E 22:14:04.411 NotebookApp] Uncaught exception GET /notebooks/Untitled.ipynb (::1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/notebooks/Untitled.ipynb', version='HTTP/1.1', remote_ip='::1')
    Traceback (most recent call last):
      File "/usr/local/lib/python3.8/site-packages/tornado/web.py", line 1704, in _execute
        result = await result
      File "/usr/local/lib/python3.8/site-packages/tornado/gen.py", line 775, in run
        yielded = self.gen.send(value)
      File "/usr/local/lib/python3.8/site-packages/notebook/notebook/handlers.py", line 95, in get
        self.write(self.render_template('notebook.html',
      File "/usr/local/lib/python3.8/site-packages/notebook/base/handlers.py", line 512, in render_template
        return template.render(**ns)
      File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 1301, in render
        self.environment.handle_exception()
      File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 936, in handle_exception
        raise rewrite_traceback_stack(source=source)
      File "/usr/local/lib/python3.8/site-packages/notebook/templates/notebook.html", line 1, in top-level template code
        {% extends "page.html" %}
      File "/usr/local/lib/python3.8/site-packages/notebook/templates/page.html", line 154, in top-level template code
        {% block header %}
      File "/usr/local/lib/python3.8/site-packages/notebook/templates/notebook.html", line 115, in block 'header'
        {% for exporter in get_frontend_exporters() %}
      File "/usr/local/lib/python3.8/site-packages/notebook/notebook/handlers.py", line 23, in get_frontend_exporters
        from nbconvert.exporters.base import get_export_names, get_exporter
      File "/usr/local/lib/python3.8/site-packages/nbconvert/__init__.py", line 4, in <module>
        from .exporters import *
      File "/usr/local/lib/python3.8/site-packages/nbconvert/exporters/__init__.py", line 3, in <module>
        from .html import HTMLExporter
      File "/usr/local/lib/python3.8/site-packages/nbconvert/exporters/html.py", line 14, in <module>
        from jinja2 import contextfilter
    ImportError: cannot import name 'contextfilter' from 'jinja2' (/usr/local/lib/python3.8/site-packages/jinja2/__init__.py)

 

 

위에서 발생한 에러에 대해서 찾아보니 다음과 같이 해결했다는 글이 있어 따라해봤다.

https://stackoverflow.com/questions/55013206/how-can-i-fix-500-internal-server-error-on-jupyter-notebook-due-to-tornado

 

How can I fix "500 : Internal Server Error" on jupyter notebook due to 'tornado.web' not having attribute 'asynchronous'?

Jupiter notebook is not opening notebooks and shows a "500 : Internal Server Error" instead. What I did was activate an environment I need and launching Jupyter. Please find below what I did and the

stackoverflow.com

 

에러를 해결하기 위해서 다음과 같이 명령어를 실행하면 된다고 한다.

pip install --upgrade nbconvert

 

만약, Anaconda 환경이라면 다음과 같이 명령어를 실행해주면 된다고 한다.

 conda upgrade nbconvert

 

 

그래서 명령어를 실행한 후에 다시 확인해보니 Notebook 이 정상적으로 실행되는 것을 확인할 수 있었다.

명령어 실행
에러 해결 확인

728x90
반응형
복사했습니다!