3

I have installed the JupyterHub docker image on my server, which automatically creates and launches jupyter notebook containers for each user who logs in: https://github.com/jupyterhub/jupyterhub

Inside this personal container, I can use pip/conda to install extra packages. However, whenever the host machine reboots, the container has to be recreated and the installed packages are lost.

Is there a good solution for making this persistent? I suppose the installed packages could be mounted as some kind of persistent volume (like the user data already is), but with little Docker experience I wouldn't know how to set that up.

Christoph Burschka
  • 4,467
  • 3
  • 16
  • 31

1 Answers1

2

Check if official Jupyter documentation on user environments helps. I've copied the text from the link below:

Allow users to create their own conda environments

Sometimes you want users to be able to create their own conda environments. By default, any environments created in a JupyterHub session will not persist across sessions. To resolve this, take the following steps:

Ensure the nb_conda_kernels package is installed in the root environment (e.g., see Build a custom Docker image with repo2docker)

Configure Anaconda to install user environments to a folder within $HOME.

Create a file called .condarc in the home folder for all users, and make sure that the following lines are inside:

envs_dirs:
   /home/jovyan/my-conda-envs/

The text above will cause Anaconda to install new environments to this folder, which will persist across sessions.

9769953
  • 10,344
  • 3
  • 26
  • 37
Kamil Niski
  • 4,580
  • 1
  • 11
  • 24