slac-lcls / jhub2

LCLS Jupyterhub deployment
0 stars 1 forks source link

Allow easier way to set JUPYTERLAB_DIR or conda env #1

Closed fzimmermann89 closed 1 month ago

fzimmermann89 commented 5 years ago

Hi,

it would be nice if there was an easy way to set JUPYTERLAB_DIR or the conda environment the jupyterlab will start in. This would allow installation of labextensions such as the git extension or ipywidgets for interactive plotting.

The current implenentation makes sure not to run a .bashrc before starting the jupyterlab which makes it difficult to make changes to the environment (still possible, but much more ugly than it could be). A nicer way could be to try to source a .jhubrc if it exists at https://github.com/slac-lcls/jhub2/blob/master/sshspawner.py#L64.

Thanks, Felix

weninc commented 5 years ago

Yes I agree that jupyter extensions are important, but I think you can install them without having to change out the jupyterlab executable. The following should work: source /reg/g/psdm/sw/jupyterhub/miniconda3/etc/profile.d/conda.sh conda activate jhub

fzimmermann89 commented 5 years ago

Thanks for the reply!

Unfortunalty this won't work as the labextensions will be saved in a common folder which I cannot write to:

pslogin01 ➜   source /reg/g/psdm/sw/jupyterhub/miniconda3/etc/profile.d/conda.sh
pslogin01➜  conda activate jhub
(jhub) pslogin01➜   jupyter labextension install @jupyter-widgets/jupyterlab-manager
[....]
Node v8.12.0

> /reg/g/psdm/sw/jupyterhub/miniconda3/envs/jhub/bin/npm pack @jupyter-widgets/jupyterlab-

Errored, use --debug for full output:
PermissionError: [Errno 13] Permission denied: '/reg/g/psdm/sw/jupyterhub/miniconda3/envs/jhub/share/jupyter/lab/extensions/jupyter-widgets-jupyterlab-manager-0.38.1.tgz'

The only solutions I can think of are either

I've a somewhat working solution for my usecase, but I'd like to have a more robust/semi-official way to do it..