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)
위에서 발생한 에러에 대해서 찾아보니 다음과 같이 해결했다는 글이 있어 따라해봤다.
에러를 해결하기 위해서 다음과 같이 명령어를 실행하면 된다고 한다.
pip install --upgrade nbconvert
만약, Anaconda 환경이라면 다음과 같이 명령어를 실행해주면 된다고 한다.
conda upgrade nbconvert
그래서 명령어를 실행한 후에 다시 확인해보니 Notebook 이 정상적으로 실행되는 것을 확인할 수 있었다.
728x90
반응형
'프로그래밍 언어 > Python' 카테고리의 다른 글
Python 파이썬 주요 특징 및 장점 (0) | 2023.01.12 |
---|---|
Python List Comprehension (0) | 2023.01.08 |
파이썬 print() 함수 줄바꿈 없이 출력 (0) | 2022.12.19 |
Python 더하기, 빼기, 곱하기, 몫과 나머지 계산 (0) | 2022.10.29 |
파이썬(Python) Jupyter notebook 설치 (MacBook) (0) | 2020.12.03 |