5

Jupyter Notebook and Jupyter Lab worked well until I updated packages and set environments. After that, JupyterLab 3.0 doesn't open. It shows 404 and an error message:

[I 18:21:13.532 LabApp] JupyterLab extension loaded from 
C:\Users\Alfonso\AppData\Roaming\Python\Python38\site-packages\jupyterlab
[I 18:21:13.532 LabApp] JupyterLab application directory is C:\Users\Alfonso\AppData\Roaming\Python\share\jupyter\lab
[W 18:21:13.533 LabApp] Error loading server extension jupyterlab
    Traceback (most recent call last):
    File "C:\ProgramData\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 2036, in init_server_extensions
        func(self)
    File "C:\Users\Alfonso\AppData\Roaming\Python\Python38\site-packages\jupyterlab\extension.py", line 226, in load_jupyter_server_extension
        add_handlers(web_app, config)
    File "C:\ProgramData\Anaconda3\lib\site-packages\jupyterlab_server\handlers.py", line 162, in add_handlers
        handlers.append((url_pattern, LabHandler))
    AttributeError: 'NotebookWebApplication' object has no attribute 'append'
[I 18:23:27.282 LabApp] Serving notebooks from local directory: C:\Users\Alfonso
[I 18:23:27.282 LabApp] Jupyter Notebook 6.3.0 is running at:
[I 18:23:27.282 LabApp] localhost:8889/…
[I 18:23:27.283 LabApp] or 127.0.0.1:8889/…
[I 18:23:27.283 LabApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 18:23:27.370 LabApp] To access the notebook, open this file in a browser: file:///C:/Users/Alfonso/AppData/Roaming/jupyter/runtime/nbserver-5876-open.html

enter image description here

I changed the browser (Firefox instead of Chrome), followed the suggestions in another post (How to solve 404 error of jupyter lab), but neither worked. Also, I've tried to fix the problem by installing as administrator and as user.

I was wondering if there's a solution that not involves reinstalling all Anaconda distribution.

Installed versions:

  • jupyterlab 3.0.11
  • jupyterlab_server 2.4.0
  • notebook 6.3.0
krassowski
  • 13,598
  • 4
  • 60
  • 92
Alfonso Chang
  • 53
  • 1
  • 1
  • 4
  • There is a clear error message in your output when running jupyterlab. Please copy-paste it here - pictures of code are not accessible. Please also list the versions of jupyterlab, notebook, and jupyter_server (if present) that you have installed. You can do this using `conda list` command or `pip list` (depending how you installed them) – krassowski Apr 09 '21 at 11:51
  • [I 18:21:13.532 LabApp] JupyterLab extension loaded from C:\Users\Alfonso\AppData\Roaming\Python\Python38\site-packages\jupyterlab [I 18:21:13.532 LabApp] JupyterLab application directory is C:\Users\Alfonso\AppData\Roaming\Python\share\jupyter\lab [W 18:21:13.533 LabApp] Error loading server extension jupyterlab Traceback (most recent call last): File "C:\ProgramData\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 2036, in init_server_extensions func(self) [1/3] – Alfonso Chang Apr 09 '21 at 23:27
  • File "C:\Users\Alfonso\AppData\Roaming\Python\Python38\site-packages\jupyterlab\extension.py", line 226, in load_jupyter_server_extension add_handlers(web_app, config) File "C:\ProgramData\Anaconda3\lib\site-packages\jupyterlab_server\handlers.py", line 162, in add_handlers handlers.append((url_pattern, LabHandler)) AttributeError: 'NotebookWebApplication' object has no attribute 'append' [I 18:23:27.282 LabApp] Serving notebooks from local directory: C:\Users\Alfonso [I 18:23:27.282 LabApp] Jupyter Notebook 6.3.0 is running at: [2/3] – Alfonso Chang Apr 09 '21 at 23:28
  • [I 18:23:27.282 LabApp] http://localhost:8889/?token=799aa4d28f5afcf799d55fd6f9a872bf0dd070f2edc50ad9 [I 18:23:27.283 LabApp] or http://127.0.0.1:8889/?token=799aa4d28f5afcf799d55fd6f9a872bf0dd070f2edc50ad9 [I 18:23:27.283 LabApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [C 18:23:27.370 LabApp] To access the notebook, open this file in a browser: file:///C:/Users/Alfonso/AppData/Roaming/jupyter/runtime/nbserver-5876-open.html [3/3] – Alfonso Chang Apr 09 '21 at 23:29
  • jupyterlab 3.0.11 | jupyterlab_server 2.4.0 | notebook 6.3.0 | – Alfonso Chang Apr 09 '21 at 23:31
  • It looks iike https://github.com/jupyterlab/jupyterlab_server/issues/146 but slightly different. It seems that you have multiple versions of these conflicting packages installed, in two places: - `C:\Users\Alfonso\AppData\Roaming\Python\Python38\site-packages` - `C:\ProgramData\Anaconda3\lib\site-packages` So packages that you installed via pip conflict with those installed via conda. Try `pip uninstall jupyterlab` and then `conda install -c conda-forge jupyterlab` – krassowski Apr 09 '21 at 23:47
  • It worked! I think I had tried the same before... but! Now, works! Thanks, man! – Alfonso Chang Apr 10 '21 at 00:51
  • Great! I will reformat your question and add an answer so it is easier for others to follow in case if someone else gets the same issue. – krassowski Apr 10 '21 at 09:15

1 Answers1

6

Someone else experienced a similar problem when they had conflicting jupyterlab_server and jupyterlab version installed (see issue 146 in jupyterlab_server repository), however your versions are fine. At a closer look the issue is with where they are installed:

The traceback includes paths to two locations:

  • C:\Users\<username>\AppData\Roaming\Python\Python38\site-packages
  • C:\ProgramData\Anaconda3\lib\site-packages

It indicates that you may have multiple versions of these packages installed in different places (a newer version installed in the local Python directories via pip, and an older version in the Anaconda3 directory installed via conda). Because conda on your system has a higher priority, when JupyterLab (installed localy) tries to import its dependencies, it gets the old version of notebook and jupyterlab_server from conda directories, which cannot do what it wants.

Solution:

  1. pip uninstall jupyterlab
  2. conda install -c conda-forge jupyterlab

Context: There was an large infrastructure change in JupyterLab 3.0 meaning that it now uses jupyter_server and jupyterlab_server instead of notebook for all the backend work (interacting with kernels, filesystem, opening ports etc).

krassowski
  • 13,598
  • 4
  • 60
  • 92