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

500 Error at launch (KeyError: 'terminals_available' in self.settings) #255

Open
defjaf opened this issue Jul 27, 2023 · 4 comments
Open
Labels
bug Something isn't working

Comments

@defjaf
Copy link

defjaf commented Jul 27, 2023

Also reported on discourse.

macOS 13.5, Python 3.11.4 (homebrew)

With the recent move to notebook 7, I have been having issues with both notebook (documented here and here) and nbclassic.

For the latter, I am seeing a traceback, followed by a 500 error in the browser:

[E 2023-07-26 08:40:30.645 ServerApp] Uncaught exception GET /nbclassic/tree?token=e2a5e04ac6410a588e1132bac555b4f1fce1c781e1c9b4e0 (::1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/nbclassic/tree?token=e2a5e04ac6410a588e1132bac555b4f1fce1c781e1c9b4e0', version='HTTP/1.1', remote_ip='::1')
    Traceback (most recent call last):
      File "/opt/homebrew/lib/python3.11/site-packages/tornado/web.py", line 1786, in _execute
        result = await result
                 ^^^^^^^^^^^^
      File "/opt/homebrew/lib/python3.11/site-packages/tornado/gen.py", line 786, in run
        yielded = self.gen.send(value)
                  ^^^^^^^^^^^^^^^^^^^^
      File "/opt/homebrew/lib/python3.11/site-packages/nbclassic/tree/handlers.py", line 69, in get
        terminals_available=self.settings['terminals_available'],
                            ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
    KeyError: 'terminals_available'

If I change "/opt/homebrew/lib/python3.11/site-packages/nbclassic/tree/handlers.py", line 69 from

terminals_available=self.settings['terminals_available'],

to

terminals_available=self.settings.get('terminals_available', False),

(as is done in notebook/app.py) it works (no errors, no 500), but I assume this shouldn't be necessary (and perhaps hides a real bug or config issue)?

I assume it is a local config issue somehow, but in fact even if I get rid of all of the current directories listed with jupyter --paths it does not seem to help.

(There seem to be other interface problems as documented in my jupyter/notebook issue. Also, if relevant: Python 3.11 is installed by homebrew, but all packages, including jupyter, notebook, etc. are installed with pip.)

Any ideas?

@defjaf
Copy link
Author

defjaf commented Jul 27, 2023

Partial fix:

JUPYTER_PATH=/opt/homebrew/share/jupyter JUPYTER_CONFIG_PATH=/opt/homebrew/etc/jupyter jupyter nbclassic

seems to partially fix it -- there are errors in the terminal, but it runs.

This appears to be a config problem in some interaction between how homebrew and jupyter set paths?

(As such, I suspect that this is closely related to jupyter/notebook#6974)

@jtpio
Copy link
Member

jtpio commented Aug 1, 2023

cc @echarles @RRosio @ericsnekbytes for awareness

@defjaf
Copy link
Author

defjaf commented Aug 1, 2023

See also jupyterlab/jupyterlab#14890

@lp9052
Copy link

lp9052 commented Jan 9, 2024

jupyter_server_terminals's latest update added the following to respect terminal setting:

        """Initialize settings."""
        if not self.serverapp.terminals_enabled:
            return
        self.initialize_configurables()
        self.settings.update(
            {"terminals_available": True, "terminal_manager": self.terminal_manager}
        )

So if enable_terminal is set to false then it is guaranteed to fail the nbclassic/tree.
the latest code will fix this. Will we have a release soon?

Link to jupyter_server_terminals: jupyter-server/jupyter_server_terminals#85

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants