Zero-to-jupyterhub-k8s: Instructions on Kubernetes & Packages

Created on 28 Aug 2018  路  6Comments  路  Source: jupyterhub/zero-to-jupyterhub-k8s

Thank you for the detailed instructions for lunching JupyterHub on Google Cloud with Kubernetes, it was quite easy! However, I am at a complete loss on how to install a single package such as pandas, matplot lib or more ideally, the full anaconda packages - and the Kubernetes documents are quite deep with no clear indication of where to start. I think an nice addition to the docs would be a simple page, how to install packages.

help wanted

documentation question

All 6 comments

I agree!

To install as a user, or to install for everyone btw?

For a user, using pip, you can add --user, so: pip install --user <package name> as all content installed in the user directories will remain.

Accomplishing the same thing with conda is a lot complexer though and I don't fully grasp what we should do in order for this to work efficiently.


To install a package for everyone so they don't have to do it themselves (after having selected the most suitable base image with packages pre-installed in the first place), you need to extend a base image and build a new on top of it.

See: https://zero-to-jupyterhub.readthedocs.io/en/latest/user-environment.html#customize-an-existing-docker-image

My thought was to install the packages for everyone, this is for a middle school coding club. I鈥檒l need to dig into the documents you shared. I will look into the base image process. Thanks.

@tzujan for smaller classes, you might also look at tljh.jupyter.org, which is a more opinionated distribution optimized for smaller classes with a lot less complexity.

@yuvipanda that is fantastic! I will dig in. Wonder if I'll need to undo the work I have done.

Also, reading though the customization link that @consideRatio posted, if I am reading it correctly, I need to install docker, then install python, Jupyter and all my packages there, then create another docker image inside it so that I can have several users using the same python version and packages. What confuses me is the fact that I can already run Jupyter from my IP address, which says to me there is already a base image that I could install packages on.

Sadly, work is getting in the way of getting to the bottom of this!

@tzujan yes, an example would look like this (it really can be a two line dockerfile):

FROM jupyter/minimal-notebook:8ccdfc1da8d5
RUN pip install --no-cache \
  jupyterhub==0.9.* \
  pandas \
  more-packages...

Then you build & push that image, e.g.

docker build -t tzujan/my-single-image:v0.1 .
docker push tzujan/my-single-image:v0.1

and in your config.yaml, pick your custom image instead of the default:

singleuser:
  image:
    name: tzujan/my-single-image
    tag: v0.1

This kind of documentation is or should be documentation related to the Customizing User Environment section of the guide.

Was this page helpful?
0 / 5 - 0 ratings