Skip to content

Instantly share code, notes, and snippets.

@cannin
Last active September 7, 2023 10:56
Show Gist options
  • Save cannin/ee9694a55f2db0fd86c8b9a13bba6fea to your computer and use it in GitHub Desktop.
Save cannin/ee9694a55f2db0fd86c8b9a13bba6fea to your computer and use it in GitHub Desktop.
Access CaImAn Pre-Installed in a Docker Image

RETRIEVE CaImAn DOCKER IMAGE

https://hub.docker.com/r/cannin/caiman

docker pull cannin/caiman:1.9.15-20230906

RUN CaImAn DOCKER CONTAINER

sudo docker rm -f cm; sudo docker run --name cm -d -p 4444:4444 -p 5900:5900 -8888:8888 -e SE_VNC_PASSWORD=password -v /home/ubuntu/tmp:/home/seluser/tmp --shm-size="4g" cannin/caiman:1.9.15-20230906

Change: /home/ubuntu/tmp:/home/seluser/tmp

  • /home/ubuntu/tmp is local folder (host)
  • /home/seluser/tmp is folder in container (guest)

Access via VNC

TEST CaImAn

** NOTE: Must be inside container **

Start Conda environment:

mamba activate caiman

then either:

Commandline:

./home/seluser/caiman_data/test_demos.sh

Jupyter (Within Docker):

jupyter notebook

Jupyter (From Host Machine):

jupyter notebook --ip 0.0.0.0 --no-browser --NotebookApp.token='token'

INSTALL INTO DOCKER

Install Docker

https://docs.docker.com/engine/install/ubuntu/#install-using-the-convenience-script

Get base image

docker pull selenium/standalone-chrome:116.0-20230904
sudo docker rm -f cm; sudo docker run --name cm -d -p 4444:4444 -p 5900:5900 -e SE_VNC_PASSWORD=password --shm-size="4g" selenium/standalone-chrome:116.0-20230904
sudo docker exec -it cm bash # To get terminal
sudo docker exec -it cm /opt/bin/start-vnc.sh & # If VNC needs to restart

Install basic utilities

sudo apt-get update
sudo apt-get install -y nano git ncdu

Docker: Save image edits

sudo docker commit 493fe32c72ba cannin/caiman:1.9.15-20230906
sudo docker push cannin/caiman:1.9.15-20230906

CaImAn Mamba Install

Install Mamba

wget "https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-$(uname)-$(uname -m).sh"
bash Mambaforge-$(uname)-$(uname -m).sh

Install CaImAn

mamba create --name caiman python=3.9
mamba activate caiman
mamba install -c conda-forge caiman=1.9.15

Install caiman_data

caimanmanager.py install # File automatically in path after install; this will make a copy of: bin, demos, docs, example_movies, LICENSE.txt, model, README.md temp testdata test_demos.sh VERSION to ~/caiman_data

Make copy of CaImAn code (optional)

git clone https://github.com/flatironinstitute/CaImAn.git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment