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

Kernelspec icon broken when base_url is used #11527

Closed
ricklamers opened this issue Nov 23, 2021 · 7 comments
Closed

Kernelspec icon broken when base_url is used #11527

ricklamers opened this issue Nov 23, 2021 · 7 comments
Labels

Comments

@ricklamers
Copy link

Description

The kernelspec icon is broken when a --LabApp.base_url is specified. This has to do with how the kernelspec path is used directly for the element.

See

let kernelIconUrl = spec.resources['logo-64x64'];

Reproduce

  1. Configure a base_url that's not "".
  2. Open the launcher tab
  3. Observe broken kernel icons (because the image path can't be resolved)

Expected behavior

Kernelspec icons should respect the configured base_url. This can be achieved in multiple ways, a relative path seems to work (stripping the leading / from the path /kernelspecs/python3/logo-64x64.png). Ideally the path resolve is harmonized with how resource paths in general in the application respect the base_url.

Context

  • Operating System and version: Debian Linux
  • Browser and version: Version 1.32.106 Chromium: 96.0.4664.45 (Official Build) (64-bit)
  • JupyterLab version: 3.2.4

Screenshot

image

@ricklamers ricklamers added the bug label Nov 23, 2021
@ricklamers
Copy link
Author

ricklamers commented Nov 23, 2021

I think in 3.1 this is how it makes the kernelspec path take the base_url into account:

kernelIconUrl = URLExt.join(baseUrl, kernelIconUrl.slice(index));

@krassowski
Copy link
Member

This is likely due to #11175 which also introduced this issue in JupyterLab Desktop where we worked around this by adding <base href="${juypter_server_url}"> (in jupyterlab/jupyterlab-desktop#322), but it caused other issues, some of which were fixed in jupyterlab/jupyterlab-desktop#344 but I am still not fully satisfied with it. CC @jtpio

@jtpio
Copy link
Member

jtpio commented Nov 23, 2021

Thanks @ricklamers for reporting and @krassowski for the input.

It does sound related to the change in #11175. #11175 points to the code in jupyter_server handling the base url:

https://github.com/jupyter-server/jupyter_server/blob/ac93dd8f60de54db99167016f0396959826b8ed9/jupyter_server/services/kernelspecs/handlers.py#L33

Which happens to be working fine when the base url is set to something else, for example on Binder: #11175 (comment)

@ricklamers could it be that the kernelspecs in your setup are handled differently?

The observation that lead to #11175 was the fact that kernelspecs was hardcoded in the logic and expected to be part of the resource URLs:

const index = kernelIconUrl.indexOf('kernelspecs');

@ricklamers
Copy link
Author

ricklamers commented Dec 6, 2021

Thanks for your responses/input @jtpio @krassowski!

I think it might be caused by the fact that in my configuration I'm using the Jupyter Enterprise Gateway (which in turn uses the Jupyter Kernel Gateway). They both have base_url configured (using KG_BASE_URL and EG_BASE_URL respectively). But the /api/kernelspecs still returns resources with an absolute path that doesn't respect the configured base_url:

{
  "resources": {
    "logo-64x64": "/kernelspecs/my-kernel/logo-64x64.png",
    "logo-32x32": "/kernelspecs/my-kernel/logo-32x32.png"
  }
}

@jtpio
Copy link
Member

jtpio commented Dec 6, 2021

Ah ok then that would explain why. So probably something that should be investigated in Jupyter Kernel / Entreprise Gateway to check the base_url is correctly handled?

@ricklamers
Copy link
Author

After merging jupyter-server/enterprise_gateway#1019 the problem went away for us. I think this was eventually the responsibility of the kernel manager (and the resource paths it returns). So I think we can consider this solved (never being an issue in JupyterLab itself).

@ricklamers
Copy link
Author

For the record, I also contributed that fix to the Kernel Gateway project because it was also affected: jupyter-server/kernel_gateway#372

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants