Jupyterhub deployment devil in the details

162 views
Skip to first unread message

Michael Pastore

unread,
Jan 24, 2017, 9:56:45 PM1/24/17
to Project Jupyter
Cheers all,

I have been trying to complete a basic Jupyterhub deployment and following the docs.  In the docs, specifically at https://jupyterhub.readthedocs.io/en/latest/getting-started.html#installation it indicates a "recommended" set of folders for the installation:
  • /srv/jupyterhub for all security and runtime files
  • /etc/jupyterhub for all configuration files
  • /var/log for log files
So I manually created those folders.  But, when following the published steps to install jupyterhub, if you install using pip:
 
python3 -m pip install jupyterhub

the package does not end up in the recommended location   Even if you CD to /srv and use the above command it still doesn't end up in the recommended location.

So I spun up a new EC2 instance and started fresh, but this time I was going to use conda. From the PyData 2016 presentation by minrk on deploying jupyterhub, he states (see approx 12:01 mark)  

"I've set up conda in /opt/conda and that's accessible to everyone"

So this would seem to be a preferred location to install conda, So I went and attempted to install conda.  Only you don't, you install Anaconda or Miniconda.  I went with Miniconda and tried to put it under /opt and what I got instead was /opt/miniconda/bin/conda

I CD'ed to /src and again tried to install jupyterhub with the command

conda install -c conda-forge jupyterhub
 
but this time jupyterhub under up under /opt/miniconda/bin

So here are the questions:
  1. How does one install jupyterhub into the preferred directory structure using pip or conda?
    1. I was able to install it in the directory using pip3 install jupyterhub -t /srv/jupyterhub  but then jupyterhub is no in the executable path.  Is this an acceptable command for installing jupyterhub and if so how should it be launched?
    2. What is the comparable conda command to install jupyterhub in the recommended location?
  2. what is the minimum required installation of conda in order to use it in any part of the jupyterhub installation process? 
    1. For example, should we install minconda?  Or is there a conda only package and if so how can we install it?
    2. Is there a preferred location to install conda and if there is what is the command to install into a particular folder?  (* note that this exact question on SO remains unanswered).
  3. Where is he recommended location for jupyterhub_config.py file with respect to how jupyterhub is installed?  What I mean by this is if we manage to install it in the recommended folder, where should the config file go vs if we install jupyterhub in the default location which is dist-packages, where is the preferred location?

Thanks in advance for the help.

MinRK

unread,
Jan 25, 2017, 2:21:35 PM1/25/17
to Project Jupyter

On Wed, Jan 25, 2017 at 3:56 AM, Michael Pastore <batm...@gmail.com> wrote:

Cheers all,

I have been trying to complete a basic Jupyterhub deployment and following the docs.  In the docs, specifically at https://jupyterhub.readthedocs.io/en/latest/getting-started.html#installation it indicates a "recommended" set of folders for the installation:
  • /srv/jupyterhub for all security and runtime files
  • /etc/jupyterhub for all configuration files
  • /var/log for log files
So I manually created those folders.  But, when following the published steps to install jupyterhub, if you install using pip:
 
python3 -m pip install jupyterhub

the package does not end up in the recommended location   Even if you CD to /srv and use the above command it still doesn't end up in the recommended location.

So I spun up a new EC2 instance and started fresh, but this time I was going to use conda. From the PyData 2016 presentation by minrk on deploying jupyterhub, he states (see approx 12:01 mark)  

"I've set up conda in /opt/conda and that's accessible to everyone"

So this would seem to be a preferred location to install conda, So I went and attempted to install conda.  Only you don't, you install Anaconda or Miniconda.  I went with Miniconda and tried to put it under /opt and what I got instead was /opt/miniconda/bin/conda

I CD'ed to /src and again tried to install jupyterhub with the command

conda install -c conda-forge jupyterhub
 
but this time jupyterhub under up under /opt/miniconda/bin

Hi, sorry for the trouble, and thanks for asking here.


So here are the questions:
  1. How does one install jupyterhub into the preferred directory structure using pip or conda?
    1. I was able to install it in the directory using pip3 install jupyterhub -t /srv/jupyterhub  but then jupyterhub is no in the executable path.  Is this an acceptable command for installing jupyterhub and if so how should it be launched?
    2. What is the comparable conda command to install jupyterhub in the recommended location?

One thing that’s not mentioned above is that those directories don’t include the JupyterHub package or executable itself, which you can install however you would install any other Python packages. So a pip3 install jupyterhub is just fine, as is conda install jupyterhub. We don’t have a preferred location to put packages.

Perhaps what’s missing from the above spec is what are those files:

  • security and runtime files would be things like the jupyterhub.sqlite file, cookie secret, SSL key and cert, etc.
  • config would be your jupyterhub_config.py

The only one of these that’s really important, though, is that the runtime directory is private, and not readable by other users. It would be perfectly fine to put the config file and logs in the same /srv/jupyterhub for a fully contained deployment, for instance. These best practices are just how to make jupyterhub behave the most like traditional system-integrated services.

  1. what is the minimum required installation of conda in order to use it in any part of the jupyterhub installation process? 

    1. For example, should we install minconda?  Or is there a conda only package and if so how can we install it?
    2. Is there a preferred location to install conda and if there is what is the command to install into a particular folder?  (* note that this exact question on SO remains unanswered).

Miniconda is the minimum, since it provides Python and conda itself. The quickest way to get JupyterHub with conda, starting from miniconda is:

conda install -c conda-forge jupyterhub

This will install JupyterHub itself and the configurable-http-proxy. Or, you can start from bare Python + pip and npm, in which case you can install with:

pip3 install jupyterhub
npm install -g configurable-http-proxy

If you are running single-user servers on the same system, you also need the notebook package:

conda install -c conda-forge notebook

  1. Where is he recommended location for jupyterhub_config.py file with respect to how jupyterhub is installed?  What I mean by this is if we manage to install it in the recommended folder, where should the config file go vs if we install jupyterhub in the default location which is dist-packages, where is the preferred location?

The location of the config file is totally independent from where jupyterhub is installed. You can generate the default config file in /etc/jupyterhub_config.py with:

mkdir /etc/jupyterhub
jupyterhub --generate-config -f /etc/jupyterhub/jupyterhub_config.py

Or if you want your config in /srv/jupyterhub:

mkdir -p /srv/jupyterhub
cd /srv/jupyterhub
jupyterhub --generate-config

I hope that helps!

-Min


Thanks in advance for the help.

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscribe@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/7cee026e-dfd6-4929-ad6f-3722335004d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages