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

base-notebook: stop installing nodejs from conda-forge #2172

Merged
merged 5 commits into from
Nov 8, 2024

Conversation

consideRatio
Copy link
Collaborator

@consideRatio consideRatio commented Nov 6, 2024

Describe your changes

nodejs was a conda dependency of jupyterhub, but by installing
jupyterhub-base we no longer need it and could opt to remove it.

By doing this, building base-notebook led to a reported size reduction
from 974MB to 828MB, which is a 146MB / 15% size reduction.

Issue ticket if applicable

Checklist (especially for first-time contributors)

  • I have performed a self-review of my code
  • If it is a core feature, I have added thorough tests
    I removed a test related to npm, dependency of nodejs conda-forge package.
  • I will try not to use force-push to make the review process easier for reviewers
  • I have updated the documentation for significant changes

nodejs was a conda dependency of jupyterhub, but by installing
jupyterhub-base we no longer need it and could opt to remove it.

By doing this, building base-notebook led to a reported size reduction
from 974MB to 828MB, which is a 146MB / 15% size reduction.
@mathbunnyru
Copy link
Member

@mathbunnyru @consideRatio @yuvipanda @manics please vote here: 👍 or 👎

We need 2 positive votes to accept this change.

@mathbunnyru
Copy link
Member

By doing this, building base-notebook led to a reported size reduction from 974MB to 828MB, which is a 146MB / 15% size reduction.

That's great!

@mathbunnyru
Copy link
Member

mathbunnyru commented Nov 6, 2024

I've checked and the latest published image is using the proper nodejs (I want to have an image with the correct nodejs before we remove it):

x86_64 base (which had the problem): https://github.com/jupyter/docker-stacks/wiki/x86_64-default-base-notebook-28a0b25bcec1
nodejs 22.9.0

CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@mathbunnyru
Copy link
Member

mathbunnyru commented Nov 7, 2024

@consideRatio why are we using jupyterhub-base and not jupyterhub-singleuser?
And what's the difference between these 2?

@consideRatio
Copy link
Collaborator Author

consideRatio commented Nov 7, 2024

I understand the difference to also bundling with jupyterlab as a dependency when using jupyterhub-singleuser conda-forge package, i figure the general practice should be to install -base if using conda-forge, and then add the UI of preference etc

@mathbunnyru
Copy link
Member

So, in our case, it will be the same thing in the end no matter what we use (because we're installing jupyterlab in the same place ourselves)?

@consideRatio
Copy link
Collaborator Author

Yes i think so

@mathbunnyru
Copy link
Member

mathbunnyru commented Nov 7, 2024

Then I think it's better to use jupyterhub-singleuser. It better shows our intent - we want our images to be used as a singleuser images.

We're using jupyterhub-singleuser executable in our images.
As mentioned by @ykazakov in #2171 (comment) it is installed by jupyterhub-base package, but I think it's counterintuitive.
If conda-forge package managers decide to move the binary, we will still be safe.

@consideRatio @ykazakov what do you think?

@flaviomartins
Copy link

flaviomartins commented Nov 7, 2024

Then I think it's better to use jupyterhub-singleuser. It better shows our intent - we want our images to be used as a singleuser images.

We're using jupyterhub-singleuser executable in our images. As mentioned by @ykazakov in #2171 (comment) it is installed by jupyterhub-base package, but I think it's counterintuitive. If conda-forge package managers decide to move the binary, we will still be safe.

@consideRatio @ykazakov what do you think?

I researched this a little bit and found it a little confusing that the conda-forge package maintainers decided to use jupyterhub-base as a dependency for the main jupyterhub package instead of going with jupyterhub-singleuser (here https://github.com/conda-forge/jupyterhub-feedstock/blob/970985288045a6f87239f2b662bccac3563b79cb/recipe/meta.yaml#L106).

It now seems like your intuition makes more sense! The package jupyterhub is for server installations (i.e., should really be called jupyterhub-multiuser), thus jupyterhub-singleuser is the package to install in this docker image. Makes sense?

@consideRatio
Copy link
Collaborator Author

consideRatio commented Nov 7, 2024

@minrk do you have a recommendation here about pinning juoyterhub-base vs juoyterhub-singleuser?

I have a guess that jupyterhub-singleuser was initially used, and then jupyterhub-base came when it wasnt a good assumption that jupyterlab was required or similar, so in that sense, it be more relevant to encourage use of jupyterhub-base than -singleuser?

@ykazakov
Copy link

ykazakov commented Nov 7, 2024

Then I think it's better to use jupyterhub-singleuser. It better shows our intent - we want our images to be used as a singleuser images.

I agree. Looks like the package jupyterhub-singleuser does not install any files by itself. So it is mainly used for aggregating dependencies needed to run the user servers.

@minrk
Copy link
Member

minrk commented Nov 7, 2024

The conda jupyterhub package is the application JupyterHub, which requires the Python package and the proxy (i.e. if you conda install jupyterhub, you can run jupyterhub; this is not true of jupyterhub-base). jupyterhub-base is just the Python jupyterhub package, what you get from pip install. This matches a widespread pattern in conda of e.g. matplotlib-base, etc. where the -base package is the bare minimum, and may not be fully functional without other dependencies, while the default name gets you a more 'default' install with fuller dependencies. It is a bit analogous to apt's recommends, which are dependencies that you get by default, but can technically opt-out of if you want with --no-install-recommends. -base is the --no-recommends package naming convention.

jupyterhub-singleuser is an empty metapackage to get enough to be able to execute jupyterhub-singleuser (i.e. base + jupyterlab, though technically other combinations are still valid without jupyterlab - notebook, jupyter-server + custom UI, etc.).

I'd say jupyterhub-base is the right choice here, because we're already installing the single-user server components separately and explicitly, installing jupyterhub-singleuser doesn't get anything.

@minrk
Copy link
Member

minrk commented Nov 7, 2024

There's no real downside to jupyterhub-singleuser either, if you want to go that way. If it every develops more precise constraints (e.g. jupyter-server>2), those constraints will be applied in jupyterhub-singleuser (it will never have any content, it will always only be a collection of dependencies, at least until/unless jupyterhub-singleuser becomes a separate Python package, which I have no plans to do)

@mathbunnyru
Copy link
Member

Thanks, everyone!

If there are no real downsides to using -singleuser let's have it.
@consideRatio please make it as part of this PR (no need to create a new one).

I'm 100% sure it will be more clear for people who don't know the nuances of these packages what's going on. And even for those who do, it still looks clear - we want to run singleuser instances, so we install -singleuser package.

@minrk
Copy link
Member

minrk commented Nov 7, 2024

I'll be a little more precise: there are no real downsides to JupyterHub-singleuser here because we install JupyterLab. The only real downside is that it excludes valid singleuser environments that don't want to include JupyterLab.

@flaviomartins
Copy link

flaviomartins commented Nov 8, 2024

I'll be a little more precise: there are no real downsides to JupyterHub-singleuser here because we install JupyterLab. The only real downside is that it excludes valid singleuser environments that don't want to include JupyterLab.

@consideRatio @mathbunnyru Just an idea. Would it make sense to add the dependency on jupyterhub-base here in the base-notebook image, and the jupyterhub-singleuser dependency on the minimal-notebook Dockerfile instead? Effectively, moving the jupyterlab dependency to minimal-notebook as well?

I think every image in this repository has minimal-notebook as BASE_IMAGE, so nothing changes there. Moving the jupyterlab dependencies to minimal-notebook would allow someone to use base-notebook as their BASE_IMAGE to roll with something other than jupyterlab, etc. (e.g., build another-minimal-notebook image)

@mathbunnyru
Copy link
Member

I'll be a little more precise: there are no real downsides to JupyterHub-singleuser here because we install JupyterLab. The only real downside is that it excludes valid singleuser environments that don't want to include JupyterLab.

@consideRatio @mathbunnyru Just an idea. Would it make sense to add the dependency on jupyterhub-base here in the base-notebook image, and the jupyterhub-singleuser dependency on the minimal-notebook Dockerfile instead? Effectively, moving the jupyterlab dependency to minimal-notebook as well?

I think every image in this repository has minimal-notebook as BASE_IMAGE, so nothing changes there. Moving the jupyterlab dependencies to minimal-notebook would allow someone to use base-notebook as their BASE_IMAGE to roll with something other than jupyterlab, etc. (e.g., build another-minimal-notebook image)

It's a whole different discussion, to be honest.

Effectively, moving the jupyterlab dependency to minimal-notebook as well?

This is likely to break so many users.
And if you want to move jupyterlab to minimal-notebook, you will have to move notebook as well, because it depends on jupyterlab: https://github.com/conda-forge/notebook-feedstock/blob/main/recipe/meta.yaml

I think every image in this repository has minimal-notebook as BASE_IMAGE, so nothing changes there. Moving the jupyterlab dependencies to minimal-notebook would allow someone to use base-notebook as their BASE_IMAGE to roll with something other than jupyterlab, etc. (e.g., build another-minimal-notebook image)

That's not true. We already have docker-stacks-foundation for exactly this reason. It allows you to install anything you want and doesn't have jupyterlab included.

So I don't think this change would solve any problem, but will definitely break many installations.

Note that jupyterhub-base is really whats the foundational need for this
image, where jupyterhub-singleuser the conda-forge package is building on
jupyterhub-base by also adding a depdendency on jupyterlab - but the
jupyterhub-singleuser command is provided by jupyterhub-base conda-forge
package.
CHANGELOG.md Outdated Show resolved Hide resolved
Co-authored-by: Ayaz Salikhov <[email protected]>
@mathbunnyru
Copy link
Member

Great, thanks. I will merge this when tests pass (should take around an hour).

@mathbunnyru mathbunnyru merged commit caf7252 into jupyter:main Nov 8, 2024
98 checks passed
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 this pull request may close these issues.

Nodejs has been dowgraded from 22.9.0 to 12.4.0 in latest images
5 participants