Error while creating new notebook

After I opened the jupyter web page, I clicked the newPython3. then it open a new page with 500:Internal Server Error. the following is thw log.

[E 16:27:25.753 NotebookApp] Uncaught exception GET /notebooks/Untitled1.ipynb?kernel_name=python3 (::1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/notebooks/Untitled1.ipynb?kernel_name=python3', version='HTTP/1.1', remote_ip='::1')
    Traceback (most recent call last):
      File "C:\Users\bangsun\Anaconda3\envs\tensorflow\lib\site-packages\tornado\web.py", line 1704, in _execute
        result = await result
      File "C:\Users\bangsun\Anaconda3\envs\tensorflow\lib\site-packages\tornado\gen.py", line 775, in run
        yielded = self.gen.send(value)
      File "C:\Users\bangsun\Anaconda3\envs\tensorflow\lib\site-packages\notebook\notebook\handlers.py", line 101, in get
        get_frontend_exporters=get_frontend_exporters
      File "C:\Users\bangsun\Anaconda3\envs\tensorflow\lib\site-packages\notebook\base\handlers.py", line 516, in render_template
        return template.render(**ns)
      File "C:\Users\bangsun\Anaconda3\envs\tensorflow\lib\site-packages\jinja2\environment.py", line 1304, in render
        self.environment.handle_exception()
      File "C:\Users\bangsun\Anaconda3\envs\tensorflow\lib\site-packages\jinja2\environment.py", line 925, in handle_exception
        raise rewrite_traceback_stack(source=source)
      File "C:\Users\bangsun\Anaconda3\envs\tensorflow\lib\site-packages\notebook\templates\notebook.html", line 1, in top-level template code
        {% extends "page.html" %}
      File "C:\Users\bangsun\Anaconda3\envs\tensorflow\lib\site-packages\notebook\templates\page.html", line 154, in top-level template code
        {% block header %}
      File "C:\Users\bangsun\Anaconda3\envs\tensorflow\lib\site-packages\notebook\templates\notebook.html", line 115, in block 'header'
        {% for exporter in get_frontend_exporters() %}
      File "C:\Users\bangsun\Anaconda3\envs\tensorflow\lib\site-packages\notebook\notebook\handlers.py", line 23, in get_frontend_exporters
        from nbconvert.exporters.base import get_export_names, get_exporter
      File "C:\Users\bangsun\Anaconda3\envs\tensorflow\lib\site-packages\nbconvert\__init__.py", line 4, in <module>
        from .exporters import *
      File "C:\Users\bangsun\Anaconda3\envs\tensorflow\lib\site-packages\nbconvert\exporters\__init__.py", line 3, in <module>
        from .html import HTMLExporter
      File "C:\Users\bangsun\Anaconda3\envs\tensorflow\lib\site-packages\nbconvert\exporters\html.py", line 18, in <module>
        from nbconvert.filters.highlight import Highlight2HTML
      File "C:\Users\bangsun\Anaconda3\envs\tensorflow\lib\site-packages\nbconvert\filters\__init__.py", line 6, in <module>
        from .markdown import *
      File "C:\Users\bangsun\Anaconda3\envs\tensorflow\lib\site-packages\nbconvert\filters\markdown.py", line 13, in <module>
        from .markdown_mistune import markdown2html_mistune
      File "C:\Users\bangsun\Anaconda3\envs\tensorflow\lib\site-packages\nbconvert\filters\markdown_mistune.py", line 31, in <module>
        class MathBlockGrammar(mistune.BlockGrammar):
    AttributeError: module 'mistune' has no attribute 'BlockGrammar'
[E 16:27:25.771 NotebookApp] {
      "Host": "localhost:8888",
      "Connection": "keep-alive",
      "Sec-Ch-Ua": "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"99\", \"Google Chrome\";v=\"99\"",
      "Sec-Ch-Ua-Mobile": "?0",
      "Sec-Ch-Ua-Platform": "\"Windows\"",
      "Upgrade-Insecure-Requests": "1",
      "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36",
      "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
      "Sec-Fetch-Site": "same-origin",
      "Sec-Fetch-Mode": "navigate",
      "Sec-Fetch-Dest": "document",
      "Referer": "http://localhost:8888/tree",
      "Accept-Encoding": "gzip, deflate, br",
      "Accept-Language": "zh-CN,zh;q=0.9",
      "Cookie": "_xsrf=2|9a216fd6|0a67e21a2345c44c2293869162ae5955|1646967831; username-localhost-8888=\"2|1:0|10:1646987233|23:username-localhost-8888|44:YjVlM2MyNWZhN2JkNDc1NzhmY2VhZDgyOTczYThhOWI=|a2802bb6724092441885c7473a532534bbc996dc34fb21ba5a7ce01d5b33c2fa\""
    }
[E 16:27:25.772 NotebookApp] 500 GET /notebooks/Untitled1.ipynb?kernel_name=python3 (::1) 122.870000ms referer=http://localhost:8888/tree

Before trying some of the suggestions below, you may want to consider / share if this is a new installation or it things were working and you updated something and it broke? You gave very little context in your post.


This looks like it may be an issue that has come up recently given here, here and here. The suggestion had been to roll back to an earlier version of mistune, specifically 0.8.4, as here summarizes.

If that doesn’t help, your error traceback and here make it clear nbconvert relies on mistune, and so if you haven’t updated that recently, that may be in order. However, since that underlies a lot of the Jupyter system you may want to consider reproducing a copy of the whole environment you are working in and try updating everything in the copy and see if that fixes things. (Contemplating the best path at this point is why I added the preface of considering the larger picture here yourself, and if the next course of actions isn’t obvious, then provide some more context here so that folks can advise you. You don’t want to make things worse by redoing your environment entirely if it was some simple change you did recently that you can roll back using Anaconda, if that is what you are using to manage your Jupyter installation.)