0

I have a jupyterhub running over a kubernetes cluster with kubespawner. As I understand it, kubespawner is, via kubernetes, spinning up dockers on my cluster that have their own python environment and storage area.

For some user, I am attempting to import rpy2 (or whatever, it's not important), and the package is not installed.

My questions:

Where do these dockers get their python environment (e.g. Is there a dockerfile I can edit somewhere)?

How to I get rpy2 installed for just that one docker session?

How do I get rpy2 installed for that user (if possible)?

How do I get rpy2 installed for everyone on the hub?

Him
  • 5,257
  • 3
  • 26
  • 83

1 Answers1

1

Assuming you're using the official images (jupyterhub/jupyterhub) you'll find all installation steps in the related Dockerfile on hub.docker.com or on Github.

To install a package for just one (already running) container. You can use kubectl exec your-pod -- pip install xxx

To install it for every deployment you'd have to provide your own container and include that in your Deployment. I assume this would result in merging with the rpy2 image, which could be done with a Dockerfile like:

FROM jupyterhub/singleuser
RUN pip3 --no-cache-dir install \
   https://bitbucket.org/rpy2/rpy2/get/default.tar.gz && \
   rm -rf /root/.cache
pagid
  • 13,559
  • 11
  • 78
  • 104
  • You aren't extending the ``jupyterhub/jupyterhub`` image to add the package. You need to extend ``jupyterhub/singleuser`` image and then configure JupyterHub to use your custom image instead of ``juypyterhub/singleuser`` when spawning an individual notebook instance. https://hub.docker.com/r/jupyterhub/singleuser/ – Graham Dumpleton Mar 15 '17 at 09:19
  • Graham thx for the comment ... I updated my answer - I'm not a jupytherhub user, but tried to give a rough overview what could be done to solve the question. – pagid Mar 15 '17 at 11:09