Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/tree shows 404 after upgrading to 0.4.0 #120

Closed
scmmmh opened this issue Jul 4, 2022 · 12 comments · Fixed by #122
Closed

/tree shows 404 after upgrading to 0.4.0 #120

scmmmh opened this issue Jul 4, 2022 · 12 comments · Fixed by #122

Comments

@scmmmh
Copy link

scmmmh commented Jul 4, 2022

I'm building a Docker image containing Jupyter Server 1.18.0 + nbclassic 0.4.0 + notebook 6.4.12. When I run jupyter server and try to access the /tree endpoint, I get a 404 error. If I downgrade nbclassic to 0.3.7, /tree works, but I don't get the fix for notebook extensions that 0.4.0 added.

@echarles
Copy link
Member

echarles commented Jul 4, 2022

You have 2 options as temporary workaround. Launch with

jupyter server --ServerApp.jpserver_extensions="{'nbclassic': True}"

or simply

jupyter nbclassic

We need to look why the extension was enabled by default in 0.3.x versions.

BTW with nbclassic 0.4.0 you don't need notebook 6.4.x anymore.

@scmmmh
Copy link
Author

scmmmh commented Jul 4, 2022

Thank you! That explains why it just worked :-).

Running

jupyter server extension enable nbclassic

should also fix this, right?

@echarles
Copy link
Member

echarles commented Jul 4, 2022

jupyter server extension enable nbclassic should also fix this, right?

True, I confirm it is working on my env and is prolly a better way to always enable the jupyter server extension.

@scmmmh
Copy link
Author

scmmmh commented Jul 4, 2022

For some reason running

jupyter server extension enable --system nbclassic --log-level DEBUG

gives me the following output:

Searching ['/', '/home/ou/TM129-22J/.jupyter', '/home/ou/TM129-22J/.local/etc/jupyter', '/usr/local/etc/jupyter', '/etc/jupyter'] for config files
Looking for jupyter_config in /etc/jupyter
Looking for jupyter_config in /usr/local/etc/jupyter
Looking for jupyter_config in /home/ou/TM129-22J/.local/etc/jupyter
Looking for jupyter_config in /home/ou/TM129-22J/.jupyter
Looking for jupyter_config in /
Looking for jupyter server extension enable_config in /etc/jupyter
Looking for jupyter server extension enable_config in /usr/local/etc/jupyter
Looking for jupyter server extension enable_config in /home/ou/TM129-22J/.local/etc/jupyter
Looking for jupyter server extension enable_config in /home/ou/TM129-22J/.jupyter
Looking for jupyter server extension enable_config in /
Paths used for configuration of jupyter_server_config: 
        /usr/local/etc/jupyter/jupyter_server_config.d/ip.json
        /usr/local/etc/jupyter/jupyter_server_config.d/notebook_shim.json
        /usr/local/etc/jupyter/jupyter_server_config.json
Enabling: nbclassic
- Writing config: /usr/local/etc/jupyter
    - Validating nbclassic...
      X Validation failed: 

Any ideas?

@echarles
Copy link
Member

echarles commented Jul 4, 2022

I run that same command on my env and it works fine with following output. Any detail after you X Validate failed?

Looking for jupyter_config in /etc/jupyter
Looking for jupyter_config in /usr/local/etc/jupyter
Looking for jupyter_config in /Users/echarles/opt/miniconda3/envs/nbclassic-4/etc/jupyter
Looking for jupyter_config in /Users/echarles/.local/etc/jupyter
Looking for jupyter_config in /Users/echarles/.jupyter
Looking for jupyter_config in /Users/echarles/datalayer-platform/src/platforms/io/services/admin/examples
Looking for jupyter server extension enable_config in /etc/jupyter
Looking for jupyter server extension enable_config in /usr/local/etc/jupyter
Looking for jupyter server extension enable_config in /Users/echarles/opt/miniconda3/envs/nbclassic-4/etc/jupyter
Looking for jupyter server extension enable_config in /Users/echarles/.local/etc/jupyter
Looking for jupyter server extension enable_config in /Users/echarles/.jupyter
Looking for jupyter server extension enable_config in /Users/echarles/datalayer-platform/src/platforms/io/services/admin/examples
Paths used for configuration of jupyter_server_config: 
        /usr/local/etc/jupyter/jupyter_server_config.json
Enabling: nbclassic
- Writing config: /usr/local/etc/jupyter
    - Validating nbclassic...
      nbclassic 0.4.0 OK
Paths used for configuration of nbclassic: 
        /usr/local/etc/jupyter/jupyter_server_config.d/nbclassic.json
Paths used for configuration of nbclassic: 
    
    - Extension successfully enabled.

maybe try with a brand new env on your local machine before docker?

conda create -y -n nbclassic-4 && \
  conda activate nbclassic-4 && \
  conda install -y python=3.9 pip && \
  pip install nbclassic==0.4.0 && \
  jupyter server extension enable --system nbclassic --log-level DEBUG && \
  jupyter server

@scmmmh
Copy link
Author

scmmmh commented Jul 4, 2022

Good idea. Right. That's working for me as well. Clearly it is one of the other dependencies that is breaking something. No to go looking for which one that is. Thanks for the help.

@scmmmh
Copy link
Author

scmmmh commented Jul 4, 2022

Ok. I blieve I've traced it. The problem is not so much that the "notebook" package is no longer needed, but that when it is installed, enabling the nbclassic extension fails.

@echarles
Copy link
Member

echarles commented Jul 4, 2022

Looks I can reproduce that also. After pip install notebook, enabling the extension returns.

   super().__init__(**kwargs)
  File "/Users/echarles/opt/miniconda3/envs/nbclassic-4/lib/python3.9/site-packages/traitlets/traitlets.py", line 1238, in __init__
    super_kwargs[key] = value
  File "/Users/echarles/opt/miniconda3/envs/nbclassic-4/lib/python3.9/contextlib.py", line 126, in __exit__
    next(self.gen)
  File "/Users/echarles/opt/miniconda3/envs/nbclassic-4/lib/python3.9/site-packages/traitlets/traitlets.py", line 1371, in hold_trait_notifications
    self.notify_change(change)
  File "/Users/echarles/opt/miniconda3/envs/nbclassic-4/lib/python3.9/site-packages/traitlets/traitlets.py", line 1386, in notify_change
    return self._notify_observers(change)
  File "/Users/echarles/opt/miniconda3/envs/nbclassic-4/lib/python3.9/site-packages/traitlets/traitlets.py", line 1431, in _notify_observers
    c(event)
  File "/Users/echarles/opt/miniconda3/envs/nbclassic-4/lib/python3.9/site-packages/jupyter_server/extension/manager.py", line 255, in _config_manager_changed
    self._load_config_manager(change.new)
  File "/Users/echarles/opt/miniconda3/envs/nbclassic-4/lib/python3.9/site-packages/jupyter_server/extension/manager.py", line 310, in _load_config_manager
    self.from_jpserver_extensions(jpserver_extensions)
  File "/Users/echarles/opt/miniconda3/envs/nbclassic-4/lib/python3.9/site-packages/jupyter_server/extension/manager.py", line 315, in from_jpserver_extensions
    self.add_extension(name, enabled=enabled)
  File "/Users/echarles/opt/miniconda3/envs/nbclassic-4/lib/python3.9/site-packages/jupyter_server/extension/manager.py", line 327, in add_extension
    if self.serverapp.reraise_server_extension_failures:
AttributeError: 'NoneType' object has no attribute 'reraise_server_extension_failures'

jupyter nbclassic continues to work, jupyter server extension enable nbclassic

This being said, having at the same time notebook<7 and nbclassic and lauching via the jupyter server command is not really a scenario we have envisaged. Do you have a need for that or would jupyter nbclassic work fine. FWIW nbclassic is the place where the new activities (bug fix...) for notebook<7 like UI should occur.

@scmmmh
Copy link
Author

scmmmh commented Jul 4, 2022

The reason I don't use jupyter nbclassic directly, is because I'm working on a tool for building images. Depending on how the tool is configured, the image may use nbclassic, jupyterlab, something custom via jupyter_server_proxy or a combination thereof. Using the extensions mechanism and then accessing stuff via the relevant /path makes the tool much simpler than having to check what is installed and how to run it.

The tool didn't actually install notebook<7, that was happening via one of the dependencies, which in turn depended on notebook<7. Uninstalling the notebook package fixes this bug, so I'm happy. Might just be useful to make a note of that somewhere in case somebody runs into something similar.

@echarles
Copy link
Member

echarles commented Jul 4, 2022

The reason I don't use jupyter nbclassic directly, is because I'm working on a tool for building images. Depending on how the tool is configured, the image may use nbclassic, jupyterlab, something custom via jupyter_server_proxy or a combination thereof

That sound like a great use-case of the jupyter server extension. It has been developed exactly for such needs.

Uninstalling the notebook package fixes this bug, so I'm happy

👍

Might just be useful to make a note of that somewhere in case somebody runs into something similar.

We will launch more work to update the documentation for that and other things.

@scmmmh
Copy link
Author

scmmmh commented Jul 4, 2022

Thanks for all the work. In general it nbclassic just works. 👍

We are planning to transition to notebook>7 and jupyterlab, but nbclassic gives us a nice transition phase while we move all the dependencies / extensions over.

@echarles
Copy link
Member

echarles commented Jul 5, 2022

I have opened a fix on #122

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants