Skip to content

Commit 7aa6944

Browse files
authored
Spike Interface container with jupyterlab interface (#1)
* Has a few standard spike sorters installed * Can be used on any OS * Has option to drag and drop data folder to start jupyterlab (for Windows users)
1 parent 27528e8 commit 7aa6944

4 files changed

Lines changed: 106 additions & 0 deletions

File tree

spikeinterface/Dockerfile

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
FROM jupyter/datascience-notebook:hub-1.5.0
2+
3+
LABEL maintainer="Vincent Prevosto <prevosto@mit.edu>"
4+
5+
USER root
6+
# APT packages
7+
RUN apt update && \
8+
apt install -y --no-install-recommends \
9+
libgl1-mesa-glx \
10+
datalad && \
11+
apt clean && \
12+
rm -rf /var/lib/apt/lists/*
13+
14+
# copy repo
15+
WORKDIR /srv
16+
RUN git clone https://github.com/SpikeInterface/spikeinterface.git
17+
18+
RUN fix-permissions $CONDA_DIR && \
19+
fix-permissions /home/$NB_USER && \
20+
fix-permissions /srv/spikeinterface
21+
22+
#Switch to user
23+
USER $NB_UID
24+
25+
# update Anaconda and install pip
26+
RUN conda update -y conda && \
27+
conda install -y pip
28+
29+
# Conda installs
30+
RUN conda config --set channel_priority flexible && \
31+
conda install -y -c conda-forge nb_conda_kernels \
32+
jupyter_contrib_nbextensions \
33+
jupyterlab-git \
34+
pynwb && \
35+
conda clean -tipsy
36+
37+
# Create environment
38+
RUN ln -s /srv/spikeinterface /home/$NB_USER/
39+
WORKDIR /home/$NB_USER/spikeinterface/installation_tips/
40+
RUN conda env create -f full_spikeinterface_environment_mac.yml
41+
42+
# Make kernels available
43+
SHELL ["conda","run","-n","spikeinterface","/bin/bash","-c"]
44+
RUN conda install --quiet --yes ipykernel && \
45+
conda install --quiet --yes -c conda-forge datalad && \
46+
python -m ipykernel install --user --name spikeinterface --display-name "spikeinterface" && \
47+
pip install jupytext dotenv
48+
49+
# Configure git (required by datalad)
50+
WORKDIR /home/$NB_USER/spikeinterface/
51+
RUN git config --global --add user.name "Jovyan" && \
52+
git config --global --add user.email jovyan@example.net
53+
54+
# Create "getting started" notebook in home directory
55+
WORKDIR /home/$NB_USER/spikeinterface/examples/getting_started/
56+
RUN jupytext --to notebook plot_getting_started.py && \
57+
cp ~/spikeinterface/examples/getting_started/plot_getting_started.ipynb ~/getting_started.ipynb
58+
59+
# Make sure to switch back to user (avoid running ui containers as root)
60+
USER $NB_UID
61+
WORKDIR /home/$NB_USER
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
@echo off
2+
Title Drag and drop a data folder
3+
Mode con cols=60 lines=3
4+
IF [%1] EQU [] Goto:Error
5+
set JUPYTER_TOKEN=mytoken
6+
docker run -d --rm --name spikeinterface -v "%~1":/home/jovyan/data -p 8888:8888 -e JUPYTER_TOKEN wanglabneuro/spikeinterface:0.1
7+
TIMEOUT /T 2
8+
START /W "" http://localhost:8888/lab?token=mytoken
9+
ECHO Spike Interface started
10+
TIMEOUT /T 2
11+
Exit /b
12+
13+
::**********************************************************
14+
:Error
15+
Color 0C & echo(
16+
ECHO You must drag and drop a folder on this batch program
17+
Timeout /T 5 /NoBreak >nul
18+
Exit /b
19+
::**********************************************************

spikeinterface/build.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
docker build -t wanglabneuro/spikeinterface:0.1 .

spikeinterface/readme.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
### How to build this image
2+
Open a terminal, navigate to the spikeinterface directory, then run:
3+
`docker build -t wanglabneuro/spikeinterface:0.1 .`
4+
On Linux systems, you can also use the build script (after making it executable `chmod +x build.sh`):
5+
`./build.sh`
6+
7+
### How to run the spikeinterface container
8+
**Method 1** For Windows: drag and drop the data folder on `Run_SpikeInterface.bat`. Replace "mytoken" by whatever word.
9+
10+
**Method 2**
11+
On Linux/MacOS:
12+
`export JUPYTER_TOKEN='mytoken'`
13+
`docker run -d --rm --name spikeinterface -v "${PWD}":/home/jovyan/work -p 8888:8888 -e JUPYTER_TOKEN wanglabneuro/spikeinterface:0.1`
14+
15+
On Windows:
16+
`set JUPYTER_TOKEN=mytoken`
17+
`docker run -d --rm --name spikeinterface -v "%CD%":/home/jovyan/work -p 8888:8888 -e JUPYTER_TOKEN wanglabneuro/spikeinterface:0.1`
18+
19+
Then open http://localhost:8888/lab?token=mytoken in a browser.
20+
21+
22+
23+

0 commit comments

Comments
 (0)