jupyterhub - 如何持久安装包?
jupyterhub - How to install packages persistently?
我已经在我的服务器上安装了 JupyterHub docker 图像,它会自动为每个登录用户创建并启动 jupyter notebook 容器:https://github.com/jupyterhub/jupyterhub
在这个个人容器中,我可以使用 pip/conda 安装额外的包。但是,每当主机重新启动时,必须重新创建容器并且安装的包会丢失。
有什么好的解决方案可以让它持久化吗?我想安装的包可以作为某种持久卷安装(就像用户数据已经是这样),但是 Docker 经验很少,我不知道如何设置它。
检查 official Jupyter documentation on user environments 是否有帮助。
我从下面的 link 中复制了文本:
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.
我已经在我的服务器上安装了 JupyterHub docker 图像,它会自动为每个登录用户创建并启动 jupyter notebook 容器:https://github.com/jupyterhub/jupyterhub
在这个个人容器中,我可以使用 pip/conda 安装额外的包。但是,每当主机重新启动时,必须重新创建容器并且安装的包会丢失。
有什么好的解决方案可以让它持久化吗?我想安装的包可以作为某种持久卷安装(就像用户数据已经是这样),但是 Docker 经验很少,我不知道如何设置它。
检查 official Jupyter documentation on user environments 是否有帮助。 我从下面的 link 中复制了文本:
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.