Skip to content
Permalink
Browse files

add a Jupyter data science notebook stack

  • Loading branch information...
nymoorland authored and parente committed Aug 22, 2015
1 parent 748fc67 commit 79169618d571506304934a7b29039085e77db78c
@@ -0,0 +1,80 @@
FROM jupyter/minimal-notebook

MAINTAINER Jupyter Project <jupyter@googlegroups.com>

# R pre-requisites
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libxrender1 \
fonts-dejavu \
gfortran \
gcc && apt-get clean


USER jovyan


# Install Python 3 packages
RUN conda install --yes \
'pandas=0.16*' \
'matplotlib=1.4*' \
'scipy=0.15*' \
'seaborn=0.6*' \
'scikit-learn=0.16*' \
'scikit-image=0.11*' \
'sympy=0.7*' \
'cython=0.22*' \
'patsy=0.3*' \
'statsmodels=0.6*' \
'cloudpickle=0.1*' \
'dill=0.2*' \
'numba=0.20*' \
'bokeh=0.9*' \
&& conda clean -yt

# Install Python 2 packages and kernel spec
RUN conda create -p $CONDA_DIR/envs/python2 python=2.7 \

This comment has been minimized.

Copy link
@statwonk

statwonk Feb 8, 2016

@parente a little bit of user feedback, if you'd be so kind. :) I think it'd be helpful to new users to have at least one package installed by pip in this example Dockerfile. I'd like to install ggplot2 which is available in pip but not in conda. If I add,

RUN pip install 'ggplot==0.6.8', ggplot will be installed in Python3 but not Python2.7.

Thanks for your help on the project!

This comment has been minimized.

Copy link
@parente

parente Feb 8, 2016

Member

It's a good idea. What do you think about documenting it on the recipes wiki page associated with the repo? Maybe in a "How to pip install additional libs for Python 3 and 2"?

https://github.com/jupyter/docker-stacks/wiki/Docker-Recipes

This comment has been minimized.

Copy link
@rgbkrk

rgbkrk Feb 8, 2016

Member

@blink1073 - any way of getting ggplot available on conda's default channel? This one is requested commonly enough.

This comment has been minimized.

Copy link
@blink1073

blink1073 Feb 9, 2016

Member

We're in the process of setting up a community conda channel, stay tuned.

This comment has been minimized.

Copy link
@statwonk

statwonk Feb 9, 2016

That's great, re: the community conda channel. In the meantime, @parente I think it's a great idea to have a section in the Wiki. pip houses a lot of really great software, it'd be a shame to purposely exclude it, no?

This comment has been minimized.

Copy link
@parente

parente Feb 9, 2016

Member

I personally use pip all the time to add on to these images. It's not difficult, just needs some doc.

This comment has been minimized.

Copy link
@jakirkham

jakirkham Feb 9, 2016

Member

So, by default it uses the root python 3 environment with conda. If you want to switch environments, run source activate python2 and then you can pip install into python 2 as needed.

Also, excited to hear about the community channel.

This comment has been minimized.

Copy link
@parente

This comment has been minimized.

Copy link
@jakirkham

jakirkham Feb 9, 2016

Member

Do you think we maybe should create some shims or links to these in /usr/local/bin maybe like pip2 and pip3 to make this a little clearer?

This comment has been minimized.

Copy link
@parente

parente Feb 9, 2016

Member

Absolutely. Adding them to the READMEs for the images that have both py2 and py3 will help as well.

Would it also help to have conda2 / conda3 shims or does that just get confusing?

This comment has been minimized.

Copy link
@jakirkham

jakirkham Feb 9, 2016

Member

Sounds good.

Hmm...it seems to me that conda is already environment aware, but maybe we could do a better job pointing out how we have constructed the environments in places where it is less clear.

This comment has been minimized.

Copy link
@parente

parente Feb 9, 2016

Member

The bottom of each README has a section about the conda environments. For example:

https://github.com/jupyter/docker-stacks/blob/master/datascience-notebook/README.md#conda-environments

But it can certainly be improved. Let's take this over to an issue or PR?

This comment has been minimized.

Copy link
@statwonk

statwonk Feb 10, 2016

@parente sorry for the delay, I'm certainly appreciative of the work! I'll give the new README section a shot later today, but it seems pretty clear to me. Thanks!

'ipython=3.2*' \
'pandas=0.16*' \
'matplotlib=1.4*' \
'scipy=0.15*' \
'seaborn=0.6*' \
'scikit-learn=0.16*' \
'scikit-image=0.11*' \
'sympy=0.7*' \
'cython=0.22*' \
'patsy=0.3*' \
'statsmodels=0.6*' \
'cloudpickle=0.1*' \
'dill=0.2*' \
'numba=0.20*' \
'bokeh=0.9*' \
pyzmq \
&& conda clean -yt
RUN $CONDA_DIR/envs/python2/bin/python \
$CONDA_DIR/envs/python2/bin/ipython \
kernelspec install-self --user

# R packages
RUN conda config --add channels r
RUN conda install --yes \
'r-base=3.2*' \
'r-irkernel=0.4*' \
'r-plyr=1.8*' \
'r-devtools=1.8*' \
'r-dplyr=0.4*' \
'r-ggplot2=1.0*' \
'r-tidyr=0.2*' \
'r-shiny=0.12*' \
'r-rmarkdown=0.7*' \
'r-forecast=5.8*' \
'r-stringr=0.6*' \
'r-rsqlite=1.0*' \
'r-reshape2=1.4*' \
'r-nycflights13=0.1*' \
'r-caret=6.0*' \
'r-rcurl=1.95*' \
'r-randomforest=4.6*' && conda clean -yt

# Switch back to root so that supervisord runs under that user
USER root
No changes.
@@ -0,0 +1,30 @@
# Jupyter Notebook Scientific Python Stack

## What it Gives You

* Jupyter Notebook server v3.2.x
* Conda Python 3.4.x and Python 2.7.x environments
* pandas, matplotlib, scipy, seaborn, scikit-learn, scikit-image, sympy, cython, patsy, statsmodel, cloudpickle, dill, numba, bokeh pre-installed
* Conda R v3.2.x and channel
* plyr, devtools, dplyr, ggplot2, tidyr, shiny, rmarkdown, forecast, stringr, rsqlite, reshape2, nycflights13, caret, rcurl, and randomforest pre-installed
* Options for HTTPS, password auth, and passwordless `sudo`

## Basic Use

The following command starts a container with the Notebook server listening for HTTP connections on port 8888 without authentication configured.

```
docker run -d -p 8888:8888 jupyter/scipy-notebook
```

## Options

You may customize the execution of the Docker container and the Notebook server it contains with the following optional arguments.

* `-e PASSWORD="YOURPASS"` - Configures Jupyter Notebook to require the given password. Should be conbined with `USE_HTTPS` on untrusted networks.
* `-e USE_HTTPS=yes` - Configures Jupyter Notebook to accept encrypted HTTPS connections. If a `pem` file containing a SSL certificate and key is not found in `/home/jovyan/.ipython/profile_default/security/notebook.pem`, the container will generate a self-signed certificate for you.
* `-e GRANT_SUDO=yes` - Gives the `jovyan` user passwordless `sudo` capability. Useful for installing OS packages. **You should only enable `sudo` if you trust the user or if the container is running on an isolated host.**
* `-v /some/host/folder/for/work:/home/jovyan/work` - Host mounts the default working directory on the host to preserve work even when the container is destroyed and recreated (e.g., during an upgrade).
* `-v /some/host/folder/for/server.pem:/home/jovyan/.ipython/profile_default/security/notebook.pem` - Mounts a SSL certificate plus key for `USE_HTTPS`. Useful if you have a real certificate for the domain under which you are running the Notebook server.
* `-e INTERFACE=10.10.10.10` - Configures Jupyter Notebook to listen on the given interface. Defaults to '*', all interfaces, which is appropriate when running using default bridged Docker networking. When using Docker's `--net=host`, you may wish to use this option to specify a particular network interface.
* `-e PORT=8888` - Configures Jupyter Notebook to listen on the given port. Defaults to 8888, which is the port exposed within the Dockerfile for the image. When using Docker's `--net=host`, you may wish to use this option to specify a particular port.
No changes.

0 comments on commit 7916961

Please sign in to comment.
You can’t perform that action at this time.