Rise: Jupyter Notebook 500 : Internal Server Error

Created on 28 Mar 2019  路  6Comments  路  Source: damianavila/RISE

Using Jupyter from a Docker image, running on a remote EC2.

I ran conda install -c conda-forge rise and immediately after, I get a "500 : Internal Server Error" whenever I try to open my notebooks or create a new one.

I scrapped the container and used a fresh container and tried it again using pip: pip install RISE jupyter-nbextension install rise --py --sys-prefix - but get the same thing.

I've tried updating conda and a few other suggestions out there but still getting the 500 error. Every time I restart with a new container, my Jupyter notebook works fine. It's not until I try to install RISE when I get the 500 error.

[E 00:07:55.305 NotebookApp] Uncaught exception GET /notebooks/work/4.presentation_slides/creating_presentation_slides.ipynb (137.79.200.94)
    HTTPServerRequest(protocol='http', host='100.64.24.56:8888', method='GET', uri='/notebooks/work/4.presentation_slides/creating_presentation_slides.ipynb', version='HTTP/1.1', remote_ip='137.79.200.94')
    Traceback (most recent call last):
      File "/opt/conda/lib/python3.6/site-packages/tornado/web.py", line 1541, in _execute
        result = method(*self.path_args, **self.path_kwargs)
      File "/opt/conda/lib/python3.6/site-packages/tornado/web.py", line 2949, in wrapper
        return method(self, *args, **kwargs)
      File "/opt/conda/lib/python3.6/site-packages/notebook/notebook/handlers.py", line 43, in get
        except web.HTTPError as e:
      File "/opt/conda/lib/python3.6/site-packages/notebook/base/handlers.py", line 424, in render_template
      File "/opt/conda/lib/python3.6/site-packages/jinja2/asyncsupport.py", line 76, in render
        return original_render(self, *args, **kwargs)
      File "/opt/conda/lib/python3.6/site-packages/jinja2/environment.py", line 1008, in render
        return self.environment.handle_exception(exc_info, True)
      File "/opt/conda/lib/python3.6/site-packages/jinja2/environment.py", line 780, in handle_exception
        reraise(exc_type, exc_value, tb)
      File "/opt/conda/lib/python3.6/site-packages/jinja2/_compat.py", line 37, in reraise
        raise value.with_traceback(tb)
      File "/opt/conda/lib/python3.6/site-packages/notebook/templates/notebook.html", line 1, in top-level template code
        {% extends "page.html" %}
      File "/opt/conda/lib/python3.6/site-packages/notebook/templates/page.html", line 154, in top-level template code
        {% block header %}
      File "/opt/conda/lib/python3.6/site-packages/notebook/templates/notebook.html", line 120, in block "header"
        {% for exporter in get_custom_frontend_exporters() %}
    jinja2.exceptions.UndefinedError: 'get_custom_frontend_exporters' is undefined
[E 00:07:55.315 NotebookApp] {
      "Host": "100.64.24.56:8888",
      "Connection": "keep-alive",
      "Upgrade-Insecure-Requests": "1",
      "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.75 Safari/537.36",
      "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
      "Referer": "http://100.64.24.56:8888/tree/work/4.presentation_slides",
      "Accept-Encoding": "gzip, deflate",
      "Accept-Language": "en-US,en;q=0.9",
      "Cookie": "_xsrf=2|ec12fd0c|b225b33aeed5fd86ca30224369b6c53b|1552675350; username-100-64-24-56-8989=\"2|1:0|10:1553708176|26:username-100-64-24-56-8989|44:OTU5N2EwZWNmNmY1NDVkN2FiOTk1ZTVjZjBmMjk1Zjc=|6b66273ea1ab1b48e7ab99af7b897c380d067c8b189dc0ab67c0b0b292fe6e17\"; username-100-64-24-56-9999=\"2|1:0|10:1553714021|26:username-100-64-24-56-9999|44:YWI2YjE4NDlkMTIwNGM4MWI1NzM4OGNhMDhhZDdkYjM=|2006b8b4f2f587432088d69ceceba378fccfa7125a796f6648aa18522efbea11\"; username-100-64-24-56-8888=\"2|1:0|10:1553731670|26:username-100-64-24-56-8888|44:YmZhZTExMWZiNDE2NGIzZmEzZGVlZmFiYTE1NmMyZmU=|21a6cad26e0146eeababf550f56470b0974fa30cffbf255318bd64e84f189bde\"",
      "Dnt": "1",
      "If-None-Match": "\"354af187793b9b67e0ab37dd9616a55aa78c9d37\""
    }
[E 00:07:55.315 NotebookApp] 500 GET /notebooks/work/4.presentation_slides/creating_presentation_slides.ipynb (137.79.200.94) 86.08ms referer=http://100.64.24.56:8888/tree/work/4.presentation_slides
[E 00:08:35.089 NotebookApp] Uncaught exception GET /notebooks/work/4.presentation_slides/creating_presentation_slides.ipynb (137.79.200.94)
    HTTPServerRequest(protocol='http', host='100.64.24.56:8888', method='GET', uri='/notebooks/work/4.presentation_slides/creating_presentation_slides.ipynb', version='HTTP/1.1', remote_ip='137.79.200.94')
    Traceback (most recent call last):
      File "/opt/conda/lib/python3.6/site-packages/tornado/web.py", line 1541, in _execute
        result = method(*self.path_args, **self.path_kwargs)
      File "/opt/conda/lib/python3.6/site-packages/tornado/web.py", line 2949, in wrapper
        return method(self, *args, **kwargs)
      File "/opt/conda/lib/python3.6/site-packages/notebook/notebook/handlers.py", line 43, in get
        except web.HTTPError as e:
      File "/opt/conda/lib/python3.6/site-packages/notebook/base/handlers.py", line 424, in render_template
      File "/opt/conda/lib/python3.6/site-packages/jinja2/asyncsupport.py", line 76, in render
        return original_render(self, *args, **kwargs)
      File "/opt/conda/lib/python3.6/site-packages/jinja2/environment.py", line 1008, in render
        return self.environment.handle_exception(exc_info, True)
      File "/opt/conda/lib/python3.6/site-packages/jinja2/environment.py", line 780, in handle_exception
        reraise(exc_type, exc_value, tb)
      File "/opt/conda/lib/python3.6/site-packages/jinja2/_compat.py", line 37, in reraise
        raise value.with_traceback(tb)
      File "/opt/conda/lib/python3.6/site-packages/notebook/templates/notebook.html", line 1, in top-level template code
        {% extends "page.html" %}
      File "/opt/conda/lib/python3.6/site-packages/notebook/templates/page.html", line 154, in top-level template code
        {% block header %}
      File "/opt/conda/lib/python3.6/site-packages/notebook/templates/notebook.html", line 120, in block "header"
        {% for exporter in get_custom_frontend_exporters() %}
    jinja2.exceptions.UndefinedError: 'get_custom_frontend_exporters' is undefined
[E 00:08:35.091 NotebookApp] {
      "Host": "100.64.24.56:8888",
      "Connection": "keep-alive",
      "Upgrade-Insecure-Requests": "1",
      "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.75 Safari/537.36",
      "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
      "Referer": "http://100.64.24.56:8888/tree/work/4.presentation_slides",
      "Accept-Encoding": "gzip, deflate",
      "Accept-Language": "en-US,en;q=0.9",
      "Cookie": "_xsrf=2|ec12fd0c|b225b33aeed5fd86ca30224369b6c53b|1552675350; username-100-64-24-56-8989=\"2|1:0|10:1553708176|26:username-100-64-24-56-8989|44:OTU5N2EwZWNmNmY1NDVkN2FiOTk1ZTVjZjBmMjk1Zjc=|6b66273ea1ab1b48e7ab99af7b897c380d067c8b189dc0ab67c0b0b292fe6e17\"; username-100-64-24-56-9999=\"2|1:0|10:1553714021|26:username-100-64-24-56-9999|44:YWI2YjE4NDlkMTIwNGM4MWI1NzM4OGNhMDhhZDdkYjM=|2006b8b4f2f587432088d69ceceba378fccfa7125a796f6648aa18522efbea11\"; username-100-64-24-56-8888=\"2|1:0|10:1553731670|26:username-100-64-24-56-8888|44:YmZhZTExMWZiNDE2NGIzZmEzZGVlZmFiYTE1NmMyZmU=|21a6cad26e0146eeababf550f56470b0974fa30cffbf255318bd64e84f189bde\"",
      "Dnt": "1"
    }
question

All 6 comments

Hiya

this issue IMHO does not belong with RISE; I do this sort of things routinely from either of the the dockerhub images jupyter/minimal-notebook or jupyter/scipy-notebook so I can tell it is expected to work fine

can you please explicit what docker image you are using ?

for the record here's the way that I activate rise on my images

RUN pip install rise && jupyter-nbextension install rise --py && jupyter-nbextension enable rise --py

I know that some reports suggest the latter is not required, but that's what I happen to use nonetheless for historical reasons

sorry, I did not mean to close..

Hi @parmentelat, your comment led me to dig into my dockerfile and it was some Python 3 packages I was installing that were not compatible with RISE. I switched to just using the standard dockerhub images (jupyter/scipy-notebook) and RISE works for me now! Thank you so much!

thanks for the report;

I'm closing this, but if you have any hint about the root causes of that incompatibility, please make sure to write them down here so that others may spot a similar issue more quickly :)

This is what my Dockerfile looked like (where every time I installed RISE, my notebooks would give me the 500 : Internal Server Error. I was using minimal-notebook as the base and hand-picking libraries to keep my image light. I've been using this Dockerfile for a while and it wasn't until I wanted to use RISE for presentations when I noticed some issues.

I suspect it was the Python 3 libraries that were incompatible with RISE:

```
FROM jupyter/minimal-notebook

LABEL maintainer="Josephine M. Ho josephinemho@gmail.com"

USER root

Install pacakges

RUN apt-get update && \
apt-get install -y --no-install-recommends libav-tools && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

USER $NB_UID

Install Python 3 packages

Remove pyqt and qt pulled in for matplotlib since we're only ever going to use notebook-friendly backends in these images

RUN conda install --quiet --yes \
'nomkl' \
'ipywidgets=7.1' \
'pandas=0.19
' \
'numexpr=2.6' \
'matplotlib=2.0
' \
'scipy=0.19' \
'seaborn=0.7
' \
'scikit-learn=0.18' \
'hdf5=1.8.17' \
'h5py=2.6
' \
'protobuf=3.*' \
'xlrd' && \
conda remove --quiet --yes --force qt pyqt && \
conda clean -tipsy

Import matplotlib the first time to build the font cache.

ENV XDG_CACHE_HOME /home/$NB_USER/.cache/
RUN MPLBACKEND=Agg python -c "import matplotlib.pyplot" && \
fix-permissions /home/$NB_USER

Switch back to jovyan to avoid accidental container runs as root

USER $NB_UID```

I noticed tou had a redundant USER statement but that鈥檚 unlikely to have been the issue

In any case thank you for these details :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

BananaDrum picture BananaDrum  路  3Comments

rinnert picture rinnert  路  3Comments

neighthan picture neighthan  路  3Comments

engyasin picture engyasin  路  4Comments

andreagrandi picture andreagrandi  路  6Comments