notebook: "500 : Internal Server Error" response while opening any notebook

[E 17:15:32.052 NotebookApp] Uncaught exception GET /notebooks/ML/Mod.ipynb (::1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/notebooks/ML/Mod.ipynb', version='HTTP/1.1', remote_ip='::1')
    Traceback (most recent call last):
      File "/usr/local/lib/python3.4/dist-packages/tornado/web.py", line 1541, in _execute
        result = method(*self.path_args, **self.path_kwargs)
      File "/usr/local/lib/python3.4/dist-packages/tornado/web.py", line 2949, in wrapper
        return method(self, *args, **kwargs)
      File "/usr/local/lib/python3.4/dist-packages/notebook/notebook/handlers.py", line 59, in get
        get_custom_frontend_exporters=get_custom_frontend_exporters
      File "/usr/local/lib/python3.4/dist-packages/notebook/base/handlers.py", line 424, in render_template
        return template.render(**ns)
      File "/usr/local/lib/python3.4/dist-packages/jinja2/environment.py", line 1008, in render
        return self.environment.handle_exception(exc_info, True)
      File "/usr/local/lib/python3.4/dist-packages/jinja2/environment.py", line 780, in handle_exception
        reraise(exc_type, exc_value, tb)
      File "/usr/local/lib/python3.4/dist-packages/jinja2/_compat.py", line 37, in reraise
        raise value.with_traceback(tb)
      File "/usr/local/lib/python3.4/dist-packages/notebook/templates/notebook.html", line 1, in top-level template code
        {% extends "page.html" %}
      File "/usr/local/lib/python3.4/dist-packages/notebook/templates/page.html", line 154, in top-level template code
        {% block header %}
      File "/usr/local/lib/python3.4/dist-packages/notebook/templates/notebook.html", line 117, in block "header"
        {% for exporter in get_custom_frontend_exporters() %}
      File "/usr/local/lib/python3.4/dist-packages/notebook/notebook/handlers.py", line 19, in get_custom_frontend_exporters
        from nbconvert.exporters.base import get_export_names, get_exporter
    ImportError: No module named 'nbconvert.exporters.base'
[E 17:15:32.058 NotebookApp] {
      "Cookie": "jenkins-timestamper-offset=-7200000; portainer.pagination_images=100; _xsrf=2|e14b81f3|51d2a266d38d404e570607fb51489a3e|1525957823; username-localhost-8888=\"2|1:0|10:1526829321|23:username-localhost-8888|44:NTQ2ZDBjNjA2ZDU1NDEyMTkzZDk3YWMyMmU4OTExNzg=|8a7e992430c91807f0d902a01fbe79755623840da06cc2f650d8515f6edf8d91\"",
      "Upgrade-Insecure-Requests": "1",
      "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
      "Accept-Encoding": "gzip, deflate",
      "Host": "localhost:8888",
      "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0",
      "Referer": "http://localhost:8888/tree/ML",
      "Connection": "keep-alive",
      "Accept-Language": "en-US,en;q=0.5"
    }

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 9
  • Comments: 38 (1 by maintainers)

Most upvoted comments

I also ran into this issue, which turned out to be caused by having older version of nbconvert (4.2.0) with a newer version of notebook (5.5.0). I originally had notebook and nbconvert installed through Debian packages, but then (accidentally, or indirectly through another dependency, I suppose) installed a newer version of notebook. Since the dependency declared by notebook is only nbconvert, without any version constraints, pip did not install a newer version of nbconvert too.

For me the fix was to upgrade the nbconvert package manually: pip3 install --upgrade --user nbconvert

Perhaps the real bug here is that the nbconvert dependency is not versioned, though I’m not sure what conventions pip/pypy uses for that?

This fixed it for me:

pip install nbconvert==5.4.1

it fixed for me.

pip install nbconvert==5.4.1

I think we should use conda where possible.

conda update nbconvert

worked for me.

If it helps, I just got this error, and restarting jupyter lab fixed it. I suspect it was from running conda update while jupyter was running.

This fixed it for me:

pip install nbconvert==5.4.1

This is the right way to go for me, solved!

I think we should use conda where possible.

conda update nbconvert

worked for me.

This worked for me too and solved the issue

I am also suffering from this issue now. The Jupyter is running on a server and I am opening it from my browser.

Hey @dmitrykdev , what did you do exactly? I have the same error

[E 16:28:19.573 NotebookApp] Uncaught exception GET /notebooks/Untitled1.ipynb?kernel_name=python3 (172.17.0.1)

HTTPServerRequest(protocol='http', host='localhost:9000', method='GET', uri='/notebooks/Untitled1.ipynb?kernel_name=python3', version='HTTP/1.1', remote_ip='172.17.0.1')
Traceback (most recent call last):

  File "/opt/conda/lib/python3.5/site-packages/tornado/web.py", line 1541, in _execute
    result = method(*self.path_args, **self.path_kwargs)

  File "/opt/conda/lib/python3.5/site-packages/tornado/web.py", line 2949, in wrapper
    return method(self, *args, **kwargs)

  File "/opt/conda/lib/python3.5/site-packages/notebook/notebook/handlers.py", line 59, in get
    get_custom_frontend_exporters=get_custom_frontend_exporters

  File "/opt/conda/lib/python3.5/site-packages/notebook/base/handlers.py", line 424, in render_template
    return template.render(**ns)

  File "/opt/conda/lib/python3.5/site-packages/jinja2/environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)

  File "/opt/conda/lib/python3.5/site-packages/jinja2/environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)

  File "/opt/conda/lib/python3.5/site-packages/jinja2/_compat.py", line 37, in reraise
    raise value.with_traceback(tb)

  File "/opt/conda/lib/python3.5/site-packages/notebook/templates/notebook.html", line 1, in top-level template code
    {% extends "page.html" %}

  File "/opt/conda/lib/python3.5/site-packages/notebook/templates/page.html", line 154, in top-level template code
    {% block header %}
  File "/opt/conda/lib/python3.5/site-packages/notebook/templates/notebook.html", line 117, in block "header"
    {% for exporter in get_custom_frontend_exporters() %}

  File "/opt/conda/lib/python3.5/site-packages/notebook/notebook/handlers.py", line 19, in get_custom_frontend_exporters

    from nbconvert.exporters.base import get_export_names, get_exporter
ImportError: No module named 'nbconvert.exporters.base'

`

`[E 16:28:19.589 NotebookApp] { “Accept-Language”: “es-ES,es;q=0.9,en;q=0.8”,

  "Referer": "http://localhost:9000/tree",

  "Connection": "keep-alive",

  "Upgrade-Insecure-Requests": "1",

  "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
  "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36",

  "Accept-Encoding": "gzip, deflate, br",

  "Host": "localhost:9000",

  "Cookie": "_xsrf=2|30dc6bc1|925f04f0c8e226ab5e57b1903bb65cda|1527375677"
}`

[E 16:28:19.591 NotebookApp] 500 GET /notebooks/Untitled1.ipynb?kernel_name=python3 (172.17.0.1) 21.65ms referer=http://localhost:9000/tree

Fixed via python3.4 modules wipe. Probably error occurred because some libraries was not deleted completely

Try to start it with sudo jupyter notebook --allow-root

Apparently there is now a new step you have to do to register the nbextensions, does this help?

python -m ipykernel install --user --name=<your_env_name>
jupyter nbextension enable --py --sys-prefix widgetsnbextension

Dear Sirs(lovettchris & kevin-bates) ,

I respect and appreciate your replies but just a moment before I install the anaconda and my problem finally ended.

Thank you to both of you for your precious time and help full replies.

Best Regards,

Rishabh Gupta

Apparently there is now a new step you have to do to register the nbextensions, does this help?

python -m ipykernel install --user --name=<your_env_name>
jupyter nbextension enable --py --sys-prefix widgetsnbextension

I am also seeing this issue after updating all of my packages using conda on 3.6.8.


[E 16:47:19.988 NotebookApp] Uncaught exception GET /notebooks/DBFS%20normalizer.ipynb (::1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/notebooks/DBFS%20normalizer.ipynb', version='HTTP/1.1', remote_ip='::1')
    Traceback (most recent call last):
      File "/usr/local/anaconda3/lib/python3.6/site-packages/tornado/web.py", line 1697, in _execute
        result = method(*self.path_args, **self.path_kwargs)
      File "/usr/local/anaconda3/lib/python3.6/site-packages/tornado/web.py", line 3174, in wrapper
        return method(self, *args, **kwargs)
      File "/usr/local/anaconda3/lib/python3.6/site-packages/notebook/notebook/handlers.py", line 59, in get
        get_custom_frontend_exporters=get_custom_frontend_exporters
      File "/usr/local/anaconda3/lib/python3.6/site-packages/notebook/base/handlers.py", line 519, in render_template
        return template.render(**ns)
      File "/usr/local/anaconda3/lib/python3.6/site-packages/jinja2/asyncsupport.py", line 76, in render
        return original_render(self, *args, **kwargs)
      File "/usr/local/anaconda3/lib/python3.6/site-packages/jinja2/environment.py", line 1008, in render
        return self.environment.handle_exception(exc_info, True)
      File "/usr/local/anaconda3/lib/python3.6/site-packages/jinja2/environment.py", line 780, in handle_exception
        reraise(exc_type, exc_value, tb)
      File "/usr/local/anaconda3/lib/python3.6/site-packages/jinja2/_compat.py", line 37, in reraise
        raise value.with_traceback(tb)
      File "/usr/local/anaconda3/lib/python3.6/site-packages/notebook/templates/notebook.html", line 1, in top-level template code
        {% extends "page.html" %}
      File "/usr/local/anaconda3/lib/python3.6/site-packages/notebook/templates/page.html", line 154, in top-level template code
        {% block header %}
      File "/usr/local/anaconda3/lib/python3.6/site-packages/notebook/templates/notebook.html", line 120, in block "header"
        {% for exporter in get_custom_frontend_exporters() %}
      File "/usr/local/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
      File "/usr/local/anaconda3/lib/python3.6/site-packages/nbconvert/__init__.py", line 7, in <module>
        from . import postprocessors
      File "/usr/local/anaconda3/lib/python3.6/site-packages/nbconvert/postprocessors/__init__.py", line 5, in <module>
        from .serve import ServePostProcessor
      File "/usr/local/anaconda3/lib/python3.6/site-packages/nbconvert/postprocessors/serve.py", line 19, in <module>
        class ProxyHandler(web.RequestHandler):
      File "/usr/local/anaconda3/lib/python3.6/site-packages/nbconvert/postprocessors/serve.py", line 21, in ProxyHandler
        @web.asynchronous
    AttributeError: module 'tornado.web' has no attribute 'asynchronous'
[E 16:47:20.009 NotebookApp] {
      "Host": "localhost:8888",
      "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:67.0) Gecko/20100101 Firefox/67.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",
      "Dnt": "1",
      "Connection": "keep-alive",
      "Referer": "http://localhost:8888/tree",
      "Cookie": "username-localhost-8888=\"2|1:0|10:1552510035|23:username-localhost-8888|44:ZTc2ZjZkZThhNzQzNGZjYmFiMTM1ZGUwODJlMDUxN2U=|675c06a5a24d0422d49d4b17e663cca3d470c3ebd30b58baafd8b5c3ae911697\"; _xsrf=2|de519812|8b1fc2de081e5924cd80858bdbb46db2|1551662662",
      "Upgrade-Insecure-Requests": "1"
    }
[E 16:47:20.010 NotebookApp] 500 GET /notebooks/DBFS%20normalizer.ipynb (::1) 236.74ms referer=http://localhost:8888/tree