jupytext: opening any notebook give "500 : Internal Server Error"

Opening any notebook in jupyter notebook gives me
500 : Internal Server Error Moreover in traceback I am getting error AttributeError: module 'jupytext' has no attribute 'PyNotebookExporter'

It comes from nbsrc ??

full messsage:

Accepting one-time-token-authenticated connection from 127.0.0.1
[E 02:04:01.639 NotebookApp] Uncaught exception GET /notebooks/jupytext/demo/Matplotlib%20example.py (127.0.0.1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/notebooks/jupytext/demo/Matplotlib%20example.py', version='HTTP/1.1', remote_ip='127.0.0.1')
    Traceback (most recent call last):
      File "/home/daniel/.local/lib/python3.6/site-packages/tornado/web.py", line 1590, in _execute
        result = method(*self.path_args, **self.path_kwargs)
      File "/home/daniel/.local/lib/python3.6/site-packages/tornado/web.py", line 3006, in wrapper
        return method(self, *args, **kwargs)
      File "/home/daniel/.local/lib/python3.6/site-packages/notebook/notebook/handlers.py", line 59, in get
        get_custom_frontend_exporters=get_custom_frontend_exporters
      File "/home/daniel/.local/lib/python3.6/site-packages/notebook/base/handlers.py", line 467, in render_template
        return template.render(**ns)
      File "/home/daniel/.local/lib/python3.6/site-packages/jinja2/asyncsupport.py", line 76, in render
        return original_render(self, *args, **kwargs)
      File "/home/daniel/.local/lib/python3.6/site-packages/jinja2/environment.py", line 1008, in render
        return self.environment.handle_exception(exc_info, True)
      File "/home/daniel/.local/lib/python3.6/site-packages/jinja2/environment.py", line 780, in handle_exception
        reraise(exc_type, exc_value, tb)
      File "/home/daniel/.local/lib/python3.6/site-packages/jinja2/_compat.py", line 37, in reraise
        raise value.with_traceback(tb)
      File "/home/daniel/.local/lib/python3.6/site-packages/notebook/templates/notebook.html", line 1, in top-level template code
        {% extends "page.html" %}
      File "/home/daniel/.local/lib/python3.6/site-packages/notebook/templates/page.html", line 154, in top-level template code
        {% block header %}
      File "/home/daniel/.local/lib/python3.6/site-packages/notebook/templates/notebook.html", line 120, in block "header"
        {% for exporter in get_custom_frontend_exporters() %}
      File "/home/daniel/.local/lib/python3.6/site-packages/notebook/notebook/handlers.py", line 24, in get_custom_frontend_exporters
        exporter = get_exporter(name)()
      File "/home/daniel/.local/lib/python3.6/site-packages/nbconvert/exporters/base.py", line 98, in get_exporter
        return entrypoints.get_single('nbconvert.exporters', name).load()
      File "/home/daniel/.local/lib/python3.6/site-packages/entrypoints.py", line 81, in load
        obj = getattr(obj, attr)
    AttributeError: module 'jupytext' has no attribute 'PyNotebookExporter'
[E 02:04:01.647 NotebookApp] {
      "Host": "localhost:8888",
      "User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.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",
      "Referer": "http://localhost:8888/tree/jupytext/demo",
      "Cookie": "username-localhost-8888=\"2|1:0|10:1538611433|23:username-localhost-8888|44:OGMyM2E1NTVhNGMxNDQ4YmFjZTMwN2ZhZGRjYWU5YzM=|9dc1f0a3d9d029dc6e0998c99807985df3c33d4117f7bf8b97378aea97674583\"; _xsrf=2|b8e12937|2af77871282739f859cf074fedec7254|1538440848; username-localhost-8889=\"2|1:0|10:1538609377|23:username-localhost-8889|44:MzAyNzE4MzQwOGE5NDJhMWIzMDE1ZjRmZWYwZTI5NzM=|bce4f92118eea3c7b78989c9c3f851e5867c8a29a0a36d18f463efaf67dbcaaf\"",
      "Connection": "keep-alive",
      "Upgrade-Insecure-Requests": "1"
    }
[E 02:04:01.647 NotebookApp] 500 GET /notebooks/jupytext/demo/Matplotlib%20example.py (127.0.0.1) 562.51ms referer=http://localhost:8888/tree/jupytext/demo

The jupytext version is 0.7.3 installed by pip, after error I updated ipython[all]/

Jupyterlab work just fine, but I am still getting this error even after uninstallng jupytext

Opening python file lead to notebook which give me “500 : Internal Server Error”

About this issue

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

Most upvoted comments

I had the same issue (500 : Internal Server Error) and I tried all the things written above but nothing worked. However, conda update --all did work for me.

I do run into a similar issue, but I cannot provide a recipe for reproducing. What I know is that

  • I had installed jupytext==0.8.2 from pip, using pip install jupytext --user
  • Then, I installed a more recent jupytext from git using pip install -e . --user

The trouble is that pip concludes:

Successfully installed jupytext-0.8.2 

when I am actually installing version 0.8.4…

As in your case, the problem is solved by removing files in .local/lib/python3.6 (as I am using Python 3.6 here).

I think the issue is with pip install --user. Unfortunately I cannot reproduce the exact sequence of commands that reproduce it. And we have documented the workaround (manually remove jupytext from the local python library). Do you mind @danieltomasz if I close the issue? Thanks

Thanks @danieltomasz for documenting this. I am sure this will be useful to anyone that encounters the same issue! I still would like to understand how it is possible to bring pip into such a case ; in the next days I’ll experiment a bit more with user install, and also dev install, to see if I can reproduce this, and also how we can avoid it!

Thanks Daniel. So indeed we should investigate a bit more! I will do that and report on this here.