Running DM Jupyter Notebooks locally

jupyter
Tags: #<Tag:0x00007f7f70645f90>

(wil) #1

Recently I wanted to run the tutorial notebooks on my laptop - it seems a few others also wanted to do this. The obvious approach is to use a docker container but thedm centos containers are minimal and have no Jupyter. The jupyterLab containers however do contain all you need to run notebooks and are the exact containers deployed when you login into the jupyter environment at NCSA.

For this you need docker installed and running.

Of course you may need some data depending on the notebook - intro-process-ccd for example requires ci_hsc_small . The contents of this should be in a WORK directory (mine was in /Users/womullan/LSSTgit/notebooks/WORK).

Next you need some notebooks I got the demo-notebooks and put them in /Users/womullan/LSSTgit/notebooks/.

Running the notebook environment with the container can then be done with a single command(where you substitute the womullan paths for your local directories):

docker run --volume=/Users/womullan/LSSTgit/notebooks:/tmp/notebooks --volume=/Users/womullan/LSSTgit/notebooks/WORK:/root/WORK -p 22000:22000 --rm -it lsstsqre/jld-lab:d20180911 /opt/rh/rh-python36/root/usr/bin/jupyter notebook --ip=0.0.0.0 --port=22000 --allow-root

This will output a URL to hit the notebook some thign like:
http://(cf6af7b52148 or 127.0.0.1):22000/?token=51f74a5d780d6e8f983eb93f413e9e69bfdd90396b93e792
Which means you should put :
http://127.0.0.1:22000/?token=51f74a5d780d6e8f983eb93f413e9e69bfdd90396b93e792
in the browser.

That is it.

Ancillary docker info :
If you want to connect ot a running container i.e the one you started above
find the container id with
```docker ps``

then connect with ```docker exec -it CONTAINERID /bin/bash``

That allows you to pip install any other packages you want for example.