anacondajinja2jupyter-labinternal-server-error

500:Internal server error when opening JupyterLab (4.0.11) via Anaconda (2.6.1)


I have been using JupyterLab w/ Anaconda for a while now and have not run into this issue before, but now when I open JupyterLab (4.0.11) from Anaconda, it throws an error "500 : Internal Server Error".

here's the log:

[I 2024-07-09 10:16:12.227 ServerApp] Extension package aext_assistant took 0.2382s to import
[I 2024-07-09 10:16:12.242 ServerApp] ****************** ENVIRONMENT Environment.PRODUCTION ******************
[I 2024-07-09 10:16:12.244 ServerApp] ****************** ENVIRONMENT Environment.PRODUCTION ******************
[I 2024-07-09 10:16:12.839 ServerApp] Extension package ipyparallel took 0.5955s to import
[W 2024-07-09 10:16:12.839 ServerApp] A `_jupyter_server_extension_points` function was not found in ipyparallel. Instead, a `_jupyter_server_extension_paths` function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.
[W 2024-07-09 10:16:12.847 ServerApp] A `_jupyter_server_extension_points` function was not found in jupyter_lsp. Instead, a `_jupyter_server_extension_paths` function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.
[W 2024-07-09 10:16:12.921 ServerApp] A `_jupyter_server_extension_points` function was not found in nbclassic. Instead, a `_jupyter_server_extension_paths` function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.
[W 2024-07-09 10:16:12.929 ServerApp] A `_jupyter_server_extension_points` function was not found in notebook_shim. Instead, a `_jupyter_server_extension_paths` function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.
[I 2024-07-09 10:16:13.597 ServerApp] Extension package panel.io.jupyter_server_extension took 0.6684s to import
[I 2024-07-09 10:16:13.597 ServerApp] aext_assistant | extension was successfully linked.
[I 2024-07-09 10:16:13.597 ServerApp] aext_core | extension was successfully linked.
[I 2024-07-09 10:16:13.597 ServerApp] aext_panels | extension was successfully linked.
[I 2024-07-09 10:16:13.597 ServerApp] aext_share_notebook | extension was successfully linked.
[I 2024-07-09 10:16:13.597 ServerApp] ipyparallel | extension was successfully linked.
[I 2024-07-09 10:16:13.597 ServerApp] jupyter_lsp | extension was successfully linked.
[I 2024-07-09 10:16:13.605 ServerApp] jupyter_server_fileid | extension was successfully linked.
[I 2024-07-09 10:16:13.605 ServerApp] jupyter_server_terminals | extension was successfully linked.
[I 2024-07-09 10:16:13.605 ServerApp] jupyter_server_ydoc | extension was successfully linked.
[I 2024-07-09 10:16:13.617 ServerApp] jupyterlab | extension was successfully linked.
[I 2024-07-09 10:16:13.617 ServerApp] nbclassic | extension was successfully linked.
[I 2024-07-09 10:16:13.625 ServerApp] notebook | extension was successfully linked.
[I 2024-07-09 10:16:13.625 ServerApp] notebook_shim | extension was successfully linked.
[I 2024-07-09 10:16:13.625 ServerApp] panel.io.jupyter_server_extension | extension was successfully linked.
[I 2024-07-09 10:16:13.686 ServerApp] notebook_shim | extension was successfully loaded.
[I 2024-07-09 10:16:13.686 ServerApp] Registered aext_assistant server extension
[I 2024-07-09 10:16:13.686 ServerApp] aext_assistant | extension was successfully loaded.
[I 2024-07-09 10:16:13.686 ServerApp] Registered aext_core server extension
[I 2024-07-09 10:16:13.686 ServerApp] aext_core | extension was successfully loaded.
[I 2024-07-09 10:16:13.686 ServerApp] Registered aext_panels server extension
[I 2024-07-09 10:16:13.686 ServerApp] aext_panels | extension was successfully loaded.
[I 2024-07-09 10:16:13.686 ServerApp] Registered aext_share_notebook_server server extension
[I 2024-07-09 10:16:13.686 ServerApp] aext_share_notebook | extension was successfully loaded.
[I 2024-07-09 10:16:13.686 ServerApp] Loading IPython parallel extension
[I 2024-07-09 10:16:13.686 ServerApp] ipyparallel | extension was successfully loaded.
[I 2024-07-09 10:16:13.696 ServerApp] jupyter_lsp | extension was successfully loaded.
[I 2024-07-09 10:16:13.696 FileIdExtension] Configured File ID manager: ArbitraryFileIdManager
[I 2024-07-09 10:16:13.696 FileIdExtension] ArbitraryFileIdManager : Configured root dir: C:/Users/xxxx
[I 2024-07-09 10:16:13.696 FileIdExtension] ArbitraryFileIdManager : Configured database path: C:\Users\xxxx\AppData\Roaming\jupyter\file_id_manager.db
[I 2024-07-09 10:16:13.696 FileIdExtension] ArbitraryFileIdManager : Successfully connected to database file.
[I 2024-07-09 10:16:13.698 FileIdExtension] ArbitraryFileIdManager : Creating File ID tables and indices with journal_mode = DELETE
[I 2024-07-09 10:16:13.698 FileIdExtension] Attached event listeners.
[I 2024-07-09 10:16:13.698 ServerApp] jupyter_server_fileid | extension was successfully loaded.
[I 2024-07-09 10:16:13.698 ServerApp] jupyter_server_terminals | extension was successfully loaded.
[I 2024-07-09 10:16:13.698 ServerApp] jupyter_server_ydoc | extension was successfully loaded.
[I 2024-07-09 10:16:13.698 LabApp] JupyterLab extension loaded from C:\Users\xxxx\AppData\Local\anaconda3\Lib\site-packages\jupyterlab
[I 2024-07-09 10:16:13.698 LabApp] JupyterLab application directory is C:\Users\xxxx\AppData\Local\anaconda3\share\jupyter\lab
[E 2024-07-09 10:16:13.698 LabApp] Extension Manager: No manager defined for provider 'pypi'.
[W 2024-07-09 10:16:13.698 ServerApp] jupyterlab | extension failed loading with message: NotImplementedError()
    Traceback (most recent call last):
      File "C:\Users\xxxx\AppData\Local\anaconda3\Lib\site-packages\jupyter_server\extension\manager.py", line 360, in load_extension
        extension.load_all_points(self.serverapp)
      File "C:\Users\xxxx\AppData\Local\anaconda3\Lib\site-packages\jupyter_server\extension\manager.py", line 232, in load_all_points
        return [self.load_point(point_name, serverapp) for point_name in self.extension_points]
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\xxxx\AppData\Local\anaconda3\Lib\site-packages\jupyter_server\extension\manager.py", line 232, in <listcomp>
        return [self.load_point(point_name, serverapp) for point_name in self.extension_points]
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\xxxx\AppData\Local\anaconda3\Lib\site-packages\jupyter_server\extension\manager.py", line 223, in load_point
        return point.load(serverapp)
               ^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\xxxx\AppData\Local\anaconda3\Lib\site-packages\jupyter_server\extension\manager.py", line 151, in load
        return loader(serverapp)
               ^^^^^^^^^^^^^^^^^
      File "C:\Users\xxxx\AppData\Local\anaconda3\Lib\site-packages\jupyter_server\extension\application.py", line 475, in _load_jupyter_server_extension
        extension.initialize()
      File "C:\Users\xxxx\AppData\Local\anaconda3\Lib\site-packages\jupyterlab\labapp.py", line 866, in initialize
        super().initialize()
      File "C:\Users\xxxx\AppData\Local\anaconda3\Lib\site-packages\jupyter_server\extension\application.py", line 437, in initialize
        self._prepare_handlers()
      File "C:\Users\xxxx\AppData\Local\anaconda3\Lib\site-packages\jupyter_server\extension\application.py", line 327, in _prepare_handlers
        self.initialize_handlers()
      File "C:\Users\xxxx\AppData\Local\anaconda3\Lib\site-packages\jupyterlab\labapp.py", line 768, in initialize_handlers
        raise NotImplementedError()
    NotImplementedError

  _   _          _      _
 | | | |_ __  __| |__ _| |_ ___
 | |_| | '_ \/ _` / _` |  _/ -_)
  \___/| .__/\__,_\__,_|\__\___|
       |_|

Read the migration plan to Notebook 7 to learn about the new features and the actions to take if you are using extensions.

https://jupyter-notebook.readthedocs.io/en/latest/migrate_to_notebook7.html

Please note that updating to Notebook 7 might break some of your extensions.

[I 2024-07-09 10:16:13.706 ServerApp] nbclassic | extension was successfully loaded.
[I 2024-07-09 10:16:13.716 ServerApp] notebook | extension was successfully loaded.
[I 2024-07-09 10:16:13.716 ServerApp] panel.io.jupyter_server_extension | extension was successfully loaded.
[I 2024-07-09 10:16:13.716 ServerApp] The port 8888 is already in use, trying another port.
[I 2024-07-09 10:16:13.716 ServerApp] Serving notebooks from local directory: C:\Users\xxxx
[I 2024-07-09 10:16:13.716 ServerApp] Jupyter Server 2.14.1 is running at:
[I 2024-07-09 10:16:13.716 ServerApp] http://localhost:8889/lab?token=80b1e2671c036c85530f6b057b7f5ee03779503d4677d5fc
[I 2024-07-09 10:16:13.716 ServerApp]     http://127.0.0.1:8889/lab?token=80b1e2671c036c85530f6b057b7f5ee03779503d4677d5fc
[I 2024-07-09 10:16:13.716 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2024-07-09 10:16:13.741 ServerApp]

    To access the server, open this file in a browser:
        file:///C:/Users/xxxx/AppData/Roaming/jupyter/runtime/jpserver-5500-open.html
    Or copy and paste one of these URLs:
        http://localhost:8889/lab?token=80b1e2671c036c85530f6b057b7f5ee03779503d4677d5fc
        http://127.0.0.1:8889/lab?token=80b1e2671c036c85530f6b057b7f5ee03779503d4677d5fc
[I 2024-07-09 10:16:13.816 ServerApp] Skipped non-installed server(s): bash-language-server, dockerfile-language-server-nodejs, javascript-typescript-langserver, jedi-language-server, julia-language-server, pyright, python-language-server, r-languageserver, sql-language-server, texlab, typescript-language-server, unified-language-server, vscode-css-languageserver-bin, vscode-html-languageserver-bin, vscode-json-languageserver-bin, yaml-language-server
[E 2024-07-09 10:16:15.381 ServerApp] Uncaught exception GET /lab?token=80b1e2671c036c85530f6b057b7f5ee03779503d4677d5fc (::1)
    HTTPServerRequest(protocol='http', host='localhost:8889', method='GET', uri='/lab?token=80b1e2671c036c85530f6b057b7f5ee03779503d4677d5fc', version='HTTP/1.1', remote_ip='::1')
    Traceback (most recent call last):
      File "C:\Users\xxxx\AppData\Local\anaconda3\Lib\site-packages\jupyter_server\extension\handler.py", line 28, in get_template
        return cast(str, self.settings[env].get_template(name))  # type:ignore[attr-defined]
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\xxxx\AppData\Local\anaconda3\Lib\site-packages\jinja2\environment.py", line 1013, in get_template
        return self._load_template(name, globals)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\xxxx\AppData\Local\anaconda3\Lib\site-packages\jinja2\environment.py", line 972, in _load_template
        template = self.loader.load(self, name, self.make_globals(globals))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\xxxx\AppData\Local\anaconda3\Lib\site-packages\jinja2\loaders.py", line 126, in load
        source, filename, uptodate = self.get_source(environment, name)
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\xxxx\AppData\Local\anaconda3\Lib\site-packages\jinja2\loaders.py", line 207, in get_source
        raise TemplateNotFound(template)
    jinja2.exceptions.TemplateNotFound: index.html

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "C:\Users\xxxx\AppData\Local\anaconda3\Lib\site-packages\tornado\web.py", line 1788, in _execute
        result = method(*self.path_args, **self.path_kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\xxxx\AppData\Local\anaconda3\Lib\site-packages\tornado\web.py", line 3301, in wrapper
        return method(self, *args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\xxxx\AppData\Local\anaconda3\Lib\site-packages\tornado\web.py", line 1967, in wrapper
        return method(self, *args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\xxxx\AppData\Local\anaconda3\Lib\site-packages\jupyterlab_server\handlers.py", line 172, in get
        tpl = self.render_template("index.html", page_config=page_config)  # type:ignore[no-untyped-call]
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\xxxx\AppData\Local\anaconda3\Lib\site-packages\jupyter_server\base\handlers.py", line 666, in render_template
        template = self.get_template(name)
                   ^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\xxxx\AppData\Local\anaconda3\Lib\site-packages\jupyter_server\extension\handler.py", line 30, in get_template
        return cast(str, super().get_template(name))  # type:ignore[misc]
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\xxxx\AppData\Local\anaconda3\Lib\site-packages\jupyter_server\base\handlers.py", line 661, in get_template
        return self.settings["jinja2_env"].get_template(name)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\xxxx\AppData\Local\anaconda3\Lib\site-packages\jinja2\environment.py", line 1013, in get_template
        return self._load_template(name, globals)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\xxxx\AppData\Local\anaconda3\Lib\site-packages\jinja2\environment.py", line 972, in _load_template
        template = self.loader.load(self, name, self.make_globals(globals))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\xxxx\AppData\Local\anaconda3\Lib\site-packages\jinja2\loaders.py", line 126, in load
        source, filename, uptodate = self.get_source(environment, name)
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\xxxx\AppData\Local\anaconda3\Lib\site-packages\jinja2\loaders.py", line 207, in get_source
        raise TemplateNotFound(template)
    jinja2.exceptions.TemplateNotFound: index.html
[E 2024-07-09 10:16:15.390 JupyterNotebookApp] {
      "Host": "localhost:8889",
      "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.7",
      "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 Edg/126.0.0.0"
    }
[E 2024-07-09 10:16:15.391 JupyterNotebookApp] 500 GET /lab?token=[secret] (bed6e14c0cc34b99baf42c80fe85058a@::1) 24.52ms referer=None

I have tried re-installing and downgrading jinja2, but it did not fix the issue. I would appreciate it if the community can share any feedback on how I could go about resolving this issue. Thanks!!


Solution

  • The error message suggests that this is not actually a problem with Jinja itself, so reinstalling Jinja won't fix the problem (as you've discovered). Jinja is actually reporting that it can't find a template that is meant to be installed by one of the jupyter packages. Reinstalling the jupyter related packages should fix your problem.