Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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 error message on the terminal:

$ conda activate py3_parcels  $ jupyter notebook [I 18:20:39.663 NotebookApp] Loading IPython parallel extension [I 18:20:39.665 NotebookApp] Serving notebooks from local directory: /Users/davidlindo-atichati/run/GOM_MED [I 18:20:39.665 NotebookApp] The Jupyter Notebook is running at: [I 18:20:39.665 NotebookApp] http://localhost:8888/?token=36466fc830862b794856668cd6ded86fe0a664247233764a [I 18:20:39.665 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [C 18:20:39.677 NotebookApp]       Copy/paste this URL into your browser when you connect for the first time,     to login with a token:         http://localhost:8888/?token=36466fc830862b794856668cd6ded86fe0a664247233764a [I 18:20:40.211 NotebookApp] Accepting one-time-token-authenticated connection from ::1 

The notebook opens on my Safari browser. But when I try to open an existing notebook or when I create a new notebook I receive a "500 : Internal Server Error" in the browser and the following message on the terminal:

[E 18:22:16.169 NotebookApp] Uncaught exception GET /notebooks/backtracking-sample-1.ipynb (::1)     HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/notebooks/backtracking-sample-1.ipynb', version='HTTP/1.1', remote_ip='::1')     Traceback (most recent call last):       File "/Users/davidlindo-atichati/miniconda3/envs/py3_parcels/lib/python3.7/site-packages/tornado/web.py", line 1697, in _execute         result = method(*self.path_args, **self.path_kwargs)       File "/Users/davidlindo-atichati/miniconda3/envs/py3_parcels/lib/python3.7/site-packages/tornado/web.py", line 3174, in wrapper         return method(self, *args, **kwargs)       File "/Users/davidlindo-atichati/miniconda3/envs/py3_parcels/lib/python3.7/site-packages/notebook/notebook/handlers.py", line 59, in get         get_custom_frontend_exporters=get_custom_frontend_exporters       File "/Users/davidlindo-atichati/miniconda3/envs/py3_parcels/lib/python3.7/site-packages/notebook/base/handlers.py", line 467, in render_template         return template.render(**ns)       File "/Users/davidlindo-atichati/miniconda3/envs/py3_parcels/lib/python3.7/site-packages/jinja2/asyncsupport.py", line 76, in render         return original_render(self, *args, **kwargs)       File "/Users/davidlindo-atichati/miniconda3/envs/py3_parcels/lib/python3.7/site-packages/jinja2/environment.py", line 1008, in render         return self.environment.handle_exception(exc_info, True)       File "/Users/davidlindo-atichati/miniconda3/envs/py3_parcels/lib/python3.7/site-packages/jinja2/environment.py", line 780, in handle_exception         reraise(exc_type, exc_value, tb)       File "/Users/davidlindo-atichati/miniconda3/envs/py3_parcels/lib/python3.7/site-packages/jinja2/_compat.py", line 37, in reraise         raise value.with_traceback(tb)       File "/Users/davidlindo-atichati/miniconda3/envs/py3_parcels/lib/python3.7/site-packages/notebook/templates/notebook.html", line 1, in top-level template code         {% extends "page.html" %}       File "/Users/davidlindo-atichati/miniconda3/envs/py3_parcels/lib/python3.7/site-packages/notebook/templates/page.html", line 154, in top-level template code         {% block header %}       File "/Users/davidlindo-atichati/miniconda3/envs/py3_parcels/lib/python3.7/site-packages/notebook/templates/notebook.html", line 120, in block "header"         {% for exporter in get_custom_frontend_exporters() %}       File "/Users/davidlindo-atichati/miniconda3/envs/py3_parcels/lib/python3.7/site-packages/notebook/notebook/handlers.py", line 19, in get_custom_frontend_exporters         from nbconvert.exporters.base import get_export_names, get_exporter       File "/Users/davidlindo-atichati/miniconda3/envs/py3_parcels/lib/python3.7/site-packages/nbconvert/__init__.py", line 7, in <module>         from . import postprocessors       File "/Users/davidlindo-atichati/miniconda3/envs/py3_parcels/lib/python3.7/site-packages/nbconvert/postprocessors/__init__.py", line 5, in <module>         from .serve import ServePostProcessor       File "/Users/davidlindo-atichati/miniconda3/envs/py3_parcels/lib/python3.7/site-packages/nbconvert/postprocessors/serve.py", line 19, in <module>         class ProxyHandler(web.RequestHandler):       File "/Users/davidlindo-atichati/miniconda3/envs/py3_parcels/lib/python3.7/site-packages/nbconvert/postprocessors/serve.py", line 21, in ProxyHandler         @web.asynchronous     AttributeError: module 'tornado.web' has no attribute 'asynchronous' [E 18:22:16.178 NotebookApp] {       "Host": "localhost:8888",       "Cookie": "username-localhost-8888=\"2|1:0|10:1551828040|23:username-localhost-8888|44:OGQ4ZTgzZDRjZjFiNDMzZDk0ZTI2NmJkMDc3OTEzMDk=|e4504cac3111242d53ab46ce3b8fa72750876a90bef7bc980a2ebb3c6f77caec\"; username-localhost-8889=\"2|1:0|10:1551821266|23:username-localhost-8889|44:ZjgyOTBhNTE3Zjg0NDJlOGIyNTA5NDRiNTBjMzQ0YTk=|43b122243108c4f7dbf37e636660b8d0656f5173d2b363a6bb496681de6d4e5f\"; _xsrf=2|0a22b984|8687c792155e13f5d476952db2d9f2f7|1551360338",       "Connection": "keep-alive",       "Upgrade-Insecure-Requests": "1",       "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",       "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.3 Safari/605.1.15",       "Referer": "http://localhost:8888/tree",       "Accept-Language": "en-us",       "Accept-Encoding": "gzip, deflate"     } [E 18:22:16.178 NotebookApp] 500 GET /notebooks/backtracking-sample-1.ipynb (::1) 121.50ms referer=http://localhost:8888/tree 
like image 523
David Lindo Atichati Avatar asked Mar 05 '19 23:03

David Lindo Atichati


People also ask

How do I fix the internal server error 500 in Jupyter notebook?

You can either try to update nbconvert or downgrade jinja2. then try the notebook again. If that doesn't work, try to update `nbconvert`. Note that there might be other packages in your environment that depend on jinja2 that could be broken.

Why do I get 500 internal server error?

The 500 Internal Server error could be caused by an error during the execution of any policy within Edge or by an error on the target/backend server. The HTTP status code 500 is a generic error response. It means that the server encountered an unexpected condition that prevented it from fulfilling the request.


1 Answers

Solution is here.

pip install --upgrade nbconvert 

For those using anaconda then.

 conda upgrade nbconvert 
like image 132
srodriguex Avatar answered Oct 01 '22 12:10

srodriguex